public class QDA extends Object implements Classifier<double[]>
The Gaussian parameters for each class can be estimated from training data
with maximum likelihood (ML) estimation. However, when the number of
training instances is small compared to the dimension of input space,
the ML covariance estimation can be ill-posed. One approach to resolve
the ill-posed estimation is to regularize the covariance estimation.
One of these regularization methods is regularized discriminant analysis
.
LDA
,
RDA
,
NaiveBayes
Modifier and Type | Class and Description |
---|---|
static class |
QDA.Trainer
Trainer for quadratic discriminant analysis.
|
Constructor and Description |
---|
QDA(double[][] x,
int[] y)
Learn quadratic discriminant analysis.
|
QDA(double[][] x,
int[] y,
double tol)
Learn quadratic discriminant analysis.
|
QDA(double[][] x,
int[] y,
double[] priori)
Learn quadratic discriminant analysis.
|
QDA(double[][] x,
int[] y,
double[] priori,
double tol)
Learn quadratic discriminant analysis.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getPriori()
Returns a priori probabilities.
|
int |
predict(double[] x)
Predicts the class label of an instance.
|
int |
predict(double[] x,
double[] posteriori)
Predicts the class label of an instance and also calculate a posteriori
probabilities.
|
public QDA(double[][] x, int[] y)
x
- training samples.y
- training labels in [0, k), where k is the number of classes.public QDA(double[][] x, int[] y, double[] priori)
x
- training samples.y
- training labels in [0, k), where k is the number of classes.priori
- the priori probability of each class.public QDA(double[][] x, int[] y, double tol)
x
- training samples.y
- training labels in [0, k), where k is the number of classes.tol
- a tolerance to decide if a covariance matrix is singular; it
will reject variables whose variance is less than tol2.public QDA(double[][] x, int[] y, double[] priori, double tol)
x
- training samples.y
- training labels in [0, k), where k is the number of classes.priori
- the priori probability of each class. If null, it will be
estimated from the training data.tol
- a tolerance to decide if a covariance matrix is singular; it
will reject variables whose variance is less than tol2.public double[] getPriori()
public int predict(double[] x)
Classifier
predict
in interface Classifier<double[]>
x
- the instance to be classified.public int predict(double[] x, double[] posteriori)
Classifier
predict
in interface Classifier<double[]>
x
- the instance to be classified.posteriori
- the array to store a posteriori probabilities on output.Copyright © 2015. All rights reserved.