Anomaly Detection in Data Science
Anomaly Detection in Data Science
Abstract
With the advent of automatic data collection, it is now possible to store and process large troves of data.
There are technical issues associated to massive data sets, such as the speed and efficiency of analytical
methods, but there are also problems related to the detection of anomalous observations and the analysis
of outliers.
Extreme and irregular values behave very differently from the majority of observations. For instance, they
can represent criminal attacks, fraud attempts, targeted attacks, or data collection errors. As a result,
anomaly detection and outlier analysis play a crucial role in cybersecurity, quality control, etc. [1,3,4]. The
(potentially) heavy human price and technical consequences related to the presence of such observations
go a long way towards explaining why the topic has attracted attention in recent years.
This report contains a review of various detection methods, with particular attention paid to both supervised
and unsupervised methods, as well as an application to time series data and a project suggestion
(comparative analysis of various algorithms applied to 5 real-world datasets).
Keywords
Anomaly detection, outlier analysis.
Funding Acknowledgement
This report was funded by a University of Ottawa grant to develop teaching material in French (2019-2020). It was subsequently
translated into English to produce the current document.
1
Department of Mathematics and Statistics, University of Ottawa, Ottawa
2
Data Action Lab, Ottawa
3
Idlewyld Analytics and Consulting Services, Wakefield, Canada
Email: pboily@[Link]
However, anomalous observations are not only harbingers Numerous methods exist to identify anomalous observa-
of great scientific discoveries – unexpected observations tions; none of them are foolproof and judgement must
can spoil analyses or be indicative of the presence of issues be used. Methods that employ graphical aids (such as box-
related to data collection or data processing. plots, scatterplots, scatterplot matrices, and 2D tours) to
Either way, it becomes imperative for decision-makers identify outliers are particularly easy to implement, but
and analysts to establish anomaly detection protocols, and a low-dimensional setting is usually required for ease of
to identify strategies to deal with such observations. interpretability.
Analytical methods also exist (using Cooke’s or Maha-
1.1 Basic Notions and Overview lanobis’ distances, say), but in general some additional level
Outlying observations are data points which are atypi- of analysis must be performed, especially when trying to
cal in comparison to the unit’s remaining features (within- identify influential points (cf. leverage).
unit), or in comparison to the measurements for other units
(between-units), or as part of a collective subset of observa- With small datasets, anomaly detection can be conducted
tions. Outliers are thus observations which are dissimilar on a case-by-case basis, but with large datasets, the tempta-
to other cases or which contradict known dependencies tion to use automated detection/removal is strong – care
or rules.1 must be exercised before the analyst decides to go down
Observations could be anomalous in one context, but that route.3
not in another. Consider, for instance, an adult male who In the early stages of anomaly detection, simple data
is 6-foot tall. Such a man would fall in the 86th percentile analyses (such as descriptive statistics, 1- and 2-way tables,
among Canadian males [23], which, while on the tall side, and traditional visualisations) may be performed to help
is not unusual; in Bolivia, however, the same man would identify anomalous observations, or to obtain insights about
land in the 99.9th percentile [23], which would mark him the data, which could eventually lead to modifications of
as extremely tall and quite dissimilar to the rest of the pop- the analysis plan.
ulation.2
Outlier Tests
A common mistake that analysts make when dealing with How are outliers actually detected? Most methods come
outlying observations is to remove them from the dataset in one of two flavours: supervised and unsupervised (we
without carefully studying whether they are influential will discuss those in detail in later sections).
data points, that is, observations whose absence leads to Supervised methods use a historical record of labeled
markedly different analysis results. (that is to say, previously identified) anomalous observa-
When influential observations are identified, remedial tions to build a predictive classification or regression
measures (such as data transformation strategies) may need model which estimates the probability that a unit is anoma-
to be applied to minimize any undue effect. Note that lous; domain expertise is required to tag the data. Since
outliers may be influential, and influential data points may anomalies are typically infrequent, these models often also
be outliers, but the conditions are neither necessary nor have to accommodate the rare occurrence problem.4
sufficient. Unsupervised methods, on the other hand, use no pre-
viously labeled information or data, and try to determine if
Anomaly Detection an observation is an outlying one solely by comparing its
By definition, anomalies are infrequent and typically shrouded behaviour to that of the other observations.
in uncertainty due to their relatively low numbers, which
3
makes it difficult to differentiate them from banal noise or This stems partly from the fact that once the “anomalous” observations
have been removed from the dataset, previously “regular” observations
data collection errors.
can become anomalous in turn in the smaller dataset; it is not clear when
Furthermore, the boundary between normal and de- that runaway train will stop.
viant observations is usually fuzzy; with the advent of e- 4
Supervised models are built to minimize a cost function; in default
settings, it is often the case that the mis-classification cost is assumed to
1
Outlying observations may be anomalous along any of the individual be symmetrical, which can lead to technically correct but useless solutions.
variables, or in combination. For instance, the vast majority (99.999+%) of air passengers emphatically
2
Anomaly detection points towards interesting questions for analysts do not bring weapons with them on flights; a model that predicts that no
and subject matter experts: in this case, why is there such a large discrep- passenger is attempting to smuggle a weapon on board a flight would be
ancy in the two populations? 99.999+% accurate, but it would miss the point completely.
Figure 2. Summary visualisations for an (artificial) plant dataset: age distribution (left), height distribution (middle), height vs. age,
with linear trend (right).
Figure 3. Visualisations for an (artificial) service point dataset: trend for 11 service points (left), trend for 10 service points (middle),
influential observations (right).
Analysts who are well-versed in statistical methods might 1.2 Anomaly Detection as a Statistical Learning Problem
recognize the tell-tale signs that the distribution of ap- Fraudulent behaviour is not always easily identifiable, even
pendage lengths is likely to be asymmetrical (since the after the fact. Credit card fraudsters, for instance, will try
skewness is non-negligible) and to have a “fat” tail (due to to disguise their transactions as regular and banal, rather
the kurtosis being commensurate with the mean and the than as outlandish; to fool human observers into confusing
standard deviation, the range being so much larger than what is merely plausible with what is probable (or at least,
the interquartile range, and the maximum value being so not improbable).
much larger than the third quartile).
The mode, minimum, and first quartile values belong At its most basic level, anomaly detection is a problem in
to individuals without appendages, so there appears to be applied probability: if I denotes what is known about the
at least two sub-groups in the population (perhaps split dataset (behaviour of individual observations, behaviour of
along the lines of juveniles/adults, or males/females). The observations as a group, anomalous/normal verdict for a
maximum value has already been seen to be quite large number of similar observations, etc.), is
compared to the rest of the observations, which at first
P(obs. is anomalous | I) > P(obs. is normal | I)?
suggests that it might belong to an outlier.
The histogram of the measurements, however, shows Anomaly detection models usually assume stationarity for
that there are 3 individuals with very long appendages (see normal observations, which is to say, that the underlying
right-most chart in Figure 4): it now becomes plausible for mechanism that generates data does not change in a sub-
these anomalous entries to belong to individuals from a stantial manner over time, or, if it does, that its rate of
different species altogether who were erroneously added change or cyclicity is known.
to the dataset. This does not, of course, constitute a proof
of such an error, but it raises the possibility, which is often For time series data, this means that it may be necessary to
the best that an analyst can do in the absence of subject first perform trend and seasonality extraction.
matter expertise.
Example 4. Supply chains play a crucial role in the trans-
This traditional approach to anomaly detection fails for portation of goods from one part of the world to another. As
high-dimensional datasets, however, and a fundamentally the saying goes, “a given chain is only as strong as its weak-
different approach is advocated. est link” – in a multi-modal context, comparing the various
Figure 4. Summary and visualisation for an (artificial) appendage length dataset: descriptive statistics (left), appendage length
distribution (right).
transportation segments is far from an obvious endeavour: The supply chain under investigation has Shanghai as the
if shipments departing Shanghai in February 2013 took two point of origin of shipments, with Toronto as the final des-
more days, on average, to arrive in Vancouver than those tination; the containers enter the country either through
departing in July 2017, can it be said with any certainty Vancouver or Prince Rupert. Containers leave their point of
that the shipping process has improved in the intervening origin by boat, arrive and dwell in either of the two ports
years? Are February departures always slower to cross the before reaching their final destination by rail.
Pacific Ocean? For each of the three segments (Marine Transit, Port
The seasonal variability of performance is relevant to Dwell, Rail Transit), the data consists of the monthly em-
supply chain monitoring; the ability to quantify and account pirical distribution of transit times, built from sub-samples
for the severity of its impact on the data is thus of great (assumed to be randomly selected and fully representative)
interest. of all containers entering the appropriate segment.
One way to tackle this problem is to produce an index
Each segment’s performance is measured using fluidity
to track container transit times. This index should depict
indicators, which are computed using various statistics
the reliability and the variability of transit times but in
of the transit/dwelling time distributions for each of the
such a way as to be able to allow for performance compari-
supply chain segments, such as:
son between differing time periods.
Reliability Indicator (RI) – the ratio of the 95th percentile
To simplify the discussion, assume that the ultimate goal to the 5th percentile of transit/dwelling times (a high
is to compare quarterly and/or monthly performance data, RI indicates high volatility, whereas a low RI (≈ 1)
irrespective of the transit season, in order to determine how indicates a reliable corridor);
well the network is performing on the Shanghai → Port Buffer Index (BI) – the ratio of the positive difference be-
Metro Vancouver/Prince Rupert → Toronto corridor, say. tween the 95th percentile and the mean, to the mean.
A small BI (≈ 0) indicates only slight variability in
the upper (longer) transit/dwelling times; a large
BI indicates that the variability of the longer tran-
sit/dwelling times is high, and that outliers might be
found in that domain;
Coefficient of Variation (CV) – the ratio of the standard
deviation of transit/dwelling times to the mean tran-
sit/dwelling time.
trend;
seasonal component (seasonality, trading-day, moving-
Figure 5. Multi-modal supply chain. holiday), and
Figure 8. Diagnostic plots. Note that the analysis of a time series starts with estimation of the effects of festivals and trading days.
These pre-calculated estimates are then used for prior adjustment of the series. The prior adjusted original series is subsequently
analyzed using the seasonal adjustment.
Assume that for a testing set with d = FN + TP true outliers, Another supervised approach is to estimate the relative
an anomaly detection algorithm identifies m = FP + TP abnormality of various observations: it is usually quite
suspicious observations, of which n = TP are known to difficult to estimate the probability that an observation x1
be true outliers. Performance evaluation in this context is is anomalous with any certainty, but it might be possible
often measured using: to determine that it is more likely to be anomalous than
Precision – the proportion of true outliers among the sus- another observation x2 , say (denoted by x1 x2 ).
picious observations This paradigm allows the suspicious observations to be
ranked; let ki ∈ {1, . . . , m} be the rank of the i th true outlier,
n TP i ∈ {1, . . . , n}, in the sorted list of suspicious observations
p= = ;
m FP + TP
x1 xk1 · · · xki · · · xkn xm ;
when most of the points identified by the algorithm
are true outliers, p ≈ 1; the rank power of the algorithm is
Recall – the proportion of true outliers detected by the n(n + 1)
RP = Pn .
algorithm 2 i=1 ki
n TP
r= = ; When the d actual anomalies are ranked in (or near) the
d FN + TP
when most of the true outliers are identified by the top d suspicious observations, RP ≈ 1.
algorithm, r ≈ 1; Rank power is well-defined only when m ≥ d; as with
most performance evaluation metrics, a single raw number
F1 −Score – the harmonic mean of the algorithm’s precision is meaningless – it is in comparison with the performance
and its recall of other algorithms that it is most useful.
2pr 2TP
F1 = = ;
p+r 2TP + FP + FN On the unsupervised front, where anomalous/normal la-
bels are not known or used, if anomalies are those obser-
one drawback of precision, recall, and the F1 −score is
vations that are dissimilar to other observations, and if
that they do not incorporate TN in the evaluation pro-
clusters represent groupings of similar observations, then
cess, but this is unlikely to be problematic as regular
observations that do not naturally fit into a cluster could
observations that are correctly seen as unsuspicious
be potential anomalies (see Figure 10).
are not usually the observations of interest.9 ;
There are a number of challenges, not the least of which
Example 5. Consider a test dataset with 5000 observations, being that most clustering algorithms do not recognize po-
100 of which are anomalous. An algorithm which predicts tential outliers (DBSCAN is a happy exception) and that
all observations to be anomalous would score a = p = 0.02, some appropriate measure of similarity/dissimilarity of ob-
r = 1, and F1 ≈ 0.04, whereas an algorithm that detects 10 servations has to be agreed upon (different measures could
of the true outliers would score r = 0.1 (the other values lead to different cluster assignments).
would change according to the TN and FN counts).
9 Finally, it is worth mentioning that the definitions of terms
Nevertheless, the analyst for whom the full picture is important might
want to further evaluate the algorithm with the help of the Matthews like normal and anomalous are kept purposely vague, to
TN
Correlation Coefficient [32] or the specificity s = FP+TN . allow for flexibility.
Figure 10. Clusters of customers (red, green, blue) and potential anomalies/outliers (grey) in an artificial dataset.
The Jaccard similarity of two datasets P and Q, is defined 2.2 Density-Based Methods
as the size of their intersection divided by the size of their Density-based approaches, on the other hand, view points
union as anomalous if they occur in low density regions.
p q1
o q1 p q2
q2
subsets of D 15 end
16 Output: Anomaly score a(p) ∈ [0, 1] for each
p∈D
It can be desirable to construct a normalized anomaly score
that is independent of the size of the dataset. In order to
do this, the expected path length of a random point in an 3. Qualitative Methods of Anomaly Detection
Isolation Tree (i.e. binary tree) must be estimated. With
n = |D|, it can be shown that the expected length is New challenges are presented by non-numerical variables.
2(n − 1)
c(n) = 2H(n − 1) − , 3.1 Definitions and Challenges
n Categorical Variables
where H(n − 1) is the (n − 1)th harmonic number, which A categorical variable (or qualitative variable) is one whose
can be approximated by ln(n − 1) + 0.577; c(n) is then used levels are measured on a nominal scale; examples include
to normalize the final anomaly score a(p) for p ∈ D, which an object’s colour, the mother tongue of an individual, her
is given by favourite meal, and so forth.
The central tendency of the values of a categorical
average path length to p in the Isolation Trees variable is usually given by its mode; measures of spread
log2 a(p) = − .
c(n) are harder to define consistently (the proportion of levels
with more than a certain percentage of the observations
Thus defined, a(p) ∈ [0, 1], with a(p) ≈ 1 suggesting p is above a given threshold could be used as rough gauge, but
an anomaly, a(p) ≤ 0.5 suggesting p is a normal point; difficulties with this approach are readily apparent).
if all points receive a score around 0.5, this suggests that We often associate qualitative feature to numerical val-
there are no anomalies present. ues, but with the caveat that these should not be interpreted
as numerals; if we use the code “red” = 1 and “blond” = 2
Isolation Forests have small time and memory requirements; to represent hair colour, for instance, we obviously cannot
can handle high dimensional data, and do not need observa- conclude that “blond” > “red”, even though 2 > 1.
tions to have been labeled anomalies in the training set, but A categorical variable that has exactly two levels is
the anomaly score assigned to a given point can have high called a dichotomous feature (or a binairy variable); those
variance over multiple runs of the algorithm. The authors with more than two levels are called polytomous vari-
of [24] propose some solutions. ables.
determine whether xi should be considered an outlier or where S(X ` ; D \ O) is the set of levels that the `th feature
not: takes in D \ O.
m
1 X
AVFscore(xi ) = f (x i,` ),
m `=1 The "greedyAlg1" algorithm solves the optimization prob-
where f (x i,` ) is the number of observations xi for which lem as follows:
the `th feature takes on the level x i,` . A low AVF score
1. The set of outlying and/or anomalous observations
indicates that the observation is more likely to be an outlier.
OS is initially set to be empty, and all observations of
D \ OS are identified as normal (or regular).
Since AVFscore(xi ) is essentially a sum of m positive num-
bers, it is minimized when each of the sum’s term is mini- 2. Compute H(D \ OS).
mized, individually. Thus, the “ideal” anomalous observa-
tion described above minimizes the AVF score; the minimal 3. Scan the dataset in order to select a candidate anoma-
score is reached when each of the observation’s features’ lous observation: every normal observation x is tem-
levels occurs only once in the dataset. porarily taken out of D \ OS to create a subset Dx0 ,
whose entropy H(Dx0 ) is also computed.
As shown by the AVF pseudocode (see Algorithm 5), once
the AVF score is calculated for all points, the k outliers 4. The observation z which provides the maximal en-
returned by the algorithms are the k observations with the tropy impact, i.e. the one that minimizes
smallest AVF scores (the algorithm’s complexity is O (nm)).
H(D \ OS) − H(Dx0 ), x ∈ D \ OS,
Greedy Algorithm
The greedy algorithm “greedyAlg1” is an algorithm which is added to OS.
identifies the set OS of candidate anomalous observations
in an efficient manner. 5. Repeat steps 2-4 another k − 1 times to obtain a set
OS of k candidate anomalous observations.
The mathematical formulation of the problem is simple
– given a dataset D and a number k of anomalous observa- You can find more details in the in the source article [46];
tions to identify, we solve the optimization problem an interesting detail is that the complexity of the algorithm
is expected to be O (nmp), which implies that it is scalable.
OS = arg min{H(D \ O)}, subject to |O| = k,
O⊆D
then the loadings vector `2 (not correlated with `1 ) which Example 6. PCA is applied on a dataset of genetic ex-
maximizes the variance of Y2 , i.e. pression measurements, for n = 72 leukemia patients and
p = 7128 genes [47]. The scree plot suggests that only one
`2 = arg max `>2 X> X`2 .
k`2 k=1, `>1 `2 =0
principal component should be retained; the projection on
the first 3 principal components is also shown in Figure 15
Similarly, the loadings vector `k is not correlated with any (on the right). Some R code is given below.
of the `i , i < k, and maximizes the variance of Yk , i.e.
[Link] <-
`k = arg max `>k X> X`k .
(1) [Link]("[Link]
k`k k=1,
`>i `k =0, ∀ i<k CASI_files/DATA/leukemia_big.csv")
[Link] <- t([Link])
We solve (1) for all i < k through the Lagrangian [Link] <-
scale([Link])
L = `>k X> X`k − λk (`>k `k − 1) − w`>i `k .
[Link] <-
The critical points are found by differentiating with respect prcomp([Link])
to each of the entries of `k , λk and w, and setting the result plot([Link])
to 0. Simplifying, we obtain [Link].s <- summary([Link])
plot([Link].s$importance[3,])
X> X`k = λk `k
`>k `k = 1 et `>k `i = 0, for all i < k. There are other PCA-associated dimension reduction meth-
The loadings vector `k is thus the eigenvector of the design ods, such as the singular value decomposition, kernel PCA,
matrix X> X associated to the kth largest eigenvalue. and so forth; more details are available in [48].
The proportion of the variance which can be explained What is the link with anomaly and/or outlier detection?
by the PCA can be calculated by first noting that Once the dataset has been projected on a lower-dimensional
p p p
subspace, the curse of dimensionality is mitigated – it is on
the projected data that the traditional detection methods
X X X
Var (Yi ) = `>i Σ`i = λi .
i=1 i=1 i=1
are applied.
Note, however, that any such reduction necessarily leads
Consequently, the proportion of the total variance explained
to a loss of information, which can affect the accuracy of
by the ith principal component is
the detection procedure, especially if the presence/absence
λi of anomalies is not aligned with the dataset’s principal
0 ≤ Pp ≤1
components.
i=1 λi
The quality of the PCA results is strongly dependent on the Distance-Based Outlier Basis Using Neighbours
number of retained principal components, that is, on the Using PCA for anomaly detection is potentially problematic,
dimension k of the subspace on which the observations are however: whether an observation is anomalous or not does
projected. There are multiple ways to select the “right” k – not figure in the construction of the principal component
we will briefly present two of them. basis {PC1 , . . . , PCk } – there isn’t necessarily a correlation
between the axes of heightened variance and the presence
The proportion of the total variance explained by the first or absence of anomalies.
k principal components is given by
Pk The distance-based outlier basis using neighbours algo-
i=1 λi rithm (DOBIN) builds a basis which is better suited for the
pk = P p .
i=1 λi eventual detection of outlying observations. DOBIN’s main
One approach is to retain k principal components, where idea is to search for nearest neighbours that are in fact
k is the smallest value for which pk surpasses some pre- relatively distant from one another:
established threshold (often taken between 80% and 90%).
1. We start by building a space Y = {y` } which contains
M n(n + 1)/2 vectors of the form
The scree plot method, on the other hand, consists in
drawing the curve given by the decreasing eigenvalues (the y` = (xi − x j ) (xi − x j ),
scree plot), and to identify the curve’s “elbows”. These
points correspond to principal components for which the where is the element-by-element Hadamard multi-
variance decreases at a slower rate with added components. plication, and for which the 1−norm
If such an elbow exists, we would retain the eigenvalues up
to it (and thus, the corresponding principal components). ky` k1 = (x 1,1 − x 2,1 )2 + · · · + (x 1,p − x 2,p )2
Figure 15. Scree plot (left); projection on the first 3 principal components (right).
[19]
References Orchard, T., Woodbury, M. [1972], A Missing Infor-
[1]
mation Principle: Theory and Applications, Berkeley
Aggarwal, C.C. [2017], Outlier Analysis (2nd ed.), Symposium on Mathematical Statistics and Probability,
Springer. University of California Press.
[2]
Aggarwal, C. C. et YU, P. S. (2001). Outlier detection [20]
Torgo, L. [2017], Data Mining with R (2nd edition),
for high dimensional data. In ACM Sigmod Record, CRC Press.
pages 37–46. ACM. [21]
[3]
Chandola, V., Banerjee, A., Kumar, V. [2007], Outlier de-
Maimon, O., Rokach, L. [2010], Data Mining and tection: a survey, Technical Report TR 07-017, Depart-
Knowledge Discovery Handbook, Springer. ment of Computer Science and Engineering, University
[4]
Prasanta, G., et al. [2011], A Survey of Outlier De- of Minnesota.
tection Methods in Network Anomaly Identification. [22]
Hodge, V., Austin, J. [2004], A survey of outlier detec-
Oxford University Press, 54 (4), 570–588 tion methodologies, [Link]., 22(2):85-126.
[5]
Ranga, S.N.N.R., [2019], Outlier Detection: Tech- [23]
Height Percentile Calculator, by Age and Country,
niques and Applications: A Data Mining Perspective. on [Link]
Springer Nature Switzerland AG; 1st ed
[24]
[6]
Hariri, S., Kind, M. C., Brunner, R. J. [2018], Extended
Manish, G., et al., [2014], Outlier Detection for Tem- Isolation Forest, Computing Research Repository.
poral Data, IEEE Transactions on Knowledge and Data
[25]
Engineering 26(9), 2250–2267. Campello, R., Moulavi, D., Sander, J. [2013], Density-
[7] Based Clustering Based on Hierarchical Density Esti-
Kandanaarachchi, S., Hyndman, R.J. [2019], Dimen-
mates, Advances in Knowledge Discovery and Data
sion reduction for outlier detection using DOBIN,
Mining, Springer Berlin Heidelberg: 160–172.
Monash Business School.
[26]
[8] How HDBSCAN Works [2016] McInnes, L., Healy, J.,
Priyanga, D.T., et al., [2019], Anomaly detection in
Astels, S.
high-dimensional data.
[27]
[9] Findley, D.F., Hood, C.C., X-12-ARIMA and its Applica-
Aggarwal, C.C., Sathe, S. [2017], Outlier Ensembles,
tion to Some Italian Indicator Series, U.S. Bureau of
an Introduction, Springer.
the Census.
[10]
Aurore Archimbaud (2018). Détection non-supervisée [28]
Findley, D.F., Monsell, B.C., Bell, Otto and Chen [1998],
d’observations atypiques en contrôle de qualité : un
New Capabilities and Methods of the X-12-ARIMA Sea-
survol. Journal de la Société Française de Statistique,
sonal Adjustment Program, U.S. Bureau of the Census.
Vol. 159 No. 3 1-39
[29]
[11] An Introductory Course on Time Series Analysis, Aus-
Badr, W., 5 ways to detect outliers that every data
tralian Bureau of Statistics.
scientist should know, [Link]
[30]
[12] Seasonal Adjustment of Economic Time Series, Singa-
Mehrotra, K.G., Mohan, C.K., Huang, H. [2017],
pore Department of Statistics.
Anomaly Detection Principles and algorithms, Springer.
[31]
[13] [Link], [Link], Seasonal Adjustment Using The
Arora, L. [2019], An Awesome Tutorial to Learn Out-
X12 Procedure, SAS Institute.
lier Detection in Python using PyOD Library, on
[32]
Analitics Vidhya. Matthews Correlation Coefficient (MCC) on
[14] Wikipedia.
Santoyo, S. [2017], A Brief Overview of Outlier De-
[33]
tection Techniques, on [Link]. Principal Component Analysis on Wikipedia
[15] [34]
He, Z., Deng, S., Xu, X. [2005], A Unified Subspace Ruey S. Tsay [1988], level shifts, and variance changes
Outlier Ensemble Framework for Outlier Detection, in time series.
Advances in Web Age Information Management. [35]
Chen, C. and Liu, Lon-Mu (1993). Joint Estimation
[16]
Lazarevic, A., Kumar, V. [2005], Feature Bagging for of Model Parameters and Outlier Effects in Time Se-
Outlier Detection, ACM KDD Conference. ries. Journal of the American Statistical Association,
[17]
Fei, T.L., Ting, K.M., Zhou, Z.H. [2008], Isolation Forest, 88(421), pp. 284-297. doi: 10.2307/2290724
[36]
2008 Eighth IEEE International Conference on Data EOD data for all Dow Jones stocks
Mining: 413–422. [37]
Zhang, J., Lou, M., Ling, T. W. et Wang, H.(2004). Hos-
[18]
Ester, M., Kriegel, H.P., Sander, J., Xu, X. [1996], A miner : a system for detecting outlyting subspaces of
density-based algorithm for discovering clusters in high-dimensional data. In Proceedings of the Thirtieth
large spatial databases with noise, AAAI Press: 226– International Conference on Very Large Data Bases,
231. volume 30, pages 1265–1268. VLDB Endowment
[38]
Zimek, A., Kriegel, H.-P., Kröger, P., Schubert, E. (2009).
Outlier detection in axis-parallel subspaces of high di-
mensional data. In Pacific-Asia Conference on Knowl-
edge Discovery and Data Mining, pages 831–838.
Springer.
[39]
Kriegel H.-P. et al. (2000) "LOF: Identifying density-
based local outliers," in Proceedings of the ACM SIG-
MOD International Conference on Management of Data
(ACM, New York), pp. 93-104
[40]
Müller, E., Assent, I., Iglesias S, P., Mulle, Y. et Bohm,
K. (2012). Outlier ranking via subspace analysis in
multiple views of the data. In IEEE 12th International
Conference on Data Mining (ICDM), pages 529-538.
IEEE.
[41]
Müller, E., Assent, I., Steinhausen, U. et Seidl T. (2008).
OutRank : ranking outliers in high dimensional data.
In ICDEW 2008, IEEE 24th International Conference
on Data Engineering Workshop, pages 600–603. IEEE
[42]
Müller, E., Schiffer, M. et Seidl, T. (2010b). Adaptive
outlierness for subspace outlier ranking. In Proceedings
of the 19th ACM International Conference on Informa-
tion and Knowledge Management, pages 1629–1632.
ACM.
[43]
Müller, E., Schiffer, M. et Seidl T. (2011). Statistical
selection of relevant subspace projections for outlier
ranking. In IEEE 27th International Conference on Data
Engineering (ICDE), pages 434–445. IEEE.
[44]
Jian T., Zhixiang C., Ada W. F., David, W C., Capa-
bilities of outlier detection schemes inlarge datasets,
framework and methodologies, Springer-Verlag Lon-
don Limited 2006
[45]
ROC curve
[46]
He, Z., Xu, X., Deng, S. [2005], A Fast Greedy Algo-
rithm for Outlier Mining.
[47]
Hastie, T., Leukemia dataset.
[48]
Leduc, O., Macfie, A., Maheshwari, A., Pelletier, M.,
Boily, P. [2019], Feature Selection and Dimension Re-
duction, Data Science Report Series, Data Action Lab
blog.
[49]
Leduc, O., Boily, P. [2019], Boosting with AdaBoost
and Gradient Boosting, Data Action Lab blog.
[50]
Lei, X. [2020], Distributed LOF: Density-Sensitive
Anomaly Detection With MapReduce, on
[Link].
[51]
Krishna, G. [2020] Performing Real-time Anomaly
Detection using AWS, on [Link].
[52]
Baron, D. [2018], Outlier Detection, XXX Winter
School of Astrophysics on Big Data in Astronomy,
GitHub repository.
[53]
Baron, D. [2016], Outlier Detection Algorithm on
Galaxy Spectra, GitHub repository.
Cook's distance and Mahalanobis distance are statistical methods used to identify outliers. Cook's distance measures the influence of deleting a given observation, useful for identifying influential data points. Mahalanobis distance assesses how much a point deviates from a mean distribution, accounting for correlations between features . However, these methods require underlying assumptions about data distribution, and their effectiveness diminishes in high-dimensional contexts where observations become isolated . Adjustments or supplementary analyses may be needed to accurately identify outlier points under complex data conditions .
Graphical aids like boxplots, scatterplots, and scatterplot matrices play a crucial role in outlier detection by providing visual representations of data distribution, making it easier to spot deviations or anomalies . They are particularly suitable for low-dimensional settings where data can be effectively parsed visually without becoming overwhelming. Such aids facilitate intuitive understanding and immediate identification of outliers, which complex statistical models may not provide as transparently . In high-dimensional settings, graphical methods lose interpretability due to the sheer volume of data dimensions .
Supervised methods in anomaly detection rely on historical records of labeled anomalous observations to build models that estimate the probability of anomalies, requiring domain expertise to tag data . They are advantageous in situations where a labeled dataset is available, allowing precise model training and improved prediction accuracy. Unsupervised methods do not use labeled data, instead trying to detect anomalies based on structural properties of the data, such as observations dissimilar to others or not fitting into clusters . These methods are beneficial when labeled data is unavailable, enabling detection based on data distributions alone. However, precision may be lower compared to supervised methods .
The decomposition of time series data into seasonal and trend components aids anomaly detection by isolating the variance and periodic patterns from the data, leaving behind remainders that can be analyzed for anomalies . By removing predictable seasonal effects and long-term trends, anomalies can be detected more effectively, as they appear as deviations from what the decomposition predicts . This process enhances the ability of detection algorithms to distinguish true anomalies from regular fluctuations, making anomaly detection more accurate and insightful .
Interpretability in anomaly detection methods is critical for understanding the underlying reasons why certain observations are classified as anomalies, particularly in large and complex datasets. High dimensionality and data sparsity can obfuscate the patterns that lead to anomaly detection; thus, interpretable methods help bridge the gap between detecting anomalies and understanding their causative factors . This insight is essential for domain experts to take informed action, validate the detection system, and ensure the method's decisions are grounded in actual data behavior rather than artifacts of a black-box model .
Maximizing rank power is important because it evaluates an algorithm's ability to rank true anomalies highly among suspicious observations, thus reflecting its efficiency and reliability. It is calculated using the formula RP = n(n + 1) / 2 Σ (i=1 to n) k_i, where k_i is the rank of the ith true outlier in the sorted list of suspicious observations . A high rank power indicates that an algorithm can effectively prioritize the most anomalous data points, which is crucial for focusing investigative efforts and enhancing detection accuracy .
Anomaly detection in high-dimensional datasets encounters challenges because the notion of proximity loses relevance due to the curse of dimensionality. As the number of features increases, datasets become more sparse, making every point tend to be an outlier . This complicates conventional methods as they are inefficient under these conditions. To address these challenges, projection-based methods such as principal component analysis can reduce dimensionality while preserving essential characteristics . Additionally, methods should effectively manage sparse data issues, provide interpretability of discrepancies, allow comparison of anomaly measurements, and consider local data behavior .
'Rare occurrence problems' in anomaly detection arise because anomalies are statistically infrequent, leading to imbalances in labeled datasets used to train supervised models . This can make it challenging to develop accurate models, as the underrepresentation of anomalies may cause models to perform poorly at predicting novel anomalies. Techniques such as data resampling, assigning higher weights to anomalies, or synthetic generation of anomaly data can be used to mitigate these effects during training .
Directly removing outlying observations from datasets without careful analysis can lead analysts to discard influential data points that significantly affect analysis results. Such points may alter the conclusions drawn if excluded . Influential observations may not just be outliers but can provide insights into underlying patterns or issues. Remedial actions like data transformation should be considered instead of outright removal to mitigate undue effects without losing valuable information .
The 'curse of dimensionality' refers to phenomena that arise when analyzing and organizing data in high-dimensional spaces that do not occur in lower-dimensional settings. It complicates distance-based anomaly detection because, in high-dimensional spaces, observations tend to be scattered or sparse, reducing the relevance of distance metrics . Every point appears as an outlier because the separation between data points grows, thus making it challenging to identify true anomalies using conventional distance-based methods .