Histogram modeling definitions

Uniform quantization

UniformQuantization[xrange_, yrange_, n_] := Module[{dx, dy}, dx = (xrange[[2] ... ]], dx + .00001},  {y, yrange[[1]] + dy/2, yrange[[2]], dy + .00001}]], 2] // N] ;

Vector quantization

Classification of data into current centroids

VQClass[x_, μs_] := Module[{tmp}, tmp = dist[x, #] & /@ μs ; Position[tmp, Min[tmp]] // Flatten // First] ;

Splitting of centroids

RowBox[{RowBox[{RowBox[{VQSplitCentroid, [, RowBox[{μ_, ,, RowBox[{ϵ_:, 0.0001}]}], ]}], :=, , {μ + ϵ, μ - ϵ}}], ;}]

RowBox[{RowBox[{RowBox[{VQSplitAllCentroids, [, RowBox[{μs_, ,,  , RowBox[{ϵ_:, 0.0 ... tmp = VQSplitCentroid /@ μs ; Partition[Flatten[tmp], Length[First[μs]]]]}], ;}]

One step of VQ algorithm

VQOne[data_, μs_] := Module[{k, cl}, k = Length[μs] ; cl = V ... mp; /@ data ; Mean /@ (Part[data, Flatten[Position[cl, #]]] & /@ Range[k]) ] ;

One iteration of Linde-Buzo-Grey (LBG) VQ algorithm

VQOneLBG[data_, μs_, tst_:.01] := NestWhile[VQOne[data, #] &, μs, (conv[#1, #2] >tst) &, 2] ;

Full LBG VQ algorithm

VQ[data_, m_:1, tst_:.01] := Module[{μs}, μs = {Mean[data]} ; ᡝ ... 56;s] ; μs = VQOneLBG[data, μs, tst], {m} ] ; μs] ;

Histogram computation

Count number of points in each cluster

CountFrequencies[data_, μs_] := Module[{k, cl, freq, f2}, k = Length[_ ... 56;s]}] ;  (f2[[#[[2]]]] = #[[1]]) & /@ freq ; f2/Length[data] // N] ;

Compute histogram matrix

Histogram[data_, μs_, {xrange_, yrange_}, n_:20] := Module[{freq, dx, dy}, ᡝ ... ]]], {x, xrange[[1]], xrange[[2]], dx}, {y, yrange[[1]], yrange[[2]], dy}] // Transpose] ;

Histogram classification

Compute two-class classification

HistogramClass[hList_] := Map[If[#[[1]] < #[[2]], 0, 1] &, Transpose /@ Transpose[hList], {2}] ;

Draw two-class classification

DrawHistogramClass[hList_, {c1_, c2_}, opts___] := Module[{cl, drw}, cl = Hist ... phics[Raster[drw, ColorFunctionRGBColor]], AspectRatioAutomatic, opts] ] ;

Histogram visualization

Visualize output of Histogram[ ]

DrawHistogram[h_, pr_, opts___] := Module[{meshRange}, meshRange = Partition[F ... stPlot3D[h, MeshRangemeshRange, PlotRangeAll, MeshFalse, opts] ] ;

Visualize partitioning of 2d space

DrawPartitioning[μs_, pr_, opts___] := Module[{vert, val, plotRange}, plo ... ;s, vert, val, LabelPointsFalse, PlotRangepr, FrameTrue, opts] ] ;


Created by Mathematica  (September 8, 2003)