E
- the class of the data sampleL
- the class of the labels for each data samplepublic class OneVsAllMulticlassMethod<E,L extends java.lang.Comparable<L>> extends MulticlassMethod<E,L>
The One Vs All heuristic uses multiple OnlineEngines, one for each possible pair of labels. It then trains each OnlineEngine with the training data instances that belong to the pair of labels assigned to the OnlineEngine. To train, each classifiers votes for one of two labels, in the end the most voted label will be the answer.
Constructor and Description |
---|
OneVsAllMulticlassMethod(OnlineEngine.Conf<E> conf)
Creates a multi-class method based on the One Vs all heuristic
|
Modifier and Type | Method and Description |
---|---|
L |
getResult(DataObject<E> instance)
Classifies a data instance with a label
|
void |
train(java.util.List<DataObject<E>> trainingData,
java.util.List<L> labelsData,
int iterations,
boolean cacheMatrix,
java.util.List<EngineObserver<E>> engineObservers)
Trains the multi-class method using the training data instances and their
labels.
|
public OneVsAllMulticlassMethod(OnlineEngine.Conf<E> conf)
conf
- the OnlineEngine.Conf object that can create OnlineEnginespublic void train(java.util.List<DataObject<E>> trainingData, java.util.List<L> labelsData, int iterations, boolean cacheMatrix, java.util.List<EngineObserver<E>> engineObservers)
MulticlassMethod
train
in class MulticlassMethod<E,L extends java.lang.Comparable<L>>
trainingData
- the data instances from the training datalabelsData
- the labels for the data instancesiterations
- the number of iterations to train each OnlineEngine
neededcacheMatrix
- a boolean that defines the use of a Cache based on a matrixengineObservers
- a list of EngineOverver objects that will receive
information in each step of the algorithm that trains the OnlineEnginespublic L getResult(DataObject<E> instance)
MulticlassMethod
getResult
in class MulticlassMethod<E,L extends java.lang.Comparable<L>>
instance
- the data instance object