
AdaBoost sample-weight update (Geron Ch 6, morie.fn gradaw)
Source:R/geron_ml_native.R
morie_geron_adaboost_weight_update.Rdw <- w exp(alpha 1{misclassified}), then renormalise. The weighted
error BEFORE the update is reported so alpha can be checked against
log((1-r)/r).
Examples
morie_geron_adaboost_weight_update(c(0, 0, 1, 1), c(0, 1, 1,
1), rep(0.25, 4), log(3))
#> $weights_new
#> [1] 0.1666667 0.5000000 0.1666667 0.1666667
#>
#> $misclassified
#> [1] FALSE TRUE FALSE FALSE
#>
#> $weighted_error
#> [1] 0.25
#>
#> $boost_factor
#> [1] 3
#>
#> $alpha_t
#> [1] 1.098612
#>
#> $estimate
#> [1] 0.25
#>
#> $n
#> [1] 4
#>
#> $method
#> [1] "AdaBoost sample-weight update"
#>