Package se.hb.jcp.bindings.jlibsvm
Class SVMClassifier
- java.lang.Object
-
- se.hb.jcp.ml.ClassifierBase
-
- se.hb.jcp.bindings.jlibsvm.SVMClassifier
-
- All Implemented Interfaces:
java.io.Serializable,IClassifier,IClassifierInformation,IClassProbabilityClassifier,ISVMClassifier
public class SVMClassifier extends ClassifierBase implements ISVMClassifier, IClassProbabilityClassifier, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected libsvm.svm_model_modelprotected libsvm.svm_parameter_parameters
-
Constructor Summary
Constructors Constructor Description SVMClassifier()SVMClassifier(libsvm.svm_parameter parameters)SVMClassifier(org.json.JSONObject parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistanceFromSeparatingPlane(cern.colt.matrix.DoubleMatrix1D instance)Returns the signed distance between the separating hyperplane and the instance.IClassifierfitNew(cern.colt.matrix.DoubleMatrix2D x, double[] y)Trains and returns a copy of this classifier using the supplied data.protected voidinternalFit(cern.colt.matrix.DoubleMatrix2D x, double[] y)cern.colt.matrix.DoubleMatrix1DnativeStorageTemplate()Returns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.doublepredict(cern.colt.matrix.DoubleMatrix1D instance)Predicts the target for the supplied instance.doublepredict(cern.colt.matrix.DoubleMatrix1D instance, double[] probabilityEstimates)Predicts the target probabilities for the supplied instance.-
Methods inherited from class se.hb.jcp.ml.ClassifierBase
fit, getAttributeCount, getLabels, isTrained
-
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
fit
-
Methods inherited from interface se.hb.jcp.ml.IClassifierInformation
getAttributeCount, getLabels, isTrained
-
-
-
-
Method Detail
-
internalFit
protected void internalFit(cern.colt.matrix.DoubleMatrix2D x, double[] y)- Specified by:
internalFitin classClassifierBase
-
fitNew
public IClassifier fitNew(cern.colt.matrix.DoubleMatrix2D x, double[] y)
Description copied from interface:IClassifierTrains and returns a copy of this classifier using the supplied data.- Specified by:
fitNewin interfaceIClassifier- Parameters:
x- the attributes of the instances.y- the targets of the instances.- Returns:
- a new IClassifier instance trained with the supplied data and using the same algorithm and parameter settings as the parent instance.
-
predict
public double predict(cern.colt.matrix.DoubleMatrix1D instance)
Description copied from interface:IClassifierPredicts the target for the supplied instance.- Specified by:
predictin interfaceIClassifier- Parameters:
instance- the instance- Returns:
- the predicted target of the instance.
-
predict
public double predict(cern.colt.matrix.DoubleMatrix1D instance, double[] probabilityEstimates)Description copied from interface:IClassProbabilityClassifierPredicts the target probabilities for the supplied instance.- Specified by:
predictin interfaceIClassProbabilityClassifier- Parameters:
instance- the instanceprobabilityEstimates- a double[] array for storing the predicted probabilities for each of target values in the order assumed by JCP.- Returns:
- the predicted target of the instance.
-
distanceFromSeparatingPlane
public double distanceFromSeparatingPlane(cern.colt.matrix.DoubleMatrix1D instance)
Returns the signed distance between the separating hyperplane and the instance.- Specified by:
distanceFromSeparatingPlanein interfaceISVMClassifier- Parameters:
instance- the instance.- Returns:
- the signed distance between the separating hyperplane and the instance.
-
nativeStorageTemplate
public cern.colt.matrix.DoubleMatrix1D nativeStorageTemplate()
Description copied from interface:IClassifierInformationReturns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.- Specified by:
nativeStorageTemplatein interfaceIClassifierInformation- Returns:
- a value of the DoubleMatrix1D derived class of the native storage format for the classifier.
-
-