public abstract class BinaryCalibration extends Object implements Classifier, Parameterized
BinaryCalibration.CalibrationMode
may be set to an
alternative method.
Modifier and Type | Class and Description |
---|---|
static class |
BinaryCalibration.CalibrationMode
Controls how the scores are obtained for producing a "training set" to
calibrate the output of the underlying model.
|
Modifier and Type | Field and Description |
---|---|
protected BinaryScoreClassifier |
base
The base classifier to train and calibrate the outputs of
|
protected int |
folds
The number of CV folds
|
protected double |
holdOut
The proportion of the data set to hold out for calibration
|
protected BinaryCalibration.CalibrationMode |
mode
The calibration mode to use
|
Constructor and Description |
---|
BinaryCalibration(BinaryScoreClassifier base,
BinaryCalibration.CalibrationMode mode)
Creates a new Binary Calibration object
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
calibrate(boolean[] label,
double[] scores,
int len)
This method perform the model calibration on the outputs verse the class
labels.
|
abstract BinaryCalibration |
clone() |
int |
getCalibrationFolds()
Returns the number of cross validation folds to use
|
double |
getCalibrationHoldOut()
Returns the portion of the data set that will be held out for calibration
|
BinaryCalibration.CalibrationMode |
getCalibrationMode()
Returns the calibration mode used during training
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
void |
setCalibrationFolds(int folds)
If the calibration mode is set to
BinaryCalibration.CalibrationMode.CV , this
controls how many folds of cross validation will be used. |
void |
setCalibrationHoldOut(double holdOut)
If the calibration mode is set to
BinaryCalibration.CalibrationMode.HOLD_OUT , this
what portion of the data set is randomly selected to be the hold out set. |
void |
setCalibrationMode(BinaryCalibration.CalibrationMode mode)
Sets which calibration mode will be used during training
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
classify, supportsWeightedData
protected BinaryScoreClassifier base
protected int folds
protected double holdOut
protected BinaryCalibration.CalibrationMode mode
public BinaryCalibration(BinaryScoreClassifier base, BinaryCalibration.CalibrationMode mode)
base
- the base learning algorithmmode
- the calibration mode to usepublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onprotected abstract void calibrate(boolean[] label, double[] scores, int len)
label
- the set of labels, where true
indicates the positive
class label, and false
indicates the negative class label.scores
- the score associated with each label from the learning
algorithm.len
- the number of values (from zero) of the label and scores array
to use. This value may be less than the actual array sizepublic void setCalibrationFolds(int folds)
BinaryCalibration.CalibrationMode.CV
, this
controls how many folds of cross validation will be used. The default is
3.folds
- the number of cross validation folds to performpublic int getCalibrationFolds()
public void setCalibrationHoldOut(double holdOut)
BinaryCalibration.CalibrationMode.HOLD_OUT
, this
what portion of the data set is randomly selected to be the hold out set.
The default is 0.3.holdOut
- the portion in (0, 1) to hold outpublic double getCalibrationHoldOut()
public void setCalibrationMode(BinaryCalibration.CalibrationMode mode)
mode
- the calibration mode to use during training.public BinaryCalibration.CalibrationMode getCalibrationMode()
public abstract BinaryCalibration clone()
clone
in interface Classifier
clone
in class Object
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainCopyright © 2017. All rights reserved.