augment.ggmlr_parsnip_model: Augment new data with predictions from a fitted ggml parsnip...

View source: R/parsnip_broom.R

augment.ggmlr_parsnip_modelR Documentation

Augment new data with predictions from a fitted ggml parsnip model

Description

Adds prediction columns to 'new_data', broom style. For classification this appends '.pred_class' plus one '.pred_<level>' probability column per class; for regression it appends '.pred'. Predictions are produced by the existing 'predict()' method for ggml parsnip models (no duplicate inference logic).

Usage

## S3 method for class 'ggmlr_parsnip_model'
augment(x, new_data, ...)

Arguments

x

A fitted 'ggmlr_parsnip_model' (the engine object inside a parsnip fit; e.g. from 'extract_fit_engine()').

new_data

A data frame of predictors (same columns used for fitting).

...

Unused; for generic compatibility.

Value

'new_data' as a tibble with prediction columns appended.

Examples


ggml_set_n_threads(1L)  # deterministic, single OpenMP pool
spec <- parsnip::mlp(hidden_units = 8L, epochs = 3L) |>
  parsnip::set_engine("ggml", backend = "cpu") |>
  parsnip::set_mode("regression")
fit_obj <- parsnip::fit(spec, mpg ~ ., data = mtcars)
generics::augment(parsnip::extract_fit_engine(fit_obj), mtcars)


ggmlR documentation built on July 14, 2026, 1:08 a.m.