Torch Seq2Seq Encoder-Decoder Model for Time-Feature Analysis

Proposes Seq2seq Time-Feature Analysis using a torch Encoder-Decoder to project into latent space and a Forward Network to predict the next sequence, with dependency-light local support functions, tidy outputs and baseline backtesting helpers.


codez

codez fits a seq2seq encoder-decoder model for time-feature forecasting. Version 2.0 moves the neural backend from TensorFlow/Keras to torch, keeps the original codez() entry point, and adds a more R-native workflow through fit_codez().

Install backend

torch is used at fit time:

install.packages("torch")
torch::install_torch()

Basic use

library(codez)

model <- fit_codez(
  amzn_aapl_fb[, -1],
  dates = as.Date(amzn_aapl_fb$Date),
  seq_len = 20,
  n_samp = 3,
  n_windows = 5,
  control = codez_control(epochs = 50, batch_size = 32, n_sim = 1000)
)

forecast <- predict(model)
summary(model)
plot(model)

What changed in 2.0

  • Torch backend for the autoencoder and latent forward network.
  • fit_codez() returns a codez_model with tidy forecasts, baseline backtests, and S3 methods.
  • Convenience dependencies were replaced with local support functions; model fitting now only needs torch at runtime.
  • codez() still returns the legacy list shape: history, best_model, and time_log.
  • Mixed numeric/categorical data is rejected explicitly. Pass all numeric or all factor/character columns.
  • Numeric fits include rolling naive and average baseline comparisons.

Output shape

predict(model) returns one row per feature and horizon, with forecast summary columns such as min, interval quantiles, 50%, mean, sd, and pred_scores.

The legacy result is still available at:

model$result

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("codez")

2.0.0 by Giancarlo Vercellino, 3 months ago


https://rpubs.com/giancarlo_vercellino/codez


Browse source code at https://github.com/cran/codez


Authors: Giancarlo Vercellino [aut, cre, cph]


Documentation:   PDF Manual  


GPL-3 license


Suggests testthat, torch


See at CRAN