ankane / breakout-ruby

Breakout detection for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does this work?

ejstembler opened this issue · comments

Hi, thanks for releasing this! I didn't see a discussions tab, so I'm posting my question here.

I have a series with 2,590 entries. It consists of a UTC time and an integer value. Something like this:

require 'time'
require 'breakout-detection'

series = {
  Time.parse('2021-09-22T11:58:37Z') => 301590765,
  Time.parse('2021-09-22T12:05:15Z') => 9421127680,
  Time.parse('2021-09-22T12:25:32Z') => 301590765,
  # ...
}

results = Breakout.detect(series)
# results=[]

Most of the values are in the range of 300,000,000, however, one value is 9,421,127,680. Should the breakout detect the 9 million value? Currently, it's returning an empty array.

Am I doing something wrong? Should I change a default setting?

Thanks!

Hey @ejstembler, the min_size option determines the minimum size of a breakout (30 by default). A single anomaly isn't a considered a breakout.

@ankane Thanks. I actually found another repo of yours which worked out: OutlierTree:

model = OutlierTree.new
model.fit(data)
results = model.outliers(data)

puts results[:explanation]
# "meters (9421127680) looks high"

Thanks for creating these!

Great. For time series anomaly detection (which takes into account seasonality and trend), also check out AnomalyDetection.rb (just released).