({{, (RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction])[…] 
represents a function generated by (RefLink[AnomalyDetection, paclet:ref/AnomalyDetection]) for detecting whether data is anomalous or not.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction]) works like (RefLink[Function, paclet:ref/Function]).

(RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction])[…][data] returns (RefLink[True, paclet:ref/True]) if it considers data to be anomalous, and (RefLink[False, paclet:ref/False]) otherwise.

(RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction])[…][{(Subscript[data, 1]),(Subscript[data, 2]),…}] tests all the (Subscript[data, i]).

(RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction])[…][data,prop] gives the specified property of the anomaly detection associated with data.

Possible properties include:

The following options can be given:

Possible settings for (RefLink[PerformanceGoal, paclet:ref/PerformanceGoal]) include:

(RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction])[…] can also be used with (RefLink[FindAnomalies, paclet:ref/FindAnomalies]) to detect anomalous examples.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Train a detector function on a numeric dataset:

ad=AnomalyDetection[{1.2,2.5,3.2,4.6,5.6,7,8,9,8.3}]

Use the trained detector to find examples that are considered anomalous:

ad[{5,6,11,100}]

Find rarer probabilities of new examples:

ad[{5, 6,11,100}, "RarerProbability"]

Train an (RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction]) on a two-dimensional array of pseudorandom real numbers:

ad=AnomalyDetection[RandomReal[1,{20,2}]]

Use the trained (RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction]) to find anomalies in new examples with (RefLink[FindAnomalies, paclet:ref/FindAnomalies]):

FindAnomalies[ad,{{5, 0.6},{0.3, 0.5},{0.1,0.2}}]

Find anomalies and their corresponding positions:

FindAnomalies[ad,{{0.8,0.7},{5, 0.6},{0.3, 0.5},{0.1,0.2}}, {"Anomalies","Positions"}]

OpenersExampleSection1(Spacer1)Scope  (1)

Train an (RefLink[AnomalyDetectorFunction, paclet:ref/AnomalyDetectorFunction]) on a list of colors:

ad= AnomalyDetection[{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, }]

Attempt to find outliers in a list of colors using the trained anomaly detector:

ad[{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,}]

Obtain information on the trained anomaly detector:

Information[ad]

Obtain information on training time:

Information[ad, "TrainingTime"]

Find the training method:

Information[ad, "Method"]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)AcceptanceThreshold  (1)

Create a dataset sampled from two different distributions:

data=Join[RandomVariate[NormalDistribution[-1,0.5],70],RandomVariate[ChiDistribution[6],2]]

Train an anomaly detector function:

ad=AnomalyDetection[data]

Find anomalous/non-anomalous examples by specifying the (RefLink[AcceptanceThreshold, paclet:ref/AcceptanceThreshold]):

ad[data, AcceptanceThreshold ->.00001]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[AnomalyDetection, paclet:ref/AnomalyDetection])  ▪  (RefLink[LearnedDistribution, paclet:ref/LearnedDistribution])  ▪  (RefLink[RarerProbability, paclet:ref/RarerProbability])  ▪  (RefLink[ClassifierFunction, paclet:ref/ClassifierFunction])  ▪  (RefLink[DimensionReducerFunction, paclet:ref/DimensionReducerFunction])  ▪  (RefLink[FindAnomalies, paclet:ref/FindAnomalies])  ▪  (RefLink[DeleteAnomalies, paclet:ref/DeleteAnomalies])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Machine Learning, paclet:guide/MachineLearning])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/22-machine-learning.html])(WebLink[: Machine Learning, https://www.wolfram.com/language/elementary-introduction/22-machine-learning.html])}})}})