public abstract class Classifier
extends java.lang.Object
Assume that each classifier will be able to return 0 - n-1 different species classifications. They will provide a list of which species correspond to those numbers. -1 (for nothing I recognise) will also be a valid classification result.
these classifiers are not thread safe. e.g. When running classifiers, it's likely that you will call one of the runClassification functions which will return the most likely result, but you may follow this up with subsequent calls to getLogLikelyhood() and getProbability() to get more information about individual group probabilities.
Modifier and Type | Class and Description |
---|---|
static class |
Classifier.ProbabilityType
Type of probability that will be returned by this classifier.
|
Constructor and Description |
---|
Classifier() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.String |
getClassifierName() |
abstract ClassifierParams |
getClassifierParams()
Will get called AFTER classifier training to get
classifier specific parameters.
|
double[] |
getLogLikelihoods1()
Get an array of log likelihoods from the most
recent call to runClassification(double[] );
|
double[][] |
getLogLikelihoods2()
Get a double array of log likelihoods from the most
recent call to runClassification(double[][] );
|
abstract Jama.Matrix |
getLogLikelihoodsM()
Get a matrix of log likelihoods from
the most recent call to RunClassification(Matrix )
|
double |
getMinimumProbability() |
double[] |
getProbabilities1()
Get an array of probabilities from the most
recent call to runClassification(double[] );
|
double[][] |
getProbabilities2()
Get a double array of probabilities from the most
recent call to runClassification(double[][] );
|
abstract Jama.Matrix |
getProbabilitiesM()
Get a matrix of probabilities from
the most recent call to RunClassification(Matrix )
|
abstract Classifier.ProbabilityType |
getProbabilityType()
Get the type of probability returned by a classifier.
|
boolean |
hasParamsDialog() |
int |
runClassification(double[] params)
Run the classification on single parameter value.
|
int[] |
runClassification(double[][] params)
Run classification on multiple parameter values.
|
abstract int[] |
runClassification(Jama.Matrix data) |
abstract boolean |
setClassifierParams(ClassifierParams classifierParams)
Will be called to load stored parameters into a
classifier.
|
void |
setMinimumProbability(double minimumProbability) |
boolean |
showParamsDialog(java.awt.Window parent) |
java.lang.String |
toString() |
java.lang.String |
trainClassification(double[][] params,
int[] group)
Train the classifier.
|
abstract java.lang.String |
trainClassification(Jama.Matrix matrix,
int[] group)
/**
Train the classifier.
|
public abstract ClassifierParams getClassifierParams()
public abstract boolean setClassifierParams(ClassifierParams classifierParams)
classifierParams
- classifier parameters.public boolean hasParamsDialog()
public boolean showParamsDialog(java.awt.Window parent)
public int runClassification(double[] params)
Return true if the classification completed OK, false otherwise. The classification results can be obtained through calls to getClassLikelyhoods() and getBestSpeciesBet();
params
- array of input parameterspublic int[] runClassification(double[][] params)
params
- array of input parameterspublic abstract int[] runClassification(Jama.Matrix data)
public double[] getLogLikelihoods1()
This version will return a single row of data, which should be from a single classification
public double[][] getLogLikelihoods2()
This version will return a 2D array of data, which should be from a set of classifications
public abstract Jama.Matrix getLogLikelihoodsM()
This version will return a matrix of data, which should be from a set of classifications.
public double[] getProbabilities1()
This version will return a single row of data, which should be from a single classification
public double[][] getProbabilities2()
This version will return a 2D array of data, which should be from a set of classifications
public abstract Jama.Matrix getProbabilitiesM()
This version will return a matrix of data, which should be from a set of classifications.
public abstract Classifier.ProbabilityType getProbabilityType()
public double getMinimumProbability()
public void setMinimumProbability(double minimumProbability)
minimumProbability
- the minimumProbability to setpublic java.lang.String trainClassification(double[][] params, int[] group)
params
- double array of input data, each row representing one
training value, and each column one parameter value.truth
- public abstract java.lang.String trainClassification(Jama.Matrix matrix, int[] group)
params
- double array of input data, each row representing one
training value, and each column one parameter value.matrix
- matrix of training data (each row one training point, each col one parametergroup
- truthpublic java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String getClassifierName()