Frequent Pattern Mining Outliers

Algorithms for detection of outliers based on frequent pattern mining. Such algorithms follow the paradigm: if an instance contains more frequent patterns, it means that this data instance is unlikely to be an anomaly (He Zengyou, Xu Xiaofei, Huang Zhexue Joshua, Deng Shengchun (2005) ). The package implements a list of existing state of the art algorithms as well as other published approaches: FPI, WFPI, FPOF, FPCOF, LFPOF, MFPOF, WCFPOF and WFPOF.

Build Status

R implementation of algorithms for detection of outliers based on frequent pattern mining.

If you would like to cite our work, please use:

  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

Development Version Installation

Package installation from GitHub:



Basic example

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

Experimental explanations

Graphical explanation using bar plots

Currently not suitable for large datasets - the plot is limited by the number of rows and columns of the input data.

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

Textual explanation

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))

Other available functionalities

Experimental automatic build

model <- fpmoutliers::build(iris)

Save the model to an experimental PMML format

  • Kuchar, Jaroslav et al. “Outlier (Anomaly) Detection Modelling in PMML.” RuleML+RR (2017).
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")

Model Output

All implemented methods return a list with following parameters:

  • minSupport - minimum support setting for frequent itemsets mining
  • maxlen - maximum length of frequent itemsets
  • model - frequent itemset model represented as itemsets-class
  • scores - outlier/anomaly scores for each observation/row of the input dataframe


  • Jaroslav Kuchař (


Apache License Version 2.0


fpmoutliers 0.1.0 (Release date: 2017-11-03)


  • Peformance modification of anomaly scores computations
  • Updates of the documentation

fpmoutliers 0.0.1 (Release date: 2016-10-05)


  • Initial version of fpmoutliers

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.0 by Jaroslav Kuchar, 2 years ago

Report a bug at

Browse source code at

Authors: Jaroslav Kuchar [aut, cre]

Documentation:   PDF Manual  

Apache License (== 2.0) | file LICENSE license

Imports pmml, XML, Matrix, R.utils, arules, foreach, doParallel, parallel, methods, pryr

Suggests testthat

See at CRAN