Skip to contents

Setup hyperparameters for monotonic Highly Adaptive Lasso training.

Usage

setup_MonotonicHAL(
  smoothness_orders = 1L,
  reduce_basis = NULL,
  num_knots = NULL,
  penalized = TRUE,
  use_min = TRUE,
  nfolds = 10L,
  seed = NULL,
  ifw = FALSE
)

Arguments

smoothness_orders

(Tunable) Integer [0, 1]: Smoothness of the basis functions: 0 fits zero-order indicators and yields a step function, 1 fits piecewise linear splines and yields a continuous one.

reduce_basis

(Tunable) Optional Numeric (0, 1]: Minimum proportion of cases a basis function must be non-zero in to be kept. Applies only when smoothness_orders is 0; a search that also covers higher orders drops it from those grid cells.

num_knots

Optional Integer [1, Inf): Number of knots spanning each feature. NULL generates them from smoothness_orders.

penalized

Logical: If TRUE, apply the lasso penalty to the basis functions; if FALSE, remove it.

use_min

Logical: If TRUE, select lambda.min from the internal cross-validation; if FALSE, the more heavily penalized lambda.1se.

nfolds

Integer [3, Inf): Largest number of folds of the internal cross-validation that selects lambda.

seed

Optional Integer: Random seed for the internal cross-validation's fold assignment. NULL leaves it drawn from the ambient RNG.

ifw

(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.

Value

MonotonicHALHyperparameters object.

Details

A Highly Adaptive Lasso restricted to additive, monotonic non-decreasing fits. hal9001::fit_hal is given a formula that constrains every basis function's coefficient to be non-negative, and the interaction degree is fixed at 1. Regression uses the gaussian family, binary classification the binomial one; hal9001 has no multinomial family, so multiclass classification is not supported.

The intended use is probability calibration, where the single feature is a classifier's score. Monotonicity is what makes that safe: a calibration map that reorders scores changes the ranking and so changes AUC, and a non-decreasing map cannot. Pass it to calibrate to use it instead of the default calibrator, setup_Isotonic.

Relative to Isotonic, which is the other monotonic calibrator, this fits on the logit scale, so it does not saturate at 0 and 1 the way the boundary bins of isotonic regression do – it can still round to an endpoint in double precision when the input scores are themselves extreme. At smoothness_orders = 1 it is strictly increasing rather than a step function, so it introduces no ties and leaves AUC unchanged.

smoothness_orders is the one substantive choice. 0 fits indicator basis functions and recovers a step function; 1 fits piecewise linear splines and yields a continuous map.

penalized = FALSE removes the lasso penalty, giving the non-parametric maximum likelihood estimate over the monotonic class. Combined with smoothness_orders = 0 that is isotonic regression, up to the logit-scale parameterization.

lambda is selected by cross-validation inside the fit and is not a search dimension. seed fixes that cross-validation's fold assignment; nfolds and use_min control it. Calibration sets are often small, so nfolds is an upper bound: training backs off to as many folds as the data supports at three cases each, and says so at verbosity >= 1.

get_varimp() reports the same two measures as setup_HAL, importance and max_coefficient. Both are of limited use at a single feature.

Author

EDG

Examples

monotonichal_hyperparams <- setup_MonotonicHAL(smoothness_orders = 0L)
monotonichal_hyperparams
#> <MonotonicHALHyperparameters>
#>         hyperparameters: 
#>                          smoothness_orders: <int> 0
#>                                  num_knots: <NUL> NULL
#>                               reduce_basis: <NUL> NULL
#>                                  penalized: <lgc> TRUE
#>                                  cv_select: <lgc> TRUE
#>                                    use_min: <lgc> TRUE
#>                                     nfolds: <int> 10
#>                                       seed: <NUL> NULL
#>                                        ifw: <lgc> FALSE
#> tunable_hyperparameters: <chr> smoothness_orders, reduce_basis, ifw
#>   fixed_hyperparameters: <chr> num_knots, penalized, use_min, nfolds, seed
#>                   tuned: <int> -1
#>               resampled: <int> 0
#>               n_workers: <int> 1
#> 
#>   No search values defined for tunable hyperparameters.