set_engine.kerasnip_spec: set_engine Method for kerasnip Spec Objects

View source: R/kerasnip_spec_methods.R

set_engine.kerasnip_specR Documentation

set_engine Method for kerasnip Spec Objects

Description

S3 method for set_engine() dispatched on kerasnip_spec objects. parsnip::set_engine.model_spec() internally calls new_model_spec(), which re-creates the spec from scratch with only c(cls, "model_spec") as the class vector — stripping kerasnip_spec and any custom attributes. This wrapper preserves the kerasnip_layer_blocks and kerasnip_functional metadata attributes and re-attaches them (along with the kerasnip_spec class) after NextMethod() has done its work.

Usage

## S3 method for class 'kerasnip_spec'
set_engine(object, engine, ...)

Arguments

object

A kerasnip_spec model specification.

engine

A character string naming the engine (e.g., "keras").

...

Additional engine-specific arguments passed to parsnip::set_engine.model_spec().

Value

A model_spec object with the kerasnip_spec class and metadata attributes re-attached.


kerasnip documentation built on Sept. 4, 2026, 1:06 a.m.