timesead.models.generative.sis_vae
Classes
Base class for all neural network modules. |
|
We decided not to include the reconstruction step from the paper here, since we don't have missing data. |
Module Contents
- class timesead.models.generative.sis_vae.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:
timesead.models.BaseModelBase 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
to(), etc.Note
As per the example above, an
__init__()call to the parent class must be made before assignment on the child.- Variables:
training (bool) – Boolean represents whether this module is in training or evaluation mode.
- Parameters:
Li2021, ist aber im Prinzip nur Chung2015 mit einem extra loss term
- Parameters:
- latent_dim = 40
- x_embed
- z_embed
- encoder
- decoder
- prior_decoder
- rnn_cell
- softplus
- forward(inputs: Tuple[torch.Tensor]) Tuple[torch.Tensor, Ellipsis]
- Parameters:
inputs (Tuple[torch.Tensor])
- Return type:
Tuple[torch.Tensor, Ellipsis]
- class timesead.models.generative.sis_vae.SISVAELossWithGeneratedPrior(smooth_weight: float = 0.5)
Bases:
timesead.models.common.VAELoss- Parameters:
smooth_weight (float)
- smooth_weight = 0.5
- forward(predictions: Tuple[torch.Tensor, Ellipsis], targets: Tuple[torch.Tensor, Ellipsis], *args, **kwargs) torch.Tensor
- Parameters:
predictions (Tuple[torch.Tensor, Ellipsis])
targets (Tuple[torch.Tensor, Ellipsis])
- Return type:
- class timesead.models.generative.sis_vae.SISVAEAnomalyDetector(model: SISVAE, num_mc_samples: int = 128)
Bases:
timesead.models.common.AnomalyDetectorWe decided not to include the reconstruction step from the paper here, since we don’t have missing data.
- model
- num_mc_samples = 128
- compute_online_anomaly_score(inputs: Tuple[torch.Tensor, Ellipsis]) torch.Tensor
- Parameters:
inputs (Tuple[torch.Tensor, Ellipsis])
- Return type:
- compute_offline_anomaly_score(inputs: Tuple[torch.Tensor, Ellipsis]) torch.Tensor
- Parameters:
inputs (Tuple[torch.Tensor, Ellipsis])
- Return type:
- fit(dataset: torch.utils.data.DataLoader) None
- Parameters:
dataset (torch.utils.data.DataLoader)
- Return type:
None
- format_online_targets(targets: Tuple[torch.Tensor, Ellipsis]) torch.Tensor
- Parameters:
targets (Tuple[torch.Tensor, Ellipsis])
- Return type: