predict.hal9001: Prediction from HAL fits

View source: R/predict.R

predict.hal9001R Documentation

Prediction from HAL fits

Description

Prediction from HAL fits

Usage

## S3 method for class 'hal9001'
predict(
  object,
  new_data,
  new_X_unpenalized = NULL,
  offset = NULL,
  type = c("response", "link"),
  ...
)

Arguments

object

An object of class hal9001, containing the results of fitting the Highly Adaptive Lasso, as produced by fit_hal.

new_data

A matrix or data.frame containing new data (i.e., observations not used for fitting the hal9001 object that's passed in via the object argument) for which the hal9001 object will compute predicted values.

new_X_unpenalized

If the user supplied X_unpenalized during training, then user should also supply this matrix with the same number of observations as new_data.

offset

A vector of offsets. Must be provided if provided at training.

type

Either "response" for predictions of the response, or "link" for un-transformed predictions (on the scale of the link function).

...

Additional arguments passed to predict as necessary.

Details

Method for computing and extracting predictions from fits of the Highly Adaptive Lasso estimator, returned as a single S3 objects of class hal9001.

Value

A numeric vector of predictions from a hal9001 object.

Note

This prediction method does not function similarly to the equivalent method from glmnet. In particular, this procedure will not return a subset of lambdas originally specified in calling fit_hal nor result in re-fitting. Instead, it will return predictions for all of the lambdas specified in the call to fit_hal that constructs object, when fit_control's cv_select is set to FALSE. When fit_control's cv_select is set to TRUE, predictions will only be returned for the value of lambda selected by cross-validation.


hal9001 documentation built on Nov. 14, 2023, 5:08 p.m.