{"id":13747342,"url":"https://github.com/ankane/trend-ruby","last_synced_at":"2025-11-17T14:16:20.533Z","repository":{"id":59158041,"uuid":"134663394","full_name":"ankane/trend-ruby","owner":"ankane","description":"Anomaly detection and forecasting for Ruby","archived":false,"fork":false,"pushed_at":"2025-04-04T00:21:51.000Z","size":38,"stargazers_count":137,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-17T13:03:09.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://trendapi.org","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-24T05:05:27.000Z","updated_at":"2025-08-28T17:39:21.000Z","dependencies_parsed_at":"2024-01-13T03:00:57.106Z","dependency_job_id":"fe98a576-9ef5-4ce0-b5ce-41e89d3564f4","html_url":"https://github.com/ankane/trend-ruby","commit_stats":null,"previous_names":["ankane/trend"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/trend-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrend-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrend-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrend-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrend-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/trend-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrend-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284894650,"owners_count":27080744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T06:01:25.594Z","updated_at":"2025-11-17T14:16:20.512Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","readme":"# Trend Ruby\n\nRuby client for [Trend](https://github.com/ankane/trend-api), the anomaly detection and forecasting API\n\n**Note: The [hosted version](https://trendapi.org/) is no longer available. [See how to run the API on your own infrastructure.](https://github.com/ankane/trend-api)**\n\n[![Build Status](https://github.com/ankane/trend-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/trend-ruby/actions)\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"trend\"\n```\n\nAnd set the URL to the API:\n\n```ruby\nTrend.url = \"http://localhost:8000\"\n```\n\n## Anomaly Detection\n\nDetect anomalies in a time series\n\n```ruby\n# generate series\nseries = {}\ndate = Date.parse(\"2025-01-01\")\n28.times do\n  series[date] = rand(100)\n  date += 1\nend\n\n# add an anomaly on Apr 21\nseries[date - 8] = 999\n\nTrend.anomalies(series)\n```\n\nWorks great with [Groupdate](https://github.com/ankane/groupdate)\n\n```ruby\nseries = User.group_by_day(:created_at).count\nTrend.anomalies(series)\n```\n\n## Forecasting\n\nGet future predictions for a time series\n\n```ruby\nseries = {}\ndate = Date.parse(\"2025-01-01\")\n28.times do\n  series[date] = date.wday\n  date += 1\nend\n\nTrend.forecast(series)\n```\n\nAlso works great with Groupdate\n\n```ruby\nseries = User.group_by_day(:created_at).count\nTrend.forecast(series)\n```\n\nSpecify the number of predictions to return\n\n```ruby\nTrend.forecast(series, count: 3)\n```\n\n## Correlation (Experimental)\n\nGet the correlation between two time series\n\n```ruby\nTrend.correlation(series, series2)\n```\n\n## History\n\nView the [changelog](https://github.com/ankane/trend-ruby/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/trend-ruby/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/trend-ruby/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development:\n\n```sh\ngit clone https://github.com/ankane/trend-ruby.git\ncd trend-ruby\nbundle install\nbundle exec rake test\n```\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Ftrend-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Ftrend-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Ftrend-ruby/lists"}