Local definitions

Turn off integration warning message

Off[NIntegrate :: ncvb] ; Off[NIntegrate :: slwcon] ;

Read whole image

ReadWholeImage[file_, dir_:"."] := Module[{im, d}, im = Import[dir<>"/"<>file<>".ppm", "PPM"] ; im] ;

Compute 1D pdfs

ComputePDF1D[data_] := Module[{stats}, stats = {Mean[data // N], StandardDeviation[data // N]} ; pdf1D[stats, x] ] ;

One-dimensional decision boundary

ComputeDecisionBoundary1D[pdf1_, pdf2_, x_:x] := Module[{sol, lpdf1, lpdf2}, l ... [Length[sol] 1,  {sol // First},  {sol // First, sol // Last}] ] ;

Expected error (1d)

ExpectedError1D[pdf1_, pdf2_, x_:x] := NIntegrate[Min[pdf1, pdf2], {x, 0, 255}] * 100 ;

Expected error (2d)

ExpectedError2D[pdf1_, pdf2_, x_:x, y_:y] := NIntegrate[Min[pdf1, pdf2], {x, 0, 255}, {y, 0, 255}] * 100 ;

Classify image (1d)

ClassifyImage1D[im_, db_] := Module[{class, gr, bl}, gr = (List @@ Orange) * 2 ... 62371;ReplacePart[ReplacePart[im, class, {1, 1}], ColorFunction-> RGBColor, {1, 4}] ] ;

Classify image (2d)

ClassifyImage2D[feat_, pdf1_, pdf2_] := Module[{class, lpdf, gr, bl, size}, si ... nctionRGBColor], ImageSize {size, size}, AspectRatioAutomatic] ] ;

Colors representing two classes

Data colors

data1Color = Green ; data2Color = Blue ;

style1 = {data1Color, PointSize[.02]} ; style2 = {data2Color, PointSize[.02]} ;

Classification region colors

class1Color = RGBColor[1, 1, .5] ; class2Color = RGBColor[.5, 1, 1] ;

classColors = {class1Color, class2Color} ;


Created by Mathematica  (October 9, 2003)