LinearDiscriminantAnalysis Class 
Namespace: Accord.Statistics.Analysis
[SerializableAttribute] public class LinearDiscriminantAnalysis : BaseDiscriminantAnalysis, IDiscriminantAnalysis, IMultivariateAnalysis, IAnalysis, IProjectionAnalysis, ISupervisedLearning<LinearDiscriminantAnalysisPipeline, double[], int>
The LinearDiscriminantAnalysis type exposes the following members.
Name  Description  

LinearDiscriminantAnalysis 
Constructs a new Linear Discriminant Analysis object.
 
LinearDiscriminantAnalysis(Double, Int32)  Obsolete.
Constructs a new Linear Discriminant Analysis object.
 
LinearDiscriminantAnalysis(Double, Int32)  Obsolete.
Constructs a new Linear Discriminant Analysis object.

Name  Description  

ClassCount 
Gets the observation count for each class.
(Inherited from BaseDiscriminantAnalysis.)  
Classes 
Gets information about the distinct classes in the analyzed data.
(Inherited from BaseDiscriminantAnalysis.)  
Classifications  Obsolete.
Gets the original classifications (labels) of the source data
given on the moment of creation of this analysis object.
(Inherited from BaseDiscriminantAnalysis.)  
Classifier 
Gets a classification pipeline that can be used to classify
new samples into one of the NumberOfClasses
learned in this discriminant analysis. This pipeline is
only available after a call to the Learn(Double, Int32, Double) method.
 
ClassMeans 
Gets the Mean vector for each class.
(Inherited from BaseDiscriminantAnalysis.)  
ClassScatter 
Gets the Scatter matrix for each class.
(Inherited from BaseDiscriminantAnalysis.)  
ClassStandardDeviations 
Gets the Standard Deviation vector for each class.
(Inherited from BaseDiscriminantAnalysis.)  
CumulativeProportions 
The cumulative distribution of the discriminants factors proportions.
Also known as the cumulative energy of the first dimensions of the discriminant
space or as the amount of variance explained by those dimensions.
(Inherited from BaseDiscriminantAnalysis.)  
DiscriminantMatrix  Obsolete.
Gets the Eigenvectors obtained during the analysis,
composing a basis for the discriminant factor space.
(Inherited from BaseDiscriminantAnalysis.)  
DiscriminantProportions 
Gets the level of importance each discriminant factor has in
discriminant space. Also known as amount of variance explained.
(Inherited from BaseDiscriminantAnalysis.)  
Discriminants 
Gets the discriminant factors in a objectoriented fashion.
(Inherited from BaseDiscriminantAnalysis.)  
DiscriminantVectors 
Gets the Eigenvectors obtained during the analysis,
composing a basis for the discriminant factor space.
(Inherited from BaseDiscriminantAnalysis.)  
Eigenvalues 
Gets the Eigenvalues found by the analysis associated
with each vector of the ComponentMatrix matrix.
(Inherited from BaseDiscriminantAnalysis.)  
Means 
Gets the mean of the original data given at method construction.
(Inherited from BaseDiscriminantAnalysis.)  
NumberOfClasses 
Gets the number of classes in the analysis.
(Inherited from BaseDiscriminantAnalysis.)  
NumberOfInputs 
Gets the number of inputs accepted by the model.
(Inherited from TransformBaseTInput, TOutput.)  
NumberOfOutputs 
Gets the number of outputs generated by the model.
(Inherited from TransformBaseTInput, TOutput.)  
NumberOfSamples 
Gets the number of samples used to create the analysis.
(Inherited from BaseDiscriminantAnalysis.)  
ProjectionMeans 
Gets the feature space mean of the projected data.
(Inherited from BaseDiscriminantAnalysis.)  
Result  Obsolete.
Gets the resulting projection of the source data given on
the creation of the analysis into discriminant space.
(Inherited from BaseDiscriminantAnalysis.)  
ScatterBetweenClass 
Gets the BetweenClass Scatter Matrix for the data.
(Inherited from BaseDiscriminantAnalysis.)  
ScatterMatrix 
Gets the Total Scatter Matrix for the data.
(Inherited from BaseDiscriminantAnalysis.)  
ScatterWithinClass 
Gets the WithinClass Scatter Matrix for the data.
(Inherited from BaseDiscriminantAnalysis.)  
Source  Obsolete.
Returns the original supplied data to be analyzed.
(Inherited from BaseDiscriminantAnalysis.)  
StandardDeviations 
Gets the standard mean of the original data given at method construction.
(Inherited from BaseDiscriminantAnalysis.)  
Threshold 
Gets or sets the minimum variance proportion needed to keep a
discriminant component. If set to zero, all components will be
kept. Default is 0.001 (all components which contribute less
than 0.001 to the variance in the data will be discarded).
(Inherited from BaseDiscriminantAnalysis.)  
Token 
Gets or sets a cancellation token that can be used to
stop the learning algorithm while it is running.
(Inherited from BaseDiscriminantAnalysis.) 
Name  Description  

Classify(Double)  Obsolete. Transform
Classifies a new instance into one of the available classes.
(Overrides BaseDiscriminantAnalysisClassify(Double).)  
Classify(Double)  Obsolete.
Classifies new instances into one of the available classes.
(Overrides BaseDiscriminantAnalysisClassify(Double).)  
Classify(Double, Double)  Obsolete.
Classifies a new instance into one of the available classes.
(Overrides BaseDiscriminantAnalysisClassify(Double, Double).)  
Compute  Obsolete.
Computes the MultiClass Linear Discriminant Analysis algorithm.
 
CreateDiscriminants 
Creates additional information about principal components.
(Inherited from BaseDiscriminantAnalysis.)  
DiscriminantFunction 
Gets the output of the discriminant function for a given class.
(Overrides BaseDiscriminantAnalysisDiscriminantFunction(Double, Int32).)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetNumberOfDimensions 
Returns the minimum number of discriminant space dimensions (discriminant
factors) required to represent a given percentile of the data.
(Inherited from BaseDiscriminantAnalysis.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
init  Obsolete.
Obsolete.
(Inherited from BaseDiscriminantAnalysis.)  
Init 
Initializes common properties.
(Inherited from BaseDiscriminantAnalysis.)  
Learn 
Learns a model that can map the given inputs to the given outputs.
 
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ToString  Returns a string that represents the current object. (Inherited from Object.)  
Transform(Double)  Obsolete.
Obsolete.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double) 
Applies the transformation to an input, producing an associated output.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double) 
Applies the transformation to an input, producing an associated output.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double, Int32)  Obsolete.
Obsolete.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double, Int32)  Obsolete.
Obsolete.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double, Int32)  Obsolete.
Obsolete.
(Inherited from BaseDiscriminantAnalysis.)  
Transform(Double, Double) 
Applies the transformation to an input, producing an associated output.
(Overrides TransformBaseTInput, TOutputTransform(TInput, TOutput).) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
Linear Discriminant Analysis (LDA) is a method of finding such a linear combination of variables which best separates two or more classes.
In itself LDA is not a classification algorithm, although it makes use of class labels. However, the LDA result is mostly used as part of a linear classifier. The other alternative use is making a dimension reduction before using nonlinear classification algorithms.
It should be noted that several similar techniques (differing in requirements to the sample) go together under the general name of Linear Discriminant Analysis. Described below is one of these techniques with only two requirements:
Moreover, LDA requires the following assumptions to be true:
If the latter assumption is violated, it is common to use quadratic discriminant analysis in the same manner as linear discriminant analysis instead.
This class can also be bound to standard controls such as the DataGridView by setting their DataSource property to the analysis' Discriminants property.
References:
// Create some sample input data instances. This is the same // data used in the GutierrezOsuna's example available on: // http://research.cs.tamu.edu/prism/lectures/pr/pr_l10.pdf double[][] inputs = { // Class 0 new double[] { 4, 1 }, new double[] { 2, 4 }, new double[] { 2, 3 }, new double[] { 3, 6 }, new double[] { 4, 4 }, // Class 1 new double[] { 9, 10 }, new double[] { 6, 8 }, new double[] { 9, 5 }, new double[] { 8, 7 }, new double[] { 10, 8 } }; int[] output = { 0, 0, 0, 0, 0, // The first five are from class 0 1, 1, 1, 1, 1 // The last five are from class 1 }; // We will create a LDA object for the data var lda = new LinearDiscriminantAnalysis(); // Compute the analysis and create a classifier var classifier = lda.Learn(inputs, output); // Now we can project the data into LDA space: double[][] projection = lda.Transform(inputs); // Or perform classification using: int[] results = classifier.Decide(inputs);