jsat.classifiers.calibration
Class BinaryCalibration
- java.lang.Object
-
- jsat.classifiers.calibration.BinaryCalibration
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
- Direct Known Subclasses:
- IsotonicCalibration, PlattCalibration
public abstract class BinaryCalibration extends java.lang.Object implements Classifier, Parameterized
This abstract class provides the frame work for an algorithm to perform probability calibration based on the outputs of a base learning algorithm for binary classification problems.
Calibration can be performed directly on output values, though it may cause over-fitting. For this reason, theBinaryCalibration.CalibrationModemay be set to an alternative method.
The parameters include the calibration parameters, and any parameters that would be returned by the base model.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classBinaryCalibration.CalibrationModeControls how the scores are obtained for producing a "training set" to calibrate the output of the underlying model.
-
Constructor Summary
Constructors Constructor and Description BinaryCalibration(BinaryScoreClassifier base, BinaryCalibration.CalibrationMode mode)Creates a new Binary Calibration object
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract BinaryCalibrationclone()intgetCalibrationFolds()Returns the number of cross validation folds to usedoublegetCalibrationHoldOut()Returns the portion of the data set that will be held out for calibrationBinaryCalibration.CalibrationModegetCalibrationMode()Returns the calibration mode used during trainingvoidsetCalibrationFolds(int folds)If the calibration mode is set toBinaryCalibration.CalibrationMode.CV, this controls how many folds of cross validation will be used.voidsetCalibrationHoldOut(double holdOut)If the calibration mode is set toBinaryCalibration.CalibrationMode.HOLD_OUT, this what portion of the data set is randomly selected to be the hold out set.voidsetCalibrationMode(BinaryCalibration.CalibrationMode mode)Sets which calibration mode will be used during trainingvoidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
classify, supportsWeightedData, train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
BinaryCalibration
public BinaryCalibration(BinaryScoreClassifier base, BinaryCalibration.CalibrationMode mode)
Creates a new Binary Calibration object- Parameters:
base- the base learning algorithmmode- the calibration mode to use
-
-
Method Detail
-
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.
-
setCalibrationFolds
public void setCalibrationFolds(int folds)
If the calibration mode is set toBinaryCalibration.CalibrationMode.CV, this controls how many folds of cross validation will be used. The default is 3.- Parameters:
folds- the number of cross validation folds to perform
-
getCalibrationFolds
public int getCalibrationFolds()
Returns the number of cross validation folds to use- Returns:
- the number of cross validation folds to use
-
setCalibrationHoldOut
public void setCalibrationHoldOut(double holdOut)
If the calibration mode is set toBinaryCalibration.CalibrationMode.HOLD_OUT, this what portion of the data set is randomly selected to be the hold out set. The default is 0.3.- Parameters:
holdOut- the portion in (0, 1) to hold out
-
getCalibrationHoldOut
public double getCalibrationHoldOut()
Returns the portion of the data set that will be held out for calibration- Returns:
- the portion of the data set that will be held out for calibration
-
setCalibrationMode
public void setCalibrationMode(BinaryCalibration.CalibrationMode mode)
Sets which calibration mode will be used during training- Parameters:
mode- the calibration mode to use during training.
-
getCalibrationMode
public BinaryCalibration.CalibrationMode getCalibrationMode()
Returns the calibration mode used during training- Returns:
- the calibration mode used during training
-
clone
public abstract BinaryCalibration clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG