jsat.classifiers.boosting
Class Wagging
- java.lang.Object
-
- jsat.classifiers.boosting.Wagging
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized, Regressor
- Direct Known Subclasses:
- WaggingNormal
public class Wagging extends java.lang.Object implements Classifier, Regressor, Parameterized
Wagging is a meta-classifier that is related toBagging. Instead training on re-sampled data sets, it trains on randomly re-weighted data sets. The weight of each point is selected at random from a specified distribution, and set to zero if negative.
See: Bauer, E.,&Kohavi, R. (1999). An empirical comparison of voting classification algorithms: Bagging, boosting, and variants. Machine learning, 38(1998), 1–38.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Wagging(ContinuousDistribution dist, Classifier weakL, int iterations)Creates a new Wagging classifierWagging(ContinuousDistribution dist, Regressor weakR, int iterations)Creates a new Wagging 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.Waggingclone()ContinuousDistributiongetDistribution()Returns the distribution used for weight samplingintgetIterations()Returns the number of iterations to create weak learnersClassifiergetWeakClassifier()Returns the weak learner used for classification.RegressorgetWeakRegressor()Returns the weak learner used for regressiondoubleregress(DataPoint data)voidsetDistribution(ContinuousDistribution dist)Sets the distribution to select the random weights fromvoidsetIterations(int iterations)Sets the number of iterations to create weak learnersvoidsetWeakLearner(Classifier weakL)Sets the weak learner used for classification.voidsetWeakLearner(Regressor weakR)Sets the weak learner used for regressions .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.voidtrain(RegressionDataSet dataSet, boolean parallel)-
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
-
Wagging
public Wagging(ContinuousDistribution dist, Classifier weakL, int iterations)
Creates a new Wagging classifier- Parameters:
dist- the distribution to select weights fromweakL- the weak learner to useiterations- the number of iterations to perform
-
Wagging
public Wagging(ContinuousDistribution dist, Regressor weakR, int iterations)
Creates a new Wagging regressor- Parameters:
dist- the distribution to select weights fromweakR- the weak learner to useiterations- the number of iterations to perform
-
-
Method Detail
-
setWeakLearner
public void setWeakLearner(Classifier weakL)
Sets the weak learner used for classification. If it also supports regressions that will be set as well.- Parameters:
weakL- the weak learner to use
-
getWeakClassifier
public Classifier getWeakClassifier()
Returns the weak learner used for classification.- Returns:
- the weak learner used for classification.
-
setWeakLearner
public void setWeakLearner(Regressor weakR)
Sets the weak learner used for regressions . If it also supports classification that will be set as well.- Parameters:
weakR- the weak learner to use
-
getWeakRegressor
public Regressor getWeakRegressor()
Returns the weak learner used for regression- Returns:
- the weak learner used for regression
-
setIterations
public void setIterations(int iterations)
Sets the number of iterations to create weak learners- Parameters:
iterations- the number of iterations to perform
-
getIterations
public int getIterations()
Returns the number of iterations to create weak learners- Returns:
- the number of iterations to perform
-
setDistribution
public void setDistribution(ContinuousDistribution dist)
Sets the distribution to select the random weights from- Parameters:
dist- the distribution to use
-
getDistribution
public ContinuousDistribution getDistribution()
Returns the distribution used for weight sampling- Returns:
- the distribution used
-
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- Specified by:
supportsWeightedDatain interfaceRegressor- Returns:
- true if the model supports weighted data, false otherwise
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
clone
public Wagging clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceRegressor- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG