NBeatsBaseNet

class NBeatsBaseNet(model: torch.nn.modules.module.Module, input_size: int, output_size: int, loss: torch.nn.modules.module.Module, lr: float, optimizer_params: Optional[Dict[str, Any]])[source]

Bases: etna.models.base.DeepBaseNet

Base class for N-BEATS models.

Init DeepBaseNet.

Methods

configure_optimizers()

Optimizer configuration.

forward(batch)

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

Parameters
  • model (nn.Module) –

  • input_size (int) –

  • output_size (int) –

  • loss (nn.Module) –

  • lr (float) –

  • optimizer_params (Optional[Dict[str, Any]]) –

configure_optimizers() Tuple[List[torch.optim.optimizer.Optimizer], List[Dict[str, Any]]][source]

Optimizer configuration.

Return type

Tuple[List[torch.optim.optimizer.Optimizer], List[Dict[str, Any]]]

forward(batch: etna.models.nn.nbeats.nets.NBeatsBatch) torch.Tensor[source]

Forward pass.

Parameters

batch (etna.models.nn.nbeats.nets.NBeatsBatch) – Batch of input data.

Returns

Prediction data.

Return type

torch.Tensor

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

Make samples from segment DataFrame.

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

  • encoder_length (int) –

  • decoder_length (int) –

Return type

Iterable[dict]

step(batch: etna.models.nn.nbeats.nets.NBeatsBatch, *args, **kwargs)[source]

Step for loss computation for training or validation.

Parameters

batch (etna.models.nn.nbeats.nets.NBeatsBatch) – Batch of input data.

Returns

loss, true_target, prediction_target