Learn everything about Analytics

‘Anomalize’ is a R Package that Makes Anomaly Detection in Time Series Extremely Simple and Scalable

, / 0


  • The ‘anomalize’ package makes it really easy and scalable to detect anomalies in your time series data
  • It has three functions – time_decompose(), anomalize(), and time_recompose()
  • It operates within the tidyverse universe



Anyone familiar with the machine learning world has been introduced to, or works with, time series forecasting. It’s one of the most popular fields and has diverse and vast applications.

But actually performing a time series analysis is not a straightforward task. Even with the packages currently available, there is still a bit of work that goes into making a time series model ready for the eventual analysis and for building a model. With the manual effort that goes in, the chances of missing anomalies and making errors increases.

The ‘anomalize’ package makes it really simple, easy and scalable to detect anomalies in your data. It has three functions (mentioned in this article below) and together, they make it a straightforward process to decompose, the given time series, detect any anomalies, and finally create “bands” that separate the normal data from the anomalous one.

The package has three main functions, namely:

  • time_decompose(): Separates the time series data into seasonal, trend, and remainder components
  • anomalize(): This applies anomaly detection methods to the remainder component
  • time_recompose(): This calculates limits that separate the expected normal data from the anomalies

In order to use this package, you need to have the tidyverse package installed and loaded as well. You can install the ‘anomalize’ package either from devtools:

# devtools::install_github("business-science/anomalize")

or from the CRAN itself:


You can check out the GitHub repository here and view the below video for further details on this package.


Our take on this

There have been packages built for anomaly detection previously, namely Twitter’s AnomalyDetection and the tsoutliers() packages. But ‘anomalize’ takes that to the next level by making it even more simpler and scalable within the tidyverse universe.

The developers have mentioned that they are also looking into the possibility of making a python library for this. The initial reaction in the ML community has been extremely positive. This is a brilliant tool for QA analysis in any field, from marketing to manufacturing. Go ahead and try it out.


Subscribe to AVBytes here to get regular data science, machine learning and AI updates in your inbox!