jsat.classifiers.boosting
Class AdaBoostM1
- java.lang.Object
-
- jsat.classifiers.boosting.AdaBoostM1
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
public class AdaBoostM1 extends java.lang.Object implements Classifier, Parameterized
Implementation of Experiments with a New Boosting Algorithm, by Yoav Freund&Robert E. Schapire.
This is the first AdaBoost algorithm presented in the paper, and the first boosting algorithm. Though not often mentioned, AdaBoost does support non binary classification tasks. However, for any k labels, the weak learner's error still needs to be better then 1/2, which is not an easy requirement to satisfy. For this reason, many use AdaBoostM1 by reducing k class classification problems to several 2 class problems.
Many Boosting methods, when given a binary classification task, reduce to having the same results as this class.
AdaBoost is often combined withOneVSAllto obtain better classification accuracy.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AdaBoostM1(AdaBoostM1 toCopy)AdaBoostM1(Classifier weakLearner, int maxIterations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.AdaBoostM1clone()intgetMaxIterations()Returns the maximum number of iterations usedjava.util.List<Classifier>getModels()java.util.List<java.lang.Double>getModelWeights()ClassifiergetWeakLearner()Returns the weak learner currently being used by this method.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.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
AdaBoostM1
public AdaBoostM1(Classifier weakLearner, int maxIterations)
-
AdaBoostM1
public AdaBoostM1(AdaBoostM1 toCopy)
-
-
Method Detail
-
getMaxIterations
public int getMaxIterations()
Returns the maximum number of iterations used- Returns:
- the maximum number of iterations used
-
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.
-
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
-
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 AdaBoostM1 clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG