is an option for functions such as Classify that specifies an anomaly detector for them to include.


AnomalyDetector
is an option for functions such as Classify that specifies an anomaly detector for them to include.
Details

- Possible settings for AnomalyDetector include:
-
None use no anomaly detector (default) AnomalyDetectorFunction[…] use the specified anomaly detector Automatic create an anomaly detector from the available data LearnedDistribution[…] create an anomaly detector from a learned distribution - The specified anomaly detector is typically used during model evaluation, not during model training.
- When an anomalous example is encountered, Missing["Anomalous"] is returned instead of a classification or prediction result.
- Classify[ClassifierFunction[…],AnomalyDetectordetector] can be used to overwrite the anomaly detector of a particular classifier (and similarly for PredictorFunction[…]).
- Classify[ClassifierFunction[…],AcceptanceThresholdt] can be used to overwrite the value of the rarer-probability threshold used by the anomaly detector.
- ClassifierFunction[…][example,AnomalyDetectordetector] can be used to temporarily overwrite the anomaly detector during a model evaluation.
- ClassifierFunction[…][example,AcceptanceThresholdt] can be used to temporarily overwrite the rarer-probability threshold value during a model evaluation.
Examples
Basic Examples (3)
Create a classifier and specify that an anomaly detector should be included:
Evaluate the classifier on a non-anomalous input:
Evaluate the classifier on an anomalous input:
The "Probabilities" property is not affected by the anomaly detector:
Remove the anomaly detector from the classifier:
Create a classifier without an anomaly detector:
Train an anomaly detector from the training inputs:
Add the anomaly detector to the classifier:
Change the value of the acceptance threshold when evaluating the classifier:
Create a predictor and specify that an anomaly detector should be included:
Evaluate the predictor on a non-anomalous input:
Evaluate the predictor on an anomalous input:
The "Distribution" property is not affected by the anomaly detector:
Change the value of the acceptance threshold when evaluating the predictor:
Related Guides
History
Text
Wolfram Research (2020), AnomalyDetector, Wolfram Language function, https://reference.wolfram.com/language/ref/AnomalyDetector.html.
CMS
Wolfram Language. 2020. "AnomalyDetector." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AnomalyDetector.html.
APA
Wolfram Language. (2020). AnomalyDetector. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnomalyDetector.html
BibTeX
@misc{reference.wolfram_2025_anomalydetector, author="Wolfram Research", title="{AnomalyDetector}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/AnomalyDetector.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_anomalydetector, organization={Wolfram Research}, title={AnomalyDetector}, year={2020}, url={https://reference.wolfram.com/language/ref/AnomalyDetector.html}, note=[Accessed: 13-August-2025]}