AdaBoost
Discrete AdaBoost over single-feature boolean decision stumps. Each round picks the stump (feature + polarity) with the lowest weighted error, gives it a vote of alpha = 0.5*ln((1-err)/err) and re-weights the samples to focus on mistakes; prediction is the sign of the weighted stump vote. Deterministic. Boosting stops early when no stump beats chance.
Example
# label (last column) = majority of three boolean features
booster := AdaBoost->New(16);
booster->Fit(data);
preds := booster->Predict(data);Operations
Fit #
Fits the boosted ensemble. Each row is boolean features with the class label in the LAST column.
method : public : Fit(input:Bool[,]) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| input | Bool | training matrix (features..., label) of Bool |
Return
| Type | Description |
|---|---|
| Bool | true if fitting succeeded |
GetLearnerCount #
Gets the number of boosting rounds actually used (early-stops when no stump beats chance or a stump is perfect).
method : public : GetLearnerCount() ~ IntReturn
| Type | Description |
|---|---|
| Int | learner count |
IsFitted #
Whether the ensemble has been fitted.
method : public : IsFitted() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if fitted |
Load # function
Loads a fitted ensemble from a file.
function : Load(filename:String) ~ AdaBoostParameters
| Name | Type | Description |
|---|---|---|
| filename | String | file to load from |
Return
| Type | Description |
|---|---|
| AdaBoost | fitted ensemble, or Nil on failure |
New # constructor
Constructor
New(num_learners:Int)Parameters
| Name | Type | Description |
|---|---|---|
| num_learners | Int | maximum number of boosting rounds |
Predict #
Predicts class labels by the sign of the weighted stump vote.
method : public : Predict(input:Bool[,]) ~ Bool[]Parameters
| Name | Type | Description |
|---|---|---|
| input | Bool | matrix of feature rows (a trailing label column is ignored) |
Return
| Type | Description |
|---|---|
| Bool | per-row predicted classes, or Nil if not fitted |
Score #
Computes classification accuracy on labeled data, comparing predictions against the class label in the LAST column.
method : public : Score(input:Bool[,]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| input | Bool | labeled matrix (features..., label) of Bool |
Return
| Type | Description |
|---|---|
| Float | fraction of correctly classified rows, or 0.0 if not fitted |