@Reference(type=Article, author="Fisher, Ronald A.", title="{The use of multiple measurements in taxonomic problems}", year="1936", journal="Annals Eugen.", pages={"179","","188"}, volume="7", customData={"citeulike-article-id","764226","keywords","classification","posted-at","2006-09-18 14:06:16","priority","2"}) public class LinearDiscriminantAnalysis extends Object
Modifier and Type | Field and Description |
---|---|
protected double[] |
eigenvalues |
protected Jama.Matrix |
eigenvectors |
protected double[] |
mean |
protected int |
numComponents |
Constructor and Description |
---|
LinearDiscriminantAnalysis(int numComponents)
Construct with the given number of components.
|
Modifier and Type | Method and Description |
---|---|
double[] |
generate(double[] scalings)
Generate a new "observation" as a linear combination of
the eigenvectors (ev): mean + ev * scaling.
|
Jama.Matrix |
getBasis()
Get the basis (the LDA eigenvectors)
|
double[] |
getBasisVector(int index)
Get a specific basis vector as
a double array.
|
double |
getEigenValue(int i)
Get the eigen value corresponding to the ith principal component.
|
double[] |
getEigenValues() |
Jama.Matrix |
getEigenVectors()
Get the basis eigenvectors.
|
double[] |
getMean() |
void |
learnBasis(List<double[][]> data)
Learn the LDA basis.
|
void |
learnBasis(Map<?,double[][]> data)
Learn the LDA basis.
|
void |
learnBasisIP(List<? extends IndependentPair<?,double[]>> data)
Learn the LDA basis.
|
void |
learnBasisLL(List<List<double[]>> data)
Learn the LDA basis.
|
void |
learnBasisML(Map<?,List<double[]>> data)
Learn the LDA basis.
|
double[] |
project(double[] vector)
Project a vector by the basis.
|
Jama.Matrix |
project(Jama.Matrix m)
Project a matrix of row vectors by the basis.
|
protected int numComponents
protected Jama.Matrix eigenvectors
protected double[] eigenvalues
protected double[] mean
public LinearDiscriminantAnalysis(int numComponents)
numComponents
- the number of components.public void learnBasisIP(List<? extends IndependentPair<?,double[]>> data)
data
- data grouped by classpublic void learnBasisML(Map<?,List<double[]>> data)
data
- data grouped by classpublic void learnBasisLL(List<List<double[]>> data)
data
- data grouped by classpublic void learnBasis(Map<?,double[][]> data)
data
- data grouped by classpublic void learnBasis(List<double[][]> data)
data
- data grouped by classpublic Jama.Matrix getBasis()
public double[] getBasisVector(int index)
index
- the index of the vectorpublic Jama.Matrix getEigenVectors()
getBasis()
public double[] getEigenValues()
public double getEigenValue(int i)
i
- the index of the componentpublic double[] getMean()
public double[] generate(double[] scalings)
If the scaling vector is shorter than the number of components, it will be zero-padded. If it is longer, it will be truncated.
scalings
- the weighting for each eigenvectorpublic Jama.Matrix project(Jama.Matrix m)
m
- the vector to projectpublic double[] project(double[] vector)
vector
- the vector to project