Recurrent Models#

RNN-based architectures for sequential time-series modeling.

TimeNet#

GRU-based encoder-decoder with autoencoder pretraining. Uses BasicEncodingMixin for inference.

class chronocratic.models.recurrent.timenet.model.TimeNet(hidden_dims: int, depth: int, input_dims: int = 1, dropout_rate: float = 0.1, learning_rate: float = 0.001)#

Bases: LightningModule, BasicEncodingMixin

TimeNet Model.

This model was implemented based on the code available on this GitHub repo paudan/TimeNet under MIT License.

property encoder: Sequential#

Return the GRU encoder.

property decoder: Sequential#

Return the GRU decoder.

forward(x: Tensor) Tensor#

Reconstruct x from the reversed encoder sequence.

training_step(batch: Tensor, _batch_idx: int) Tensor#

Compute and log the training reconstruction loss.

validation_step(batch: Tensor, _batch_idx: int) Tensor#

Compute and log the validation reconstruction loss.

configure_optimizers() OptimizerLRScheduler#

Return the Adam optimizer used to train TimeNet.

Configuration for the TimeNet model.

Provides TimeNetModelParameters with settings for the GRU encoder / decoder pair used by the autoencoder pretraining objective.

class chronocratic.models.recurrent.timenet.config.TimeNetModelParameters(*, hidden_dims: int, depth: int, input_dims: int = 1, dropout_rate: float = 0.1, learning_rate: float = 0.001)#

Bases: object

Configuration for the TimeNet model.

Parameters:
  • hidden_dims – Number of hidden units in each GRU layer of the encoder and decoder.

  • depth – Number of stacked GRU layers in each of the encoder and decoder.

  • input_dims – Number of input features (channels) in the time series.

  • dropout_rate – Dropout probability inserted between successive GRU layers. 0 disables dropout.

  • learning_rate – Base learning rate for the Adam optimizer.