Example B different uniform distributions

Generate data from two non-rectangular uniform classes

Number of points in each class

n1 = 100 ; n2 = 100 ;

Specialized data generation

SpecialDataGeneration[ flag_] := Module[{x, y},  {x, y} = r2[1] ; While[-flag * x > flag * y, {x, y} = r2[1]] ; {x, y}] ;

Generate data

data1 = Table[SpecialDataGeneration[1], {n1}] ; data2 = Table[SpecialDataGeneration[-1], {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_21.gif]

Uniform quantization

Number of centroids in each direction

nCentroids = 3 ;

Compute uniformly distributed centroids

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

Visualize data

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

[Graphics:../HTMLFiles/index_25.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_28.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_30.gif]

Data-dependent quantization (vector quantization)

Number of centroids for each class (2^m)

m = 2 ;

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_35.gif]

Visualize resultant partitioning of input space

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

[Graphics:../HTMLFiles/index_37.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_40.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_42.gif]


Created by Mathematica  (October 9, 2003)