Learn R Programming

rtemis (version 1.4.3)

setup_MonotonicHAL: Setup MonotonicHAL Hyperparameters

Description

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
)

Value

MonotonicHALHyperparameters object.

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.

Author

EDG

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. A non-decreasing calibration map preserves the ranking of scores, and so AUC. 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 as the boundary bins of isotonic regression do; it can round to an endpoint in double precision when the input scores are 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 0 fits indicator basis functions and yields 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. nfolds is an upper bound: training uses at most as many folds as the data supports at three cases each, and reports the number at verbosity >= 1.

get_varimp() reports the same two measures as setup_HAL, importance and max_coefficient.

Examples

Run this code
monotonichal_hyperparams <- setup_MonotonicHAL(smoothness_orders = 0L)
monotonichal_hyperparams

Run the code above in your browser using DataLab