Main Content

plot

Plot detected anomalies and anomaly scores generated from deep learning anomaly detectors

Since R2025a

Description

Add-On Required: This feature requires the Time Series Anomaly Detection for MATLAB add-on.

plot(detector,data) plots the anomaly detection data in data that result from executing detect with the anomaly detection model detector.

plot plots two figures—one for the anomalies and the other for the anomaly score.

For an example of using plot as part of the detector development workflow, see Train and Test TCN Anomaly Detector.

This function requires Deep Learning Toolbox™.

plot(___,Name=Value) sets additional options using one or more name-value arguments.

Input Arguments

collapse all

Trained deep learning anomaly detector model, specified as a TcnDetector, DeepantDetector, UsadDetector, or VaelstmDetector object.

Single-member anomaly data to be plotted, specified as a table that is the output of detect.

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: plot(detectortcn,data,MiniBatchSize=64) plots a histogram of data for the TCN detector detectortcn and specifies a mini-batch size of 64 for detection.

All Deep Learning Detectors

expand all

Type of figure to plot, specified as "all", "anomaly", or "anomalyScores".

  • The "anomaly" plot type overlays the detected anomaly on the observed signal.

  • The anomalyScores plot type plots the anomaly scores against the threshold so that you can evaluate visually how effective the threshold is.

For an example of these plot types, see Train and Test TCN Anomaly Detector.

Execution environment that determines what hardware resources the software uses to run the network, specified as "auto", "cpu", "gpu", or "multi-gpu".

  • "auto" — Use the GPU if one is available, or if not, the CPU.

  • "cpu" — Use the CPU.

  • "gpu" — Use the GPU.

  • "multi-gpu" — Use the GPU array.

Example: plot(detectorUsad,data,ExecutionEnvironment="cpu") uses the CPU for plotting regardless of whether a GPU is available.

TCN. VAELSTM, and DeepAnt Detectors Only

expand all

Mini-batch size that is used in detect, specified as a positive integer scalar.

You must set this argument if detect uses a MiniBatchSize value of anything other than default size of 128.

Extended Capabilities

expand all

Version History

Introduced in R2025a

expand all