Main Content

deepSignalAnomalyDetectorLSTM

Detect signal anomalies using LSTM autoencoder

Since R2023a

    Description

    The deepSignalAnomalyDetectorLSTM object uses a long short-term memory (LSTM) autoencoder model to detect signal anomalies.

    Creation

    Create a deepSignalAnomalyDetectorLSTM object using deepSignalAnomalyDetector and specifying "lstmautoencoder" as the model type.

    Properties

    expand all

    General

    This property is read-only.

    Training status, returned as 0 (false) or 1 (true). Once you train the detector, IsTrained is equal to 1.

    Data Types: logical

    This property is read-only.

    Number of channels in each input signal, returned as a positive integer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Model

    This property is read-only.

    Type of deep learning model implemented by the detector, returned as "lstmautoencoder".

    This property is read-only.

    Number of hidden units for each layer in the encoder, returned as a vector of positive integers. The ith element of the vector sets the number of hidden units in the ith layer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    This property is read-only.

    Number of hidden units in each layer of the decoder, returned as a vector of positive integers. The ith element of the vector sets the number of hidden units in the ith layer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Window

    This property is read-only.

    Window length of each signal segment, returned as a positive integer or as "fullSignal".

    • If WindowLength is an integer, the detector divides each input signal into segments. The length of each segment is equal to the WindowLength value in samples.

    • If WindowLength is "fullSignal", the detector treats each input signal as a single segment.

    Use updateDetector to modify this and other window properties.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | string

    This property is read-only.

    Number of overlapped samples between window segments, returned as a positive integer or as "auto".

    • If OverlapLength is a positive integer, the detector sets the number of overlapped samples equal to the OverlapLength value.

    • If OverlapLength is "auto", the detector sets the number of overlapped samples equal to WindowLength – 1.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | string

    This property is read-only.

    Method to aggregate sample loss within each window segment, returned as one of these:

    • "max" — Compute the aggregated window loss as the maximum value of all the sample losses within the window.

    • "mean" — Compute the aggregated window loss as the mean value of all the sample losses within the window.

    • "median" — Compute the aggregated window loss as the median value of all the sample losses within the window.

    • "min" — Compute the aggregated window loss as the minimum value of all the sample losses within the window.

    Data Types: char | string

    Threshold

    This property is read-only.

    Method to compute the detection threshold, returned as one of these:

    • "contaminationFraction" — Value corresponding to the detection of anomalies within a specified fraction of windows. The fraction value is specified by ThresholdParameter.

    • "max" — Maximum window loss measured over the entire training data set and multiplied by ThresholdParameter.

    • "median" — Median window loss measured over the entire training data set and multiplied by ThresholdParameter.

    • "mean" — Mean window loss measured over the entire training data set and multiplied by ThresholdParameter.

    • "manual" — Manual detection threshold value based on Threshold.

    • "customFunction" — Custom detection threshold value based on ThresholdFunction.

    Use updateDetector to modify this and other threshold properties.

    Data Types: char | string

    This property is read-only.

    Detection threshold, returned as a nonnegative scalar when you set ThresholdMethod to "contaminationFraction", and as positive scalar when you set ThresholdMethod to "max", "median", or "mean".

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    This property is read-only.

    Manual detection threshold, returned as a positive scalar. This property applies only when you set ThresholdMethod to "manual".

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    This property is read-only.

    Function to compute custom detection threshold, returned as a function handle. This property applies only when you set ThresholdMethod to "customFunction".

    Data Types: function_handle

    Object Functions

    detectDetect anomalies in signals
    getModelGet underlying neural network model of signal anomaly detector
    plotAnomaliesPlot signal anomalies
    plotLossPlot window reconstruction loss
    plotLossDistributionPlot CDF and histogram of aggregated window loss distribution
    saveModelSave detector network and parameters
    trainDetectorTrain signal anomaly detector
    updateDetectorUpdate settings of trained detector and recompute detection threshold

    Examples

    collapse all

    Create an object that uses a long short-term memory (LSTM) autoencoder model to detect anomalies in four-channel signals. Use deepSignalAnomalyDetector with default property values.

    D = deepSignalAnomalyDetector(4,"lstmautoencoder");

    Get the underlying neural network model of the LSTM anomaly detector. Use the analyzeNetwork (Deep Learning Toolbox) function to inspect the model.

    M = getModel(D);
    analyzeNetwork(M)

    Extended Capabilities

    Version History

    Introduced in R2023a