🔥 BreakoutDetection for Ruby
Learn how it works
Add this line to your application’s Gemfile:
gem"breakout-detection"Detect breakouts in a time series
series={Date.parse("2026-01-01")=>100,Date.parse("2026-01-02")=>150,Date.parse("2026-01-03")=>136,# ...}Breakout.detect(series)Works great with Groupdate
series=User.group_by_day(:created_at).countBreakout.detect(series)Series can also be an array without times (the index is returned)
series=[100,150,136, ...]Breakout.detect(series)Pass options - default values below
Breakout.detect(series,min_size: 30,# minimum observations between breakoutsmethod: "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))Add Vega to your application’s Gemfile:
gem"vega"And use:
Breakout.plot(series,breakouts)This library uses the C++ code from the BreakoutDetection R package and is available under the same license.
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
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