public class AdaBoost extends java.lang.Object implements IClassifier, java.io.Serializable
AdaBoost calls a weak classifier repeatedly in a series of rounds from total T classifiers. For each call a distribution of weights is updated that indicates the importance of examples in the data set for the classification. On each round, the weights of each incorrectly classified example are increased (or alternatively, the weights of each correctly classified example are decreased), so that the new classifier focuses more on those examples.
The basic AdaBoost algorithm is only for binary classification problem. For multi-class classification, a common approach is reducing the multi-class classification problem to multiple two-class problems. This implementation is a multi-class AdaBoost without such reductions.
| Constructor and Description |
|---|
AdaBoost() |
AdaBoost(DecisionVariable[] attributes)
Initializes a new instance of the AdaBoost class.
|
AdaBoost(DecisionVariable[] attributes,
int T)
Initializes a new instance of the AdaBoost class.
|
AdaBoost(DecisionVariable[] attributes,
int T,
int J)
Initializes a new instance of the AdaBoost class.
|
AdaBoost(int T)
Initializes a new instance of the AdaBoost class.
|
AdaBoost(int T,
int J)
Initializes a new instance of the AdaBoost class.
|
| Modifier and Type | Method and Description |
|---|---|
IClassifier |
clone()
Clone of the object.
|
double[] |
getImportance()
Returns the variable importance.
|
int |
getNumberOfLeafs()
Get the number of maximum leafs.
|
int |
getNumberOfTrees()
Get number of trees.
|
void |
Learn(DatasetClassification dataset)
Learn from a dataset.
|
void |
Learn(double[][] input,
int[] output)
Learn.
|
int |
Predict(double[] feature)
Predict.
|
void |
setNumberOfLeafs(int J)
Set the number of maximum leafs.
|
void |
setNumberOfTrees(int T)
Set number of the trees.
|
int |
size()
Returns the number of trees in the model.
|
void |
trim(int T)
Trims the tree model set to a smaller size in case of over-fitting.
|
public AdaBoost()
public AdaBoost(int T)
T - the number of trees.public AdaBoost(int T,
int J)
T - the number of trees.J - the maximum number of leaf nodes in the trees.public AdaBoost(DecisionVariable[] attributes)
attributes - the attribute properties.public AdaBoost(DecisionVariable[] attributes, int T)
attributes - the attribute properties.T - the number of trees.public AdaBoost(DecisionVariable[] attributes, int T, int J)
attributes - the attribute properties.T - the number of trees.J - the maximum number of leaf nodes in the trees.public double[] getImportance()
public int size()
public int getNumberOfTrees()
public void setNumberOfTrees(int T)
T - Number of trees.public int getNumberOfLeafs()
public void setNumberOfLeafs(int J)
J - Number of maximum leafs.public void Learn(DatasetClassification dataset)
IClassifierLearn in interface IClassifierdataset - Dataset.public void Learn(double[][] input,
int[] output)
IClassifierLearn in interface IClassifierinput - Matrix of features.output - Labels.public int Predict(double[] feature)
IClassifierPredict in interface IClassifierfeature - Feature.public void trim(int T)
T - the new (smaller) size of tree model set.public IClassifier clone()
IClassifierclone in interface IClassifierclone in class java.lang.Object