| ml_make_seq_model | R Documentation |
Returns fit/predict closures for sequence models that consume flattened
tabular inputs (n \times (steps \times p)) and internally reshape to (n, steps, p).
If Keras/TensorFlow is unavailable, falls back to a linear baseline so
examples remain runnable on CPU-only machines.
ml_make_seq_model(
type = c("linear", "gru", "lstm", "cnn1d"),
steps = 26L,
units = 16L,
dense = NULL,
dropout = 0.1,
epochs = 12L,
batch_size = 128L,
lr = 0.01,
patience = 2L,
seed = 123L,
deterministic = TRUE,
pred_batch_size = 256L
)
type |
One of |
steps |
Integer sequence length (e.g., 26 for 6 months of weeks). |
units |
Hidden units for GRU/LSTM or filters for CNN1D. |
dense |
Optional integer vector of additional dense layers. |
dropout |
Dropout rate for recurrent/CNN core. |
epochs, batch_size |
Training settings. |
lr |
Learning rate. |
patience |
Early-stopping patience. |
seed |
Integer seed. |
deterministic |
Logical; set determinism knobs when TRUE. |
pred_batch_size |
Fixed batch size used at prediction time. |
Determinism knobs: fixed seeds, TF_DETERMINISTIC_OPS=1, no shuffle,
workers=1, and a fixed pred_batch_size to minimise retracing.
Optional dependencies: keras and tensorflow. When not available,
the factory returns the linear fallback.
A list with $fit and $predict closures.
## Not run:
seq_gru <- ml_make_seq_model("gru", steps = 26, units = 16, epochs = 12)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.