DeepStateNet

class DeepStateNet(ssm: etna.models.nn.deepstate.state_space_model.CompositeSSM, input_size: int, num_layers: int, n_samples: int, lr: float, optimizer_params: Optional[dict])[source]

Bases: etna.models.base.DeepBaseNet

DeepState network.

Create instance of DeepStateNet.

Parameters
  • ssm (etna.models.nn.deepstate.state_space_model.CompositeSSM) – State Space Model of the system.

  • input_size (int) – Size of the input feature space: features for RNN part.

  • num_layers (int) – Number of layers in RNN.

  • n_samples (int) – Number of samples to use in predictions generation.

  • lr (float) – Learning rate.

  • optimizer_params (Optional[dict]) – Parameters for optimizer for Adam optimizer (api reference torch.optim.Adam)

Methods

configure_optimizers()

Optimizer configuration.

forward(x, *args, **kwargs)

Forward pass.

make_samples(df, encoder_length, decoder_length)

Make samples from segment DataFrame.

step(batch, *args, **kwargs)

Step for loss computation for training or validation.

Attributes

configure_optimizers() torch.optim.optimizer.Optimizer[source]

Optimizer configuration.

Return type

torch.optim.optimizer.Optimizer

forward(x: etna.models.nn.deepstate.deepstate.DeepStateBatch, *args, **kwargs)[source]

Forward pass.

Parameters

x (etna.models.nn.deepstate.deepstate.DeepStateBatch) – batch of data

Returns

forecast with shape (batch_size, decoder_length, 1)

make_samples(df: pandas.core.frame.DataFrame, encoder_length: int, decoder_length: int) Iterator[dict][source]

Make samples from segment DataFrame.

Parameters
  • df (pandas.core.frame.DataFrame) –

  • encoder_length (int) –

  • decoder_length (int) –

Return type

Iterator[dict]

step(batch: etna.models.nn.deepstate.deepstate.DeepStateBatch, *args, **kwargs)[source]

Step for loss computation for training or validation.

Parameters

batch (etna.models.nn.deepstate.deepstate.DeepStateBatch) – batch of data

Returns

loss, true_target, prediction_target