jsat.classifiers
Class RegressorToClassifier
- java.lang.Object
-
- jsat.classifiers.RegressorToClassifier
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, BinaryScoreClassifier, Classifier, Parameterized
public class RegressorToClassifier extends java.lang.Object implements BinaryScoreClassifier, Parameterized
This meta algorithm wraps aRegressorto perform binary classification. This is done my labeling class 0 data points as "-1" and class 1 points as "1". The sign of the outputs then determines the class. Not all regression algorithms will work well in this setting, and standard parameter values need to change.
The parameter values returned are exactly those provided by the given regressor, or an empty list if the regressor does not implementParameterized- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RegressorToClassifier(Regressor regressor)Creates a new Binary Classifier by using the given regressor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.RegressorToClassifierclone()ParametergetParameter(java.lang.String paramName)Returns the parameter with the given name.java.util.List<Parameter>getParameters()Returns the list of parameters that can be altered for this learner.doublegetScore(DataPoint dp)Returns the numeric score for predicting a class of a given data point, where the sign of the value indicates which class the data point is predicted to belong to.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet)Trains the classifier and constructs a model for classification using the given data set.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.
-
-
-
Constructor Detail
-
RegressorToClassifier
public RegressorToClassifier(Regressor regressor)
Creates a new Binary Classifier by using the given regressor- Parameters:
regressor- the regressor to wrap as a binary classifier
-
-
Method Detail
-
getScore
public double getScore(DataPoint dp)
Description copied from interface:BinaryScoreClassifierReturns the numeric score for predicting a class of a given data point, where the sign of the value indicates which class the data point is predicted to belong to.- Specified by:
getScorein interfaceBinaryScoreClassifier- Parameters:
dp- the data point to predict the class label of- Returns:
- the score for the given data point
-
clone
public RegressorToClassifier clone()
- Specified by:
clonein interfaceBinaryScoreClassifier- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
train
public void train(ClassificationDataSet dataSet)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train on
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
getParameters
public java.util.List<Parameter> getParameters()
Description copied from interface:ParameterizedReturns the list of parameters that can be altered for this learner.- Specified by:
getParametersin interfaceParameterized- Returns:
- the list of parameters that can be altered for this learner.
-
getParameter
public Parameter getParameter(java.lang.String paramName)
Description copied from interface:ParameterizedReturns the parameter with the given name. Two different strings may map to a single Parameter object. An ASCII only string, and a Unicode style string.- Specified by:
getParameterin interfaceParameterized- Parameters:
paramName- the name of the parameter to obtain- Returns:
- the Parameter in question, or null if no such named Parameter exists.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG