No release in over a year
Breakout detection for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.0.2
 Project Readme

Breakout Ruby

🔥 BreakoutDetection for Ruby

Learn how it works

Build Status

Installation

Add this line to your application’s Gemfile:

gem "breakout-detection"

Getting Started

Detect breakouts in a time series

series = {
  Date.parse("2025-01-01") => 100,
  Date.parse("2025-01-02") => 150,
  Date.parse("2025-01-03") => 136,
  # ...
}

Breakout.detect(series)

Works great with Groupdate

series = User.group_by_day(:created_at).count
Breakout.detect(series)

Series can also be an array without times (the index is returned)

series = [100, 150, 136, ...]
Breakout.detect(series)

Options

Pass options - default values below

Breakout.detect(
  series,
  min_size: 30,        # minimum observations between breakouts
  method: "multi",     # multi or amoc (at most one change)
  degree: 1,           # degree of the penalization polynomial (multi only)
  beta: 0.008,         # penalization term (multi only)
  percent: nil,        # minimum percent change in goodness of fit statistic (multi only)
  alpha: 2,            # weight of the distance between observations (amoc only)
  exact: true          # exact or approximate median (amoc only)
)

Plotting

Add Vega to your application’s Gemfile:

gem "vega"

And use:

Breakout.plot(series, breakouts)

Credits

This library uses the C++ code from the BreakoutDetection R package and is available under the same license.

References

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/breakout-ruby.git
cd breakout-ruby
bundle install
bundle exec rake compile
bundle exec rake test