R implementation of algorithms for detection of outliers based on frequent pattern mining.
If you would like to cite our work, please use:
@InProceedings{kuchar:2017:FPI,
title = {Spotlighting Anomalies using Frequent Patterns},
author = {Jaroslav Kuchař and Vojtěch Svátek},
booktitle = {Proceedings of the KDD 2017 Workshop on Anomaly Detection in Finance},
year = {2017},
volume = {71},
series = {Proceedings of Machine Learning Research},
address = {Halifax, Nova Scotia, Canada},
month = {14 Aug},
publisher = {PMLR},
issn = {1938-7228}
}
Available implementations:
- FPI, WFPI - Frequent Pattern Isolation, Weighted Frequent Pattern Isolation
- J. Kuchar, V. Svatek: Spotlighting Anomalies using Frequent Patterns, Proceedings of the KDD 2017 Workshop on Anomaly Detection in Finance, Halifax, Nova Scotia, Canada, PMLR, 2017. link
- FPCOF - Frequent Pattern Contradiction Outlier Factor
- X. Tang, G. Li and G. Chen, "Fast Detecting Outliers over Online Data Streams," 2009 International Conference on Information Engineering and Computer Science, Wuhan, 2009, pp. 1-4. link
- FPOF - Frequent Pattern Outlier Factor
- He, Z., Xu, X., Huang, J. Z., Deng, S.: FP-Outlier: Frequent Pattern Based Outlier Detection. Computer Science and Information Systems, Vol. 2, No. 1, 103-118. (2005). link
- LFPOF - L. Frequent Pattern Outlier Factor
- W. Zhang, J. Wu and J. Yu, "An Improved Method of Outlier Detection Based on Frequent Pattern," Information Engineering (ICIE), 2010 WASE International Conference on, Beidaihe, Hebei, 2010, pp. 3-6. link
- MFPOF - Maximal Frequent Pattern Outlier Factor
- Feng Lin, Wang Le, Jin Bo - Research on Maximal Frequent Pattern Outlier Factor for Online HighDimensional Time-Series Outlier Detection. Journal of Convergence Information Technology 5(10):66-71 · December 2010. link
- WCFPOF - Weighted Closed Frequent Pattern Outlier Factor
- Jiadong Ren, Qunhui Wu, Changzhen Hu, and Kunsheng Wang. 2009. An Approach for Analyzing Infrequent Software Faults Based on Outlier Detection. In Proceedings of the 2009 International Conference on Artificial Intelligence and Computational Intelligence - Volume 04 (AICI '09), Vol. 4. IEEE Computer Society, Washington, DC, USA, 302-306. link
- WFPOF - Weighted Frequent Pattern Outlier Factor
- ZHOU Xiao-Yun+, SUN Zhi-Hui, ZHANG Bai-Li, YANG Yi-Dong - A Fast Outlier Detection Algorithm for High Dimensional Categorical Data Streams. Journal of Software 18(4) · April 2007. link
The package is available in CRAN repository:
install.packages('fpmoutliers',dependencies=TRUE, repos="http://cran.us.r-project.org")
Package installation from GitHub:
library("devtools")
devtools::install_github("jaroslav-kuchar/fpmoutliers")
library(fpmoutliers)
dataFrame <- read.csv(system.file("extdata", "fp-outlier-customer-data.csv", package = "fpmoutliers"))
model <- FPI(dataFrame, minSupport = 0.001)
dataFrame <- dataFrame[order(model$scores, decreasing = TRUE),]
print(dataFrame[1,]) # instance with the highest anomaly score
print(dataFrame[nrow(dataFrame),]) # instance with the lowest anomaly score
Currently not suitable for large datasets - the plot is limited by the number of rows and columns of the input data.
library("fpmoutliers")
dataFrame <- read.csv(
system.file("extdata", "fp-outlier-customer-data.csv", package = "fpmoutliers"))
model <- FPI(dataFrame, minSupport = 0.001)
# sort data by the anomaly score
dataFrame <- dataFrame[order(model$scores, decreasing = TRUE),]
visualizeInstance(dataFrame, 1) # instance with the highest anomaly score
visualizeInstance(dataFrame, nrow(dataFrame)) # instance with the lowest anomaly score
library("fpmoutliers")
dataFrame <- read.csv(
system.file("extdata", "fp-outlier-customer-data.csv", package = "fpmoutliers"))
model <- FPI(dataFrame, minSupport = 0.001)
# sort data by the anomaly score
dataFrame <- dataFrame[order(model$scores, decreasing = TRUE),]
# instance with the highest anomaly score
out <- describeInstance(dataFrame, model, 1)
# instance with the lowest anomaly score
out <- describeInstance(dataFrame, model, nrow(dataFrame))
library("fpmoutliers")
data("iris")
model <- fpmoutliers::build(iris)
- Kuchar, Jaroslav et al. “Outlier (Anomaly) Detection Modelling in PMML.” RuleML+RR (2017).
library(fpmoutliers)
library(XML)
dataFrame <- read.csv(system.file("extdata", "fp-outlier-customer-data.csv", package = "fpmoutliers"))
model <- FPI(dataFrame, minSupport = 0.001)
saveXML(generatePMML(model, dataFrame), "example_out.xml")
All implemented methods return a list with following parameters:
minSupport
- minimum support setting for frequent itemsets miningmaxlen
- maximum length of frequent itemsetsmodel
- frequent itemset model represented as itemsets-classscores
- outlier/anomaly scores for each observation/row of the input dataframe
- Jaroslav Kuchař (https://github.com/jaroslav-kuchar)
Apache License Version 2.0