public class Stacking extends Object implements Classifier, Regressor
LinearBatch
) 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. weighted data instances
if
the aggregating model does.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FOLDS |
Constructor and Description |
---|
Stacking(Classifier aggregatingClassifier,
Classifier... baseClassifiers)
Creates a new Stacking classifier that uses 3 folds of cross validation
|
Stacking(Classifier aggregatingClassifier,
List<Classifier> baseClassifiers)
Creates a new Stacking classifier that uses 3 folds of cross validation
|
Stacking(int folds,
Classifier aggregatingClassifier,
Classifier... baseClassifiers)
Creates a new Stacking classifier
|
Stacking(int folds,
Classifier aggregatingClassifier,
List<Classifier> baseClassifiers)
Creates a new Stacking classifier
|
Stacking(int folds,
Regressor aggregatingRegressor,
List<Regressor> baseRegressors)
Creates a new Stacking regressor
|
Stacking(int folds,
Regressor aggregatingRegressor,
Regressor... baseRegressors)
Creates a new Stacking regressor
|
Stacking(Regressor aggregatingRegressor,
List<Regressor> baseRegressors)
Creates a new Stacking regressor that uses 3 folds of cross validation
|
Stacking(Regressor aggregatingRegressor,
Regressor... baseRegressors)
Creates a new Stacking regressor that uses 3 folds of cross validation
|
Stacking(Stacking toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
Stacking |
clone() |
int |
getFolds() |
double |
regress(DataPoint data) |
void |
setFolds(int folds)
Sets the number of folds of cross validation to use when creating the new
set of weights that will be feed into the aggregating model.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
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.
|
public static final int DEFAULT_FOLDS
public Stacking(int folds, Classifier aggregatingClassifier, List<Classifier> baseClassifiers)
folds
- the number of cross validation folds for learning the base modelaggregatingClassifier
- the classifier used to merge the results of all the input classifiersbaseClassifiers
- the list of base classifiers to ensemblepublic Stacking(int folds, Classifier aggregatingClassifier, Classifier... baseClassifiers)
folds
- the number of cross validation folds for learning the base modelaggregatingClassifier
- the classifier used to merge the results of all the input classifiersbaseClassifiers
- the array of base classifiers to ensemblepublic Stacking(Classifier aggregatingClassifier, List<Classifier> baseClassifiers)
aggregatingClassifier
- the classifier used to merge the results of all the input classifiersbaseClassifiers
- the list of base classifiers to ensemblepublic Stacking(Classifier aggregatingClassifier, Classifier... baseClassifiers)
aggregatingClassifier
- the classifier used to merge the results of all the input classifiersbaseClassifiers
- the array of base classifiers to ensemblepublic Stacking(int folds, Regressor aggregatingRegressor, List<Regressor> baseRegressors)
folds
- the number of cross validation folds for learning the base modelaggregatingRegressor
- the regressor used to merge the results of all the input classifiersbaseRegressors
- the list of base regressors to ensemblepublic Stacking(int folds, Regressor aggregatingRegressor, Regressor... baseRegressors)
folds
- the number of cross validation folds for learning the base modelaggregatingRegressor
- the regressor used to merge the results of all the input classifiersbaseRegressors
- the array of base regressors to ensemblepublic Stacking(Regressor aggregatingRegressor, List<Regressor> baseRegressors)
aggregatingRegressor
- the regressor used to merge the results of all the input classifiersbaseRegressors
- the list of base regressors to ensemblepublic Stacking(Regressor aggregatingRegressor, Regressor... baseRegressors)
aggregatingRegressor
- the regressor used to merge the results of all the input classifiersbaseRegressors
- the array of base regressors to ensemblepublic Stacking(Stacking toCopy)
toCopy
- the object to copypublic void setFolds(int folds)
folds
- the number of cross validation folds to usepublic int getFolds()
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic 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 onpublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
supportsWeightedData
in interface Regressor
public void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
Copyright © 2017. All rights reserved.