probability_weighted_ae
¶
Classes:
Name | Description |
---|---|
ProbabilityWeightedAutoencoder |
|
ProbabilityWeightedAutoencoder
¶
ProbabilityWeightedAutoencoder(
module: Module,
loss_fn: Union[str, Callable] = "mse",
optimizer_fn: Union[str, Callable] = "sgd",
lr: float = 0.001,
device: str = "cpu",
seed: int = 42,
skip_threshold: float = 0.9,
window_size=250,
**kwargs
)
Bases: Autoencoder
Methods:
Name | Description |
---|---|
clone |
Return a fresh estimator instance with (optionally) copied state. |
draw |
Render a (partial) computational graph of the wrapped model. |
learn_one |
Performs one step of training with a single example, |
load |
Load a previously saved estimator. |
save |
Persist the estimator (architecture, weights, optimiser & runtime state). |
score_many |
Returns an anomaly score for the provided batch of examples in |
score_one |
Returns an anomaly score for the provided example in the form of |
Source code in deep_river/anomaly/probability_weighted_ae.py
clone
¶
Return a fresh estimator instance with (optionally) copied state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_params
|
dict | None
|
Parameter overrides for the cloned instance. |
None
|
include_attributes
|
bool
|
If True, runtime state (observed features, buffers) is also copied. |
False
|
copy_weights
|
bool
|
If True, model weights are copied (otherwise the module is re‑initialised). |
False
|
Source code in deep_river/base.py
draw
¶
Render a (partial) computational graph of the wrapped model.
Imports graphviz
and torchviz
lazily. Raises an informative
ImportError if the optional dependencies are not installed.
Source code in deep_river/base.py
learn_one
¶
Performs one step of training with a single example, scaling the employed learning rate based on the outlier probability estimate of the input example.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
|
{}
|
|
x
|
dict
|
Input example. |
required |
Returns:
Type | Description |
---|---|
ProbabilityWeightedAutoencoder
|
The autoencoder itself. |
Source code in deep_river/anomaly/probability_weighted_ae.py
load
classmethod
¶
Load a previously saved estimator.
The method reconstructs the estimator class, its wrapped module, optimiser state and runtime information (feature names, buffers, etc.).
Source code in deep_river/base.py
save
¶
Persist the estimator (architecture, weights, optimiser & runtime state).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str | Path
|
Destination file. Parent directories are created automatically. |
required |
Source code in deep_river/base.py
score_many
¶
Returns an anomaly score for the provided batch of examples in the form of the autoencoder's reconstruction error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Input batch of examples. |
required |
Returns:
Type | Description |
---|---|
float
|
Anomaly scores for the given batch of examples. Larger values indicate more anomalous examples. |
Source code in deep_river/anomaly/ae.py
score_one
¶
Returns an anomaly score for the provided example in the form of the autoencoder's reconstruction error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
dict
|
Input example. |
required |
Returns:
Type | Description |
---|---|
float
|
Anomaly score for the given example. Larger values indicate more anomalous examples. |