1<span style="float:right;"><a href="https://github.com/RubixML/ML/blob/master/src/AnomalyDetectors/RobustZScore.php">[source]</a></span>
2
3# Robust Z-Score
4A statistical anomaly detector that uses modified Z-Scores that are robust to preexisting outliers in the training set. The modified Z-Score is defined as the feature value minus the median over the median absolute deviation (MAD). Anomalies are flagged if their final weighted Z-Score exceeds a user-defined threshold.
5
6!!! note
7    An alpha value of 1 means the estimator only considers the maximum absolute Z-Score, whereas a setting of 0 indicates that only the average Z-Score factors into the final score.
8
9**Interfaces:** [Estimator](../estimator.md), [Learner](../learner.md), [Scoring](../scoring.md), [Persistable](../persistable.md)
10
11**Data Type Compatibility:** Continuous
12
13## Parameters
14| # | Name | Default | Type | Description |
15|---|---|---|---|---|
16| 1 | threshold | 3.5 | float | The minimum Z-Score to be flagged as an anomaly. |
17| 2 | alpha | 0.5 | float | The weight of the maximum per-sample Z-Score in the overall anomaly score. |
18
19## Example
20```php
21use Rubix\ML\AnomalyDetectors\RobustZScore;
22
23$estimator = new RobustZScore(3.0, 0.3);
24```
25
26## Additional Methods
27Return the median of each feature column in the training set:
28```php
29public medians() : float[]|null
30```
31
32Return the median absolute deviation (MAD) of each feature column in the training set:
33```php
34public mads() : float[]|null
35```
36
37## References
38[^1]: B. Iglewicz et al. (1993). How to Detect and Handle Outliers.