Fisher: reduced-dimensionality classification, example #1
Generate data from two Gaussian classes
Definition of Gaussians
 ![μ1 = {1, 1} ; RowBox[{RowBox[{Σ1,  , =,  , RowBox[{.07, RowBox[{{, RowBox[{RowBox[{{, RowBox[{1., ,, -.4}], }}], ,, {-.4, .2}}], }}]}]}], ;}]](../HTMLFiles/index_67.gif) 
 ![RowBox[{RowBox[{μ2,  , =,  , RowBox[{{, RowBox[{0, ,, 1.3}], }}]}], ;}] RowBox[{RowBox[{& ... owBox[{.07, RowBox[{{, RowBox[{RowBox[{{, RowBox[{1., ,, -.4}], }}], ,, {-.4, .2}}], }}]}]}], ;}]](../HTMLFiles/index_68.gif) 
Number of points in each class
  
Generate data
 ![data1 = Table[rg[μ1, Σ1], {n1}] ; data2 = Table[rg[μ2, Σ2], {n2}] ;](../HTMLFiles/index_70.gif) 
Visualize data
 ![gd1 = PlotData2D[data1, pr, style1, nS] ; gd2 = PlotData2D[data2, pr, style2, nS] ; gdata = Sh ... gd2, FrameTrue, FrameTicksNone, yS, PlotRangeAll, ImageSize400] ;](../HTMLFiles/index_71.gif) 
 ![[Graphics:../HTMLFiles/index_72.gif]](../HTMLFiles/index_72.gif) 
Fisher linear discriminant
 ![w = Fisher[data1, data2] ;](../HTMLFiles/index_73.gif) 
Visualize Fisher projections
 ![VisualizeProjections[w, data1, data2, style1, style2, {0, 2}, ImageSize400] ;](../HTMLFiles/index_74.gif) 
 ![[Graphics:../HTMLFiles/index_75.gif]](../HTMLFiles/index_75.gif) 
One-dimensional Fisher-based classification
Project data onto Fisher discriminant line
 ![d1pca = ProjectFisher[w, data1//N] ; d2pca = ProjectFisher[w, data2//N] ;](../HTMLFiles/index_76.gif) 
Compute corresponding 1d Gaussian pdfs
 ![p1 = ComputePDF1D[d1pca // N, Red] ; p2 = ComputePDF1D[d2pca // N, Red] ;](../HTMLFiles/index_77.gif) 
Display resulting pdfs
 ![pl1 = ShowTwoGaussianPDFs1D[p1, p2, {0, 2}, x, AxesNone, ImageSize400] ; Show[pl1, yS] ;](../HTMLFiles/index_78.gif) 
 ![[Graphics:../HTMLFiles/index_79.gif]](../HTMLFiles/index_79.gif) 
Error over training data
Decision boundary
 ![RowBox[{RowBox[{db, =, RowBox[{ComputeDecisionBoundary1D, [, RowBox[{p1, ,, p2, ,, x, ,, RowBox[{{, RowBox[{1, ,, 1.5}], }}]}], ]}]}], ;}]](../HTMLFiles/index_80.gif) 
Classification error based on 1d Gaussian pdfs
 ![ErrorOverTrainingSet[w, data1, data2]](../HTMLFiles/index_81.gif) 
  
Compare to 2d classificationGaussian
Compute Gaussian pdfs
 ![pdf1 = gaussian[data1, {x, y}] ; pdf2 = gaussian[data2, {x, y}] ;](../HTMLFiles/index_83.gif) 
Classification of input space
 ![pr = AbsoluteOptions[gdata, PlotRange]//Last // Last ;](../HTMLFiles/index_84.gif) 
 ![ShowTwoClassificationRegions[pdf1, pdf2, pr, x, y, classColors, gdata, AxesFalse, FrameTrue, FrameTicksNone, ImageSize400, yS] ;](../HTMLFiles/index_85.gif) 
 ![[Graphics:../HTMLFiles/index_86.gif]](../HTMLFiles/index_86.gif) 
Created by Mathematica (October 20, 2003)