Skip to content

Fits a gradient boosting regression or classification on a 'tidyFit' R6 class. The function can be used with regress and classify.

Usage

.model.boost(self, data = NULL)

Arguments

self

a 'tidyFit' R6 class.

data

a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

Value

A fitted 'tidyFit' class model.

A 'tibble'.

Details

Hyperparameters:

  • mstop (number of boosting iterations)

  • nu (step size)

Important method arguments (passed to m)

The gradient boosting regression is performed using mboost::glmboost. See ?glmboost for more details.

Implementation

Features are standardized by default with coefficients transformed to the original scale.

If no hyperparameter grid is passed (is.null(control$mstop) and is.null(control$nu)), the default grid is used with mstop = c(100, 500, 1000, 5000) and nu = c(0.01, 0.05, 0.1, 0.15, 0.2, 0.25).

References

T. Hothorn, P. Buehlmann, T. Kneib, M. Schmid, and B. Hofner (2022). mboost: Model-Based Boosting, R package version 2.9-7,https://CRAN.R-project.org/package=mboost.

See also

m method

Author

Johann Pfitzinger

Examples

# Load data
data <- tidyfit::Factor_Industry_Returns

# Stand-alone function
fit <- m("boost", Return ~ ., data, nu = 0.1, mstop = 100)
fit
#> # A tibble: 1 × 5
#>   estimator_fct    `size (MB)` grid_id  model_object settings        
#>   <chr>                  <dbl> <chr>    <list>       <list>          
#> 1 mboost::glmboost        5.05 #0010000 <tidyFit>    <tibble [1 × 3]>

# Within 'regress' function
fit <- regress(data, Return ~ ., m("boost", nu = c(0.1, 0.05), mstop = 100),
               .mask = c("Date", "Industry"))
coef(fit)
#> # A tibble: 14 × 5
#> # Groups:   model [1]
#>    model term        estimate grid_id  model_info      
#>    <chr> <chr>          <dbl> <chr>    <list>          
#>  1 boost (Intercept)   0.124  #0010000 <tibble [1 × 0]>
#>  2 boost Mkt-RF        0.949  #0010000 <tibble [1 × 0]>
#>  3 boost SMB           0      #0010000 <tibble [1 × 0]>
#>  4 boost HML           0.0617 #0010000 <tibble [1 × 0]>
#>  5 boost RMW           0.112  #0010000 <tibble [1 × 0]>
#>  6 boost CMA           0.0567 #0010000 <tibble [1 × 0]>
#>  7 boost RF            0.715  #0010000 <tibble [1 × 0]>
#>  8 boost (Intercept)   0.319  #0020000 <tibble [1 × 0]>
#>  9 boost Mkt-RF        0.906  #0020000 <tibble [1 × 0]>
#> 10 boost SMB           0      #0020000 <tibble [1 × 0]>
#> 11 boost HML           0.0463 #0020000 <tibble [1 × 0]>
#> 12 boost RMW           0.0528 #0020000 <tibble [1 × 0]>
#> 13 boost CMA           0      #0020000 <tibble [1 × 0]>
#> 14 boost RF            0.347  #0020000 <tibble [1 × 0]>