Package classifier
Class LinearClassifier
java.lang.Object
classifier.Classifier
classifier.LinearClassifier
Train and run linear classification
- Author:
- Doug Gillespie
-
Nested Class Summary
Nested classes/interfaces inherited from class classifier.Classifier
Classifier.ProbabilityType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionWill get called AFTER classifier training to get classifier specific parameters.Jama.Matrix
Get a matrix of log likelihoods from the most recent call to RunClassification(Matrix )Jama.Matrix
Get a matrix of probabilities from the most recent call to RunClassification(Matrix )Get the type of probability returned by a classifier.int[]
runClassification
(Jama.Matrix data) boolean
setClassifierParams
(ClassifierParams classifierParams) Will be called to load stored parameters into a classifier.trainClassification
(Jama.Matrix matrix, int[] truth) /** Train the classifier.Methods inherited from class classifier.Classifier
getLogLikelihoods1, getLogLikelihoods2, getMinimumProbability, getProbabilities1, getProbabilities2, hasParamsDialog, runClassification, runClassification, setMinimumProbability, showParamsDialog, toString, trainClassification
-
Constructor Details
-
LinearClassifier
public LinearClassifier()
-
-
Method Details
-
trainClassification
Description copied from class:Classifier
/** Train the classifier.- Specified by:
trainClassification
in classClassifier
- Parameters:
matrix
- matrix of training data (each row one training point, each col one parametertruth
- truth- Returns:
- null if OK or error string
-
runClassification
public int[] runClassification(Jama.Matrix data) - Specified by:
runClassification
in classClassifier
-
getLogLikelihoodsM
public Jama.Matrix getLogLikelihoodsM()Description copied from class:Classifier
Get a matrix of log likelihoods from the most recent call to RunClassification(Matrix )This version will return a matrix of data, which should be from a set of classifications.
- Specified by:
getLogLikelihoodsM
in classClassifier
- Returns:
- log likelihoods matrix.
-
getProbabilitiesM
public Jama.Matrix getProbabilitiesM()Description copied from class:Classifier
Get a matrix of probabilities from the most recent call to RunClassification(Matrix )This version will return a matrix of data, which should be from a set of classifications.
- Specified by:
getProbabilitiesM
in classClassifier
- Returns:
- probabilities matrix.
-
getProbabilityType
Description copied from class:Classifier
Get the type of probability returned by a classifier. this will either be NORMALISED, ABSOLUTE or UNAVAILABLE in which case the classifier should still return data (to stop things crashing) but should return arrays / Matrixes with zeros in all columns except the selected item, which should be 1.- Specified by:
getProbabilityType
in classClassifier
- Returns:
- type of probability returned.
-
getClassifierParams
Description copied from class:Classifier
Will get called AFTER classifier training to get classifier specific parameters.- Specified by:
getClassifierParams
in classClassifier
- Returns:
- classifier specific parameters.
-
setClassifierParams
Description copied from class:Classifier
Will be called to load stored parameters into a classifier.- Specified by:
setClassifierParams
in classClassifier
- Parameters:
classifierParams
- classifier parameters.- Returns:
- Return true if parameters loaded OK. Reasons for not loading include the classifier being incompatible with the classifier parameters or the parameters not being present (e.t. null matrixes)
-
getClassifierName
- Specified by:
getClassifierName
in classClassifier
- Returns:
- the classifier name, e.g. Linear Discriminant Analysis
-