Ir para conteúdo
Faça parte da equipe! (2024) ×

Linguagem R - Pacote AnomalyDetection


Arkanun1000
 Compartilhar

Posts Recomendados

  • Velha Guarda

Pacote AnomalyDetection – Linguagem R

 

r-logo.png

 

Pacote AnomalyDetection – Linguagem R

 

 

AnomalyDetection é um pacote de R open-source para detectar anomalias a partir de um ponto de vista estatístico, na presença de sazonalidade e uma tendência subjacente. O pacote AnomalyDetection pode ser usado em grande variedade de contextos. Por exemplo, a detecção de anomalias em métricas do sistema após uma nova versão de software, o envolvimento do usuário postar um teste A / B, ou por problemas na econometria, engenharia financeira, política e ciências sociais.

 

 

 

How the package works

The underlying algorithm – referred to as Seasonal Hybrid ESD (S-H-ESD) builds upon the Generalized ESD test for detecting anomalies. Note that S-H-ESD can be used to detect both global as well as local anomalies. This is achieved by employing time series decomposition and using robust statistical metrics, viz., median together with ESD. In addition, for long time series (say, 6 months of minutely data), the algorithm employs piecewise approximation – this is rooted to the fact that trend extraction in the presence of anomalies in non-trivial – for anomaly detection.

 

Besides time series, the package can also be used to detect anomalies in a vector of numerical values. We have found this very useful as many times the corresponding timestamps are not available. The package provides rich visualization support. The user can specify the direction of anomalies, the window of interest (such as last day, last hour), enable/disable piecewise approximation; additionally, the x- and y-axis are annotated in a way to assist visual data analysis.

 

How to get started

Install the R package using the following commands on the R console:

 

É necessário se cadastrar para acessar o conteúdo.

 

The function AnomalyDetectionTs is called to detect one or more statistically significant anomalies in the input time series. The documentation of the function AnomalyDetectionTs, which can be seen by using the following command, details the input arguments and the output of the function AnomalyDetectionTs.

 


help(AnomalyDetectionTs)
É necessário se cadastrar para acessar o conteúdo.

 

A simple example

To get started, the user is recommended to use the example dataset which comes with the packages. Execute the following commands:

 


data(raw_data)
res = AnomalyDetectionTs(raw_data, max_anoms=0.02, direction='both', plot=TRUE)
res$plot
É necessário se cadastrar para acessar o conteúdo.

 

Often, anomaly detection is carried out on a periodic basis. For instance, at times, one may be interested in determining whether there was any anomaly yesterday. To this end, we support a flag only_last whereby one can subset the anomalies that occurred during the last day or last hour. Execute the following command:

 


res = AnomalyDetectionTs(raw_data, max_anoms=0.02, direction='both', only_last=”day”, plot=TRUE)
res$plot

 

 

Fig2.png

 

From the plot, we observe that only the anomalies that occurred during the last day have been annotated. Further, the prior six days are included to expose the seasonal nature of the time series but are put in the background as the window of prime interest is the last day.

 

 

Anomaly detection for long duration time series can be carried out by setting the longterm argument to T.

 

Copyright and License

Copyright 2015 Twitter, Inc and other contributors

 

Licensed under the GPLv3

 

Link: https://github.com/twitter/AnomalyDetection

 

 

 

qRXaV1L.png

Link para o comentário
Compartilhar em outros sites

Este tópico está impedido de receber novos posts.
 Compartilhar

×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.