deepSignalAnomalyDetectorLSTM
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 "lstm"
as the model
type.
Properties
General
IsTrained
— Training status
0
(false
) | 1
(true
)
This property is read-only.
Training status, specified as 0
(false
) or
1
(true
). When the detector has been trained,
IsTrained
is equal to 1
.
Data Types: logical
NumChannels
— Number of channels
positive integer
This property is read-only.
Number of channels in each input signal, specified as a positive integer.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Model
ModelType
— Type of deep learning model
"lstm"
This property is read-only.
Type of deep learning model implemented by the detector, specified as
"lstm"
.
EncoderHiddenUnits
— Number of hidden units in encoder
[32 16]
(default) | vector of positive integers
This property is read-only.
Number of hidden units for each layer in the encoder, specified 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
DecoderHiddenUnits
— Number of hidden units in decoder
[32 16]
(default) | vector of positive integers
This property is read-only.
Number of hidden units in each layer of the decoder, specified 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
WindowLength
— Window length
1
(default) | positive integer | "fullSignal"
This property is read-only.
Window length of each signal segment, specified as a positive integer or as
"fullSignal"
.
If
WindowLength
is specified as an integer, the detector divides each input signal into segments. The length of each segment is equal to the specified value in samples.If
WindowLength
is specified as"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
OverlapLength
— Number of overlapped samples
"auto"
(default) | positive integer
This property is read-only.
Number of overlapped samples between window segments, specified as a positive integer
or as "auto"
.
If
OverlapLength
is specified as integer, the detector sets the number of overlapped samples equal to the specified value.If
OverlapLength
is specified as"auto"
, the detector sets the number of overlapped samples equal toWindowLength
– 1.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
WindowLossAggregation
— Method to aggregate sample loss
"mean"
(default) | "max"
| "min"
| "median"
This property is read-only.
Method to aggregate sample loss within each window segment, specified 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
ThresholdMethod
— Method to compute detection threshold
"contaminationFraction"
(default) | "max"
| "median"
| "mean"
| "manual"
| "customFunction"
This property is read-only.
Method to compute the detection threshold, specified as one of these:
"contaminationFraction"
— Value corresponding to the detection of anomalies within a specified fraction of windows. The fraction value is specified byThresholdParameter
."max"
— Maximum window loss measured over the entire training data set and multiplied byThresholdParameter
."median"
— Median window loss measured over the entire training data set and multiplied byThresholdParameter
."mean"
— Mean window loss measured over the entire training data set and multiplied byThresholdParameter
."manual"
— Manual detection threshold value based onThreshold
."customFunction"
— Custom detection threshold value based onThresholdFunction
.
Use updateDetector
to modify this and other threshold properties.
Data Types: char
| string
ThresholdParameter
— Detection threshold
real scalar
This property is read-only.
Detection threshold, specified as a nonnegative scalar when
ThresholdMethod
is set to
"contaminationFraction"
, and as positive scalar when
ThresholdMethod
is set to "max"
,
"median"
, or "mean"
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Threshold
— Manual detection threshold
positive scalar
This property is read-only.
Manual detection threshold, specified as a positive scalar. This property applies only when ThresholdMethod
is set to "manual"
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
ThresholdFunction
— Function to compute custom detection threshold
function handle
This property is read-only.
Function to compute custom detection threshold, specified as a function handle. This property
applies only when ThresholdMethod
is set to
"customFunction"
.
Data Types: function_handle
Object Functions
detect | Detect anomalies in signals |
getModel | Get underlying neural network model of signal anomaly detector |
plotAnomalies | Plot signal anomalies |
plotLoss | Plot window reconstruction loss |
plotLossDistribution | Plot CDF and histogram of aggregated window loss distribution |
trainDetector | Train signal anomaly detector |
updateDetector | Update settings of trained detector and recompute detection threshold |
Examples
Neural Network Model of LSTM Anomaly Detector
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,"lstm");
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
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
The
ExecutionEnvironment
option must be"gpu"
or"auto"
when the input data is:A
gpuArray
A cell array containing
gpuArray
objectsA datastore that outputs cell arrays containing
gpuArray
objects
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2023a
See Also
Functions
Objects
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)