train
Train statistical process control (SPC) anomaly detector and obtain detection threshold
Since R2025a
Description
Add-On Required: This feature requires the Time Series Anomaly Detection for MATLAB add-on.
The train function trains a time series SPC (Statistical
Process Control) anomaly detector as part of the time series anomaly detection
workflow.
The SPC anomaly detector provide two options that you can use to control training —window length and training stride. Unlike deep learning anomaly detectors, you cannot use GPU or parallel CPU processing with these models.
trains the anomaly detector detector = train(detector,trainData)detector with a training data set
trainData that contains only normal data, and not any anomalous data.
This syntax uses default options.
When the ThresholdMethod property for detector
is set to any method but "manual", train also
obtains the detection threshold that the detector uses to identify an anomaly.
You can use train to train a newly created detector or continue the
training of a previously trained detector.
For an example of using train as part of the detector development
workflow, see .