public class OneVersusOne<T> extends java.lang.Object implements SoftClassifier<T>
| Constructor and Description |
|---|
OneVersusOne(Classifier<T>[][] classifiers,
PlattScaling[][] platts)
Constructor.
|
OneVersusOne(Classifier<T>[][] classifiers,
PlattScaling[][] platts,
smile.util.IntSet labels)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> OneVersusOne<T> |
fit(T[] x,
int[] y,
java.util.function.BiFunction<T[],int[],Classifier<T>> trainer)
Fits a multi-class model with binary classifiers.
|
static <T> OneVersusOne<T> |
fit(T[] x,
int[] y,
int pos,
int neg,
java.util.function.BiFunction<T[],int[],Classifier<T>> trainer)
Fits a multi-class model with binary classifiers.
|
int |
predict(T x)
Prediction is based on voting.
|
int |
predict(T x,
double[] posteriori)
Prediction is based posteriori probability estimation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyAsDouble, applyAsInt, f, predictpublic OneVersusOne(Classifier<T>[][] classifiers, PlattScaling[][] platts)
classifiers - the binary classifier for each one-vs-one case.
Only the lower half is needed.public OneVersusOne(Classifier<T>[][] classifiers, PlattScaling[][] platts, smile.util.IntSet labels)
classifiers - the binary classifier for each one-vs-one case.
Only the lower half is needed.labels - the class labels.public static <T> OneVersusOne<T> fit(T[] x, int[] y, java.util.function.BiFunction<T[],int[],Classifier<T>> trainer)
x - the training samples.y - the training labels.trainer - the lambda to train binary classifiers.public static <T> OneVersusOne<T> fit(T[] x, int[] y, int pos, int neg, java.util.function.BiFunction<T[],int[],Classifier<T>> trainer)
x - the training samples.y - the training labels.pos - the class label for one case.neg - the class label for rest cases.trainer - the lambda to train binary classifiers.public int predict(T x)
predict in interface Classifier<T>x - the instance to be classified.public int predict(T x, double[] posteriori)
predict in interface SoftClassifier<T>x - an instance to be classified.posteriori - the array to store a posteriori probabilities on output.