jsat.classifiers.boosting
Class EmphasisBoost
- java.lang.Object
-
- jsat.classifiers.boosting.EmphasisBoost
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, BinaryScoreClassifier, Classifier, Parameterized
public class EmphasisBoost extends java.lang.Object implements Classifier, Parameterized, BinaryScoreClassifier
Emphasis Boost is a generalization of the Real AdaBoost algorithm, expanding the update term and providing theλterm to control the trade off. With λ = 1/2, it becomes equivalent to Real AdaBoost. If the weak learner does not support confidence outputs (non-hard decisions), then it further becomes equivalent to Discrete Ada Boost.
Emphasis Boost only supports binary classification problems, the learner used should support weighted predictions.
NOTE: In the face of extreme outliers, it is possible for numerical instability to occur. This implementation attempts to reset weights when numerical issues occur.
See:
Gómez-Verdejo, V., Ortega-Moral, M., Arenas-García, J.,&Figueiras-Vidal, A. R. (2006). Boosting by weighting critical and erroneous samples. Neurocomputing, 69(7-9), 679–685. doi:10.1016/j.neucom.2005.12.011- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description EmphasisBoost()Creates a new EmphasisBooster with shallow decision trees and λ = 0.35EmphasisBoost(Classifier weakLearner, int maxIterations, double lambda)Creates a new EmphasisBoost learner
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.EmphasisBoostclone()doublegetLambda()Returns the value of the λ trade off parameterintgetMaxIterations()Returns the maximum number of iterations usedjava.util.List<Classifier>getModels()java.util.List<java.lang.Double>getModelWeights()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.ClassifiergetWeakLearner()Returns the weak learner currently being used by this method.static DistributionguessLambda(DataSet d)Guesses the distribution to use for the λ parametervoidsetLambda(double lambda)λ controls the trade off between weighting the errors based on their distance to the margin and the quadratic error of the output.voidsetMaxIterations(int maxIterations)Sets the maximal number of boosting iterations that may be performedvoidsetWeakLearner(Classifier weakLearner)Sets the weak learner used during training.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(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.parameters.Parameterized
getParameter, getParameters
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
-
-
-
Constructor Detail
-
EmphasisBoost
public EmphasisBoost()
Creates a new EmphasisBooster with shallow decision trees and λ = 0.35
-
EmphasisBoost
public EmphasisBoost(Classifier weakLearner, int maxIterations, double lambda)
Creates a new EmphasisBoost learner- Parameters:
weakLearner- the weak learner to usemaxIterations- the maximum number of boosting iterationslambda- the trade off parameter in [0, 1]
-
-
Method Detail
-
getModels
public java.util.List<Classifier> getModels()
- Returns:
- a list of the models that are in this ensemble.
-
getModelWeights
public java.util.List<java.lang.Double> getModelWeights()
- Returns:
- a list of the models weights that are in this ensemble.
-
getMaxIterations
public int getMaxIterations()
Returns the maximum number of iterations used- Returns:
- the maximum number of iterations used
-
setMaxIterations
public void setMaxIterations(int maxIterations)
Sets the maximal number of boosting iterations that may be performed- Parameters:
maxIterations- the maximum number of iterations
-
getWeakLearner
public Classifier getWeakLearner()
Returns the weak learner currently being used by this method.- Returns:
- the weak learner currently being used by this method.
-
setWeakLearner
public void setWeakLearner(Classifier weakLearner)
Sets the weak learner used during training.- Parameters:
weakLearner- the weak learner to use
-
guessLambda
public static Distribution guessLambda(DataSet d)
Guesses the distribution to use for the λ parameter- Parameters:
d- the dataset to get the guess for- Returns:
- the guess for the λ parameter
- See Also:
setLambda(double)
-
setLambda
public void setLambda(double lambda)
λ controls the trade off between weighting the errors based on their distance to the margin and the quadratic error of the output. The three extreme values are:
- λ = 0 , in this case all the weight is placed on points based on their distance to the margin of the classification boundary.
- λ = 1/2, in this case weight is balanced between the margin distance and the quadratic error. This is equivalent to Real Ada Boost
- λ = 1, in this case the weight is placed purely based on the quadratic error of the output
According to the original paper, values in the range [0.3, 0.4] often perform well.- Parameters:
lambda- the trade off parameter in [0, 1]
-
getLambda
public double getLambda()
Returns the value of the λ trade off parameter- Returns:
- the value of the λ trade off parameter
-
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
-
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.
-
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
-
clone
public EmphasisBoost clone()
- Specified by:
clonein interfaceBinaryScoreClassifier- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG