jsat.classifiers.boosting
Class UpdatableStacking
- java.lang.Object
-
- jsat.classifiers.boosting.UpdatableStacking
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, UpdateableClassifier, Regressor, UpdateableRegressor
public class UpdatableStacking extends java.lang.Object implements UpdateableClassifier, UpdateableRegressor
This provides an implementation of the Stacking ensemble method meant for Updatable models. Stacking learns several base classifiers and a top level classifier learns to predict the target based on the outputs of all the ensambled models. Historically a linear model (such asLinearBatch) is used, which translates to learning a weighted vote of the classifier outputs. However any classifier may be used so long as it supports the desired target type.
Note, that Stacking tends to work best when the base classifiers produce reasonable probability estimates.
Stacking supportsweighted data instancesif the aggregating model does.
See: Wolpert, D. H. (1992). Stacked generalization. Neural Networks, 5, 241–259.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description UpdatableStacking(UpdatableStacking toCopy)Copy constructorUpdatableStacking(UpdateableClassifier aggregatingClassifier, java.util.List<UpdateableClassifier> baseClassifiers)Creates a new Stacking classifierUpdatableStacking(UpdateableClassifier aggregatingClassifier, UpdateableClassifier... baseClassifiers)Creates a new Stacking classifier.UpdatableStacking(UpdateableRegressor aggregatingRegressor, java.util.List<UpdateableRegressor> baseRegressors)Creates a new Stacking regressorUpdatableStacking(UpdateableRegressor aggregatingRegressor, UpdateableRegressor... baseRegressors)Creates a new Stacking 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.UpdatableStackingclone()doubleregress(DataPoint data)voidsetUp(CategoricalData[] categoricalAttributes, int numericAttributes)Prepares the classifier to begin learning from itsUpdateableRegressor.update(jsat.classifiers.DataPoint, double)method.voidsetUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)Prepares the classifier to begin learning from itsUpdateableClassifier.update(jsat.classifiers.DataPoint, int)method.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.voidtrain(RegressionDataSet dataSet)voidtrain(RegressionDataSet dataSet, boolean parallel)voidupdate(DataPoint dataPoint, double targetValue)Updates the classifier by giving it a new data point to learn from.voidupdate(DataPoint dataPoint, int targetClass)Updates the classifier by giving it a new data point to learn from.
-
-
-
Constructor Detail
-
UpdatableStacking
public UpdatableStacking(UpdateableClassifier aggregatingClassifier, java.util.List<UpdateableClassifier> baseClassifiers)
Creates a new Stacking classifier- Parameters:
aggregatingClassifier- the classifier used to merge the results of all the input classifiersbaseClassifiers- the list of base classifiers to ensemble
-
UpdatableStacking
public UpdatableStacking(UpdateableClassifier aggregatingClassifier, UpdateableClassifier... baseClassifiers)
Creates a new Stacking classifier.- Parameters:
aggregatingClassifier- the classifier used to merge the results of all the input classifiersbaseClassifiers- the array of base classifiers to ensemble
-
UpdatableStacking
public UpdatableStacking(UpdateableRegressor aggregatingRegressor, java.util.List<UpdateableRegressor> baseRegressors)
Creates a new Stacking regressor- Parameters:
aggregatingRegressor- the regressor used to merge the results of all the input classifiersbaseRegressors- the list of base regressors to ensemble
-
UpdatableStacking
public UpdatableStacking(UpdateableRegressor aggregatingRegressor, UpdateableRegressor... baseRegressors)
Creates a new Stacking regressor.- Parameters:
aggregatingRegressor- the regressor used to merge the results of all the input classifiersbaseRegressors- the array of base regressors to ensemble
-
UpdatableStacking
public UpdatableStacking(UpdatableStacking toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
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.
-
setUp
public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)
Description copied from interface:UpdateableClassifierPrepares the classifier to begin learning from itsUpdateableClassifier.update(jsat.classifiers.DataPoint, int)method.- Specified by:
setUpin interfaceUpdateableClassifier- Parameters:
categoricalAttributes- an array containing the categorical attributes that will be in each data pointnumericAttributes- the number of numeric attributes that will be in each data pointpredicting- the information for the target class that will be predicted
-
update
public void update(DataPoint dataPoint, int targetClass)
Description copied from interface:UpdateableClassifierUpdates the classifier by giving it a new data point to learn from.- Specified by:
updatein interfaceUpdateableClassifier- Parameters:
dataPoint- the data point to learntargetClass- the target class of the data point
-
setUp
public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes)
Description copied from interface:UpdateableRegressorPrepares the classifier to begin learning from itsUpdateableRegressor.update(jsat.classifiers.DataPoint, double)method.- Specified by:
setUpin interfaceUpdateableRegressor- Parameters:
categoricalAttributes- an array containing the categorical attributes that will be in each data pointnumericAttributes- the number of numeric attributes that will be in each data point
-
update
public void update(DataPoint dataPoint, double targetValue)
Description copied from interface:UpdateableRegressorUpdates the classifier by giving it a new data point to learn from.- Specified by:
updatein interfaceUpdateableRegressor- Parameters:
dataPoint- the data point to learntargetValue- the target value of the data point
-
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- Specified by:
supportsWeightedDatain interfaceRegressor- Returns:
- true if the model supports weighted data, false otherwise
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
train
public void train(RegressionDataSet dataSet)
-
clone
public UpdatableStacking clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceUpdateableClassifier- Specified by:
clonein interfaceRegressor- Specified by:
clonein interfaceUpdateableRegressor- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG