Package se.hb.jcp.ml
Class ClassifierBase
- java.lang.Object
-
- se.hb.jcp.ml.ClassifierBase
-
- All Implemented Interfaces:
java.io.Serializable,IClassifier,IClassifierInformation
- Direct Known Subclasses:
BogusClassProbabilityClassifier,ExtremelyRandomizedTreesClassifier,LinearClassifier,RandomForestClassifier,SVMClassifier,SVMClassifier,SVMClassifier
public abstract class ClassifierBase extends java.lang.Object implements IClassifier, java.io.Serializable
Base class for classifiers that provide implementations of some of the generic IClassifierInformation methods.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClassifierBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidfit(cern.colt.matrix.DoubleMatrix2D x, double[] y)Trains this classifier using the supplied data.intgetAttributeCount()Returns the number of attributes the classifier has been trained on.java.lang.Double[]getLabels()Returns the set of class labels the classifier has been trained on.protected abstract voidinternalFit(cern.colt.matrix.DoubleMatrix2D x, double[] y)booleanisTrained()Returns whether this classifier has been trained.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface se.hb.jcp.ml.IClassifier
fitNew, predict
-
Methods inherited from interface se.hb.jcp.ml.IClassifierInformation
nativeStorageTemplate
-
-
-
-
Method Detail
-
fit
public final void fit(cern.colt.matrix.DoubleMatrix2D x, double[] y)Description copied from interface:IClassifierTrains this classifier using the supplied data.- Specified by:
fitin interfaceIClassifier- Parameters:
x- the attributes of the instances.y- the targets of the instances.
-
isTrained
public final boolean isTrained()
Description copied from interface:IClassifierInformationReturns whether this classifier has been trained.- Specified by:
isTrainedin interfaceIClassifierInformation- Returns:
- Returns true if the classifier has been trained or false otherwise.
-
getAttributeCount
public final int getAttributeCount()
Description copied from interface:IClassifierInformationReturns the number of attributes the classifier has been trained on.- Specified by:
getAttributeCountin interfaceIClassifierInformation- Returns:
- Returns the number of attributes the classifier has been trained on or -1 if the classifier has not been trained.
-
getLabels
public final java.lang.Double[] getLabels()
Description copied from interface:IClassifierInformationReturns the set of class labels the classifier has been trained on.- Specified by:
getLabelsin interfaceIClassifierInformation- Returns:
- Returns the class labels the classifier has been trained on in increasing order (the index is the class id) or null if the classifier has not been trained.
-
internalFit
protected abstract void internalFit(cern.colt.matrix.DoubleMatrix2D x, double[] y)
-
-