Predict using TabICL2
Usage
# S3 method for class 'tab_icl_v2'
predict(object, new_data, ...)
# S3 method for class 'tab_icl_v2.regressor'
predict(object, new_data, levels, train_dim, ...)
# S3 method for class 'tab_icl_v2.classifier'
predict(object, new_data, levels, train_dim, ...)
# S3 method for class 'tab_icl_v2'
augment(x, new_data, ...)Arguments
- object
A
tab_icl_v2object.- new_data
A data frame or matrix of new predictors.
- ...
Not used, but required for extensibility.
- levels
for regressor, the number of quantiles. For classifier, the number of levels in the outcome.
- train_dim
the number of rows of the training part within
new_data.- x
A
tab_icl_v2object.
Value
predict() returns a tibble of predictions and augment() appends the
columns in new_data. In either case, the number of rows in the tibble is
guaranteed to be the same as the number of rows in new_data.
For regression data, the prediction is in the column .pred. For
classification, the class predictions are in .pred_class and the
probability estimates are in columns with the pattern .pred_{level} where
level is the levels of the outcome factor vector.
Examples
car_split <- rsample::initial_split(mtcars)
if (FALSE) { # \dontrun{
# Fit
if (torch_is_installed() & interactive()) {
mod <- tab_icl2(mpg ~ cyl + log(drat), car_split)
# Predict
predict(mod, testing(car_split))
# Augment
augment(mod, testing(car_split))
}
} # }