Skip to content

Repository files navigation

Trend Ruby

Ruby client for Trend, the anomaly detection and forecasting API

Note: The hosted version is no longer available. See how to run the API on your own infrastructure.

Build Status

Installation

Add this line to your application’s Gemfile:

gem"trend"

And set the URL to the API:

Trend.url="http://localhost:8000"

Anomaly Detection

Detect anomalies in a time series

# generate seriesseries={}date=Date.parse("2026-01-01")28.timesdoseries[date]=rand(100)date += 1end# add an anomaly on Apr 21series[date - 8]=999Trend.anomalies(series)

Works great with Groupdate

series=User.group_by_day(:created_at).countTrend.anomalies(series)

Forecasting

Get future predictions for a time series

series={}date=Date.parse("2026-01-01")28.timesdoseries[date]=date.wdaydate += 1endTrend.forecast(series)

Also works great with Groupdate

series=User.group_by_day(:created_at).countTrend.forecast(series)

Specify the number of predictions to return

Trend.forecast(series,count: 3)

Correlation (Experimental)

Get the correlation between two time series

Trend.correlation(series,series2)

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/trend-ruby.git
cd trend-ruby
bundle install
bundle exec rake test

About

Anomaly detection and forecasting for Ruby

Resources

Stars

138 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages