Skip to main content

Anomaly detection

Score how unusual new data is with an autoencoder: reconstruction error and a learned threshold.

2 nodes. Right-click any node in the editor to read this documentation in the app.

Anomaly Detectionโ€‹

๐Ÿšจ Novelty Thresholdโ€‹

id anomaly_novelty_threshold ยท Anomaly Detection ยท Python export: yes

Learn what 'normal' error looks like, then flag what exceeds it. The threshold comes from the errors on healthy data: the maximum, a percentile (default 99), or mean + k (sample) standard deviations. Rows of the new errors above it are flagged is_anomaly. With no new errors wired in, the healthy errors themselves are scored. Colour a Scatter Plot by is_anomaly to see the flagged rows.

Inputs

PortTypeDescription
train_errorsDataFrame | ndarrayReconstruction errors on healthy data; sets the threshold.
new_errorsDataFrame | ndarrayErrors to score against the threshold (optional: blank scores the healthy errors).

Outputs

PortTypeDescription
flagsDataFrameColumns: window, error, threshold, is_anomaly.

Fields

FieldTypeDefaultChoices
Threshold methodselectpercentilepercentile, max, mean_k_std
Percentile (percentile method)float99.0
k (mean_k_std method)float3.0

๐Ÿ” Reconstruction Errorโ€‹

id anomaly_reconstruction_error ยท Anomaly Detection ยท Python export: yes

How badly an autoencoder rebuilt each row: the mean squared (or absolute) difference between a row and its reconstruction. Rows the model saw during training reconstruct well; unfamiliar rows reconstruct badly, which makes the error a novelty score. Wire in the original data and Run Model's output.

Inputs

PortTypeDescription
originalndarray | DataFrame | TensorThe data that went into the model.
reconstructionndarray | DataFrame | TensorThe model's output for it (same shape as original).

Outputs

PortTypeDescription
errorsDataFrameOne column, 'error': the reconstruction error of each row.

Fields

FieldTypeDefaultChoices
Error measureselectmsemse, mae