Local definitions

Specialized data generation and visualization functions

AnnularRegion[center_, r1_, r2_, n_] := Module[{tst, x1, x2, count, xd, t1, t2, range1, range2 ... )^2]) < r2 && tst > r1, xd[[count ++]] = {t1, t2}] ] ; xd] ;

AntiAnnularRegion[center_, r1_, r2_, n_] := Module[{tst, x1, x2, count, xd, t1, t2, range1, ra ... (t2 - x2)^2]) > r2 || tst < r1, xd[[count ++]] = {t1, t2}] ] ; xd] ;

Region definitions

c1 = {.5, .5} ; (* center of annular region *)rr1 = .12 ; (* inner radius *)rr2 = .35 ; (* outer radius *)

DrawAnnularRegion2[center_, r1_, r2_, pr_, color_:LightPink, color2_:White, opt___] :=  ... 754;Automatic, PlotRange {{xmin, xmax}, {ymin, ymax}}, FrameTrue, opt] ] ;

specialClassPlot := Show[Graphics[{class1Color, Rectangle[{0, 0}, {1, 1}]}],   DrawA ...  rr1, rr2, pr, class2Color, class1Color, nS] , AspectRatio->Automatic, FrameTrue, nF] ;

Visualize annular region in 2d

Draw annular region in 2d

RowBox[{RowBox[{DrawAnnularRegion[center_, r1_, r2_, pr_, color_:LightPink, opt___], :=, ɯ ... 62754; {{xmin, xmax}, {ymin, ymax}}, ,, FrameTrue, ,, opt}], ]}]}]}], , ]}]}], ;}]

Plot multiple results for annular region

AnnularAllPlot[center_, r1_, r2_, {μ_, Σ_, priors_}] := Module[{pr, g1, g2,  ... 2371;gb = Show[g1, g3] ; Show[GraphicsArray[{{ga, gb}, {g4, g5}}], yS, imSize] ] ;

All-in-one EM function (annular region)

RowBox[{RowBox[{EMAll1[data_, k_, scalar_:False], :=, , RowBox[{Module, [, RowBox[{{in ... , ]}], ;, , {AnnularAllPlot[c1, rr1, rr2, Last[em]], em // Last}}]}], , ]}]}], ;}]

Local plot of log-likelihood

PlotLogLikelihood2[em_, xd_, opt___] := Module[{logp, traj, g1, g2}, logp = Lo ... #62371;Show[ g1, g2, yS, AspectRatio ->1/GoldenRatio, GridLines->Automatic, opt] ] ;

Special data generation functions (interlocking-polygonal regions)

withinRectangle[p_, r_] := <br />    Module[{rx1, ry1, rx2, ry2, x, y}, <b ... ry2, <br />            True, False]] ;

RowBox[{withinRegion2[p_], :=, <br />,     , RowBox[{If, [, <br />,   ... }], ]}]}], ,, <br />,         , True, ,,  , False}], ]}]}]

RowBox[{RowBox[{region1Data[n_], :=, <br />,     , RowBox[{Module, [, RowB ... ;  xd[[count ++]] = p]}]}], ]}], ;, <br />,     , xd}]}], ]}]}], ;}]

RowBox[{RowBox[{region2Data[n_], :=, <br />,         , ... ;  xd[[count ++]] = p]}]}], ]}], ;, <br />,     , xd}]}], ]}]}], ;}]

RowBox[{RowBox[{RR,  , :=,  , RowBox[{Random, [, RowBox[{Real, ,,  , RowBox[{{, RowBox[{0., ,,  , 1.}], }}]}], ]}]}], ;}]

TransformProbabilityVector[prob_] := <br />    Module[{s = 0, len}, <br /> ... nbsp;       Join[Table[s = s + prob[[i]], {i, 1, len}], {1}]] ;

PickOne[ priors_] := <br />    Module[{r}, <br />    & ... ; (Position[(r <= #) & /@ TransformProbabilityVector[priors], True] // Flatten) // First] ;

GenerateFromMixturePDF[{mu_, sigma_, priors_}] := <br />    Module[{k, d,  ... ss]], sigma[[class]] IdentityMatrix[d]]] <br />        ] ;

RowBox[{RowBox[{specialClassPlot2,  , :=, RowBox[{Show, [, RowBox[{RowBox[{Graphics, [, RowBox ...  }}]}], }}], ]}], ,,  , AspectRatio->Automatic, ,,  , FrameTrue, ,,  , nF}], ]}]}], ;}]

Visualize interlocking regions in 2d

Saved data definition

RowBox[{RowBox[{poly,  , =, RowBox[{{, RowBox[{Partition[ {0, 0, 8, 0, 8, 2, 2, 2, 2, 4, 8, 4, 8, 6, 2, 6, 2, 8, 8, 8, 8, 10, 0, 10}, 2], /, 10.}], }}]}], ;}]

Draw polygonal region

drawPolygonalRegion[polyL_, pr_, color_:LightPink, opt___] := Module[{xmin, xmax, ymin ... 4; {{xmin, xmax}, {ymin, ymax}}, FrameTrue, AspectRatioAutomatic, opt] ] ;

drawAntiPolygonalRegion[polyL_, pr_, color_:LightPink, opt___] := Module[{xmin, xmax,  ... 4; {{xmin, xmax}, {ymin, ymax}}, FrameTrue, AspectRatioAutomatic, opt] ] ;

Plot multiple results for polygonal region

PolygonalAllPlot[polyL_, {μ_, Σ_, priors_}] := Module[{pr, g1, g2, g3, g4, g ... 2371;gb = Show[g1, g3] ; Show[GraphicsArray[{{ga, gb}, {g4, g5}}], yS, imSize] ] ;

Plot multiple results for polygonal region

AntiPolygonalAllPlot[polyL_, {μ_, Σ_, priors_}] := Module[{pr, g1, g2, g3, g ... 2371;gb = Show[g1, g3] ; Show[GraphicsArray[{{ga, gb}, {g4, g5}}], yS, imSize] ] ;

All-in-one EM function (interlocking polygonal regions)

RowBox[{RowBox[{EMAll2[data_, k_, scalar_:False], :=, , RowBox[{Module, [, RowBox[{{in ... e]}]}], ]}], ;, , {PolygonalAllPlot[poly, em//Last], em // Last}}]}], , ]}]}], ;}]

RowBox[{RowBox[{EMAll3[data_, k_, scalar_:False], :=, , RowBox[{Module, [, RowBox[{{in ... }], ]}], ;, , {AntiPolygonalAllPlot[poly, em//Last], em // Last}}]}], , ]}]}], ;}]


Created by Mathematica  (September 8, 2003)