timesead.models.generative.sis_vae ================================== .. py:module:: timesead.models.generative.sis_vae Classes ------- .. autoapisummary:: timesead.models.generative.sis_vae.SISVAE timesead.models.generative.sis_vae.SISVAELossWithGeneratedPrior timesead.models.generative.sis_vae.SISVAEAnomalyDetector Module Contents --------------- .. py:class:: SISVAE(input_dim: int, rnn_hidden_dim: int = 200, latent_dim: int = 40, x_hidden_dims: List[int] = [100], z_hidden_dims: List[int] = [100], enc_hidden_dims: List[int] = [100], dec_hidden_dims: List[int] = [100], prior_hidden_dims: List[int] = [100]) Bases: :py:obj:`timesead.models.BaseModel` Base class for all neural network modules. Your models should also subclass this class. Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:: import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self) -> None: super().__init__() self.conv1 = nn.Conv2d(1, 20, 5) self.conv2 = nn.Conv2d(20, 20, 5) def forward(self, x): x = F.relu(self.conv1(x)) return F.relu(self.conv2(x)) Submodules assigned in this way will be registered, and will also have their parameters converted when you call :meth:`to`, etc. .. note:: As per the example above, an ``__init__()`` call to the parent class must be made before assignment on the child. :ivar training: Boolean represents whether this module is in training or evaluation mode. :vartype training: bool Li2021, ist aber im Prinzip nur Chung2015 mit einem extra loss term :param input_dim: :param lstm_hidden_dims: :param latent_dim: .. py:attribute:: latent_dim :value: 40 .. py:attribute:: rnn_hidden_dim :value: 200 .. py:attribute:: x_embed .. py:attribute:: z_embed .. py:attribute:: encoder .. py:attribute:: decoder .. py:attribute:: prior_decoder .. py:attribute:: rnn_cell .. py:attribute:: softplus .. py:method:: forward(inputs: Tuple[torch.Tensor]) -> Tuple[torch.Tensor, Ellipsis] .. py:class:: SISVAELossWithGeneratedPrior(smooth_weight: float = 0.5) Bases: :py:obj:`timesead.models.common.VAELoss` .. py:attribute:: smooth_weight :value: 0.5 .. py:method:: forward(predictions: Tuple[torch.Tensor, Ellipsis], targets: Tuple[torch.Tensor, Ellipsis], *args, **kwargs) -> torch.Tensor .. py:class:: SISVAEAnomalyDetector(model: SISVAE, num_mc_samples: int = 128) Bases: :py:obj:`timesead.models.common.AnomalyDetector` We decided not to include the reconstruction step from the paper here, since we don't have missing data. :param model: :param num_mc_samples: .. py:attribute:: model .. py:attribute:: num_mc_samples :value: 128 .. py:method:: compute_online_anomaly_score(inputs: Tuple[torch.Tensor, Ellipsis]) -> torch.Tensor .. py:method:: compute_offline_anomaly_score(inputs: Tuple[torch.Tensor, Ellipsis]) -> torch.Tensor .. py:method:: fit(dataset: torch.utils.data.DataLoader) -> None .. py:method:: format_online_targets(targets: Tuple[torch.Tensor, Ellipsis]) -> torch.Tensor