Learn R Programming

daltoolboxdp (version 1.2.737)

autoenc_lstm_ed: LSTM Autoencoder - Encode-Decode

Description

Creates a deep learning LSTM-based autoencoder that encodes and decodes sequences of observations. Wraps a PyTorch implementation via reticulate.

Usage

autoenc_lstm_ed(
  input_size,
  encoding_size,
  batch_size = 32,
  num_epochs = 50,
  learning_rate = 0.001
)

Value

A autoenc_lstm_ed object.

Arguments

input_size

Integer. Number of input features per observation.

encoding_size

Integer. Size of the latent (bottleneck) representation.

batch_size

Integer. Mini-batch size used during training. Default is 32.

num_epochs

Integer. Maximum number of training epochs. Default is 50.

learning_rate

Numeric. Optimizer learning rate. Default is 0.001.

References

Hochreiter, S., & Schmidhuber, J. (1997). Long Short-Term Memory.

Examples

Run this code
if (FALSE) {
X <- matrix(rnorm(1000), nrow = 50, ncol = 20)
ae <- autoenc_lstm_ed(input_size = 20, encoding_size = 5, num_epochs = 50)
ae <- daltoolbox::fit(ae, X)
X_hat <- daltoolbox::transform(ae, X)  # reconstructions
mean((X - X_hat)^2)
}

# See:
# https://github.com/cefet-rj-dal/daltoolbox/blob/main/autoencoder/autoenc_lstm_ed.md

Run the code above in your browser using DataLab