View source: R/kerasnip_spec_methods.R
| predict.kerasnip_model_fit | R Documentation |
S3 method for predict() dispatched on kerasnip_model_fit objects.
Before delegating to the standard parsnip predict machinery, it checks
whether the underlying model type is registered in the current parsnip
session. If not (e.g. after loading a saved workflow in a new R session),
it transparently replays the full parsnip registration using metadata stored
on the spec object — requiring no manual step from the user.
## S3 method for class 'kerasnip_model_fit'
predict(object, new_data, ...)
object |
A |
new_data |
A data frame of predictors. |
... |
Passed to the parsnip predict method. |
The metadata needed for re-registration (kerasnip_layer_blocks,
kerasnip_functional) is embedded on the spec object by the spec
constructor function at call time. This means it is preserved across
saveRDS()/readRDS() and bundle()/unbundle() round-trips.
For full model weight portability (i.e. to be able to predict() on new
data in a new R session), use bundle::bundle() before saving. Plain
saveRDS() preserves the spec structure and will auto-register, but the
underlying Keras model weights are not portable without bundling.
A tibble of predictions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.