Example C: Gaussian distributions

Generate data from two Gaussian classes

Definition of Gaussians

μ1 = {.3, .3} ; RowBox[{RowBox[{Σ1,  , =,  , RowBox[{.07, RowBox[{{, RowBox[{RowBox[{{, RowBox[{1., ,, -.5}], }}], ,, {-.5, .5}}], }}]}]}], ;}]

μ2 = {-.5, -.5} ; RowBox[{RowBox[{Σ2,  , =,  , RowBox[{.04, RowBox[{{, RowBox[{RowBox[{{, RowBox[{1., ,, -.5}], }}], ,, {-.5, .5}}], }}]}]}], ;}]

Number of points in each class

n1 = 100 ; n2 = 100 ;

Generate data

data1 = Table[rgBounded[{μ1, Σ1}, pr], {n1}] ; data2 = Table[rgBounded[{μ2, Σ2}, pr], {n2}] ;

Visualize data

gd1 = PlotData2D[data1, pr, style1, nS] ; gd2 = PlotData2D[data2, pr, style2, nS] ; gd = Show[gd1, gd2, yS, FrameTicksNone] ;

[Graphics:../HTMLFiles/index_48.gif]

Uniform quantization

Number of centroids in each direction

nCentroids = 4 ;

Compute uniformly distributed centroids

uniformCentroids = UniformQuantization[pr[[1]], pr[[2]], nCentroids] ;

Visualize data

gCentroids = PlotData2D[uniformCentroids, pr, centroidStyle, FrameTicksNone] ;

[Graphics:../HTMLFiles/index_52.gif]

Histograms for two classes

Compute histograms based on uniform centroids

h1 = Histogram[data1, uniformCentroids, pr, 50] ; h2 = Histogram[data2, uniformCentroids, pr, 50] ;

Visualize two histograms

gh1 = DrawHistogram[h1, pr, nS, AxesFalse] ; gh2 = DrawHistogram[h2, pr, nS, AxesFalse] ; Show[GraphicsArray[{gh1, gh2}], yS, imSize] ;

[Graphics:../HTMLFiles/index_55.gif]

Classification of input space

gdnoFrame = Show[gd, FrameFalse, nS] ; gclass = DrawHistogramClass[{h1, h2}, {class1Color, class2Color}, nS] ; Show[GraphicsArray[{gdnoFrame, gclass}], yS, imSize] ;

[Graphics:../HTMLFiles/index_57.gif]

Data-dependent quantization (vector quantization)

Number of centroids for each class (2^m)

m = 3 ;

Compute data-dependent centroids

vqCentroids1 = VQ[data1, m] ; vqCentroids2 = VQ[data2, m] ; vqCentroids = vqCentroids1 ~ Join ~ vqCentroids2 ;

Visualize data

gCentroids = PlotData2D[vqCentroids, pr, centroidStyle, FrameTicksNone] ;

[Graphics:../HTMLFiles/index_62.gif]

Visualize resultant partitioning of input space

gpart1 = DrawPartitioning[vqCentroids, pr, nS] ; Show[gpart1, gCentroids, yS, FrameTicksNone] ;

[Graphics:../HTMLFiles/index_64.gif]

New histograms for two classes

Compute histograms based on data-dependent centroids

h1 = Histogram[data1, vqCentroids, pr, 50] ; h2 = Histogram[data2, vqCentroids, pr, 50] ;

Visualize two histograms

gh1 = DrawHistogram[h1, pr, nS, AxesFalse] ; gh2 = DrawHistogram[h2, pr, nS, AxesFalse] ; Show[GraphicsArray[{gh1, gh2}], yS, imSize] ;

[Graphics:../HTMLFiles/index_67.gif]

New classification of input space

gdnoFrame = Show[gd, FrameFalse, nS] ; gclass = DrawHistogramClass[{h1, h2}, {class1Color, class2Color}, nS] ; Show[GraphicsArray[{gdnoFrame, gclass}], yS, imSize] ;

[Graphics:../HTMLFiles/index_69.gif]


Created by Mathematica  (October 9, 2003)