{"id":13879407,"url":"https://github.com/ankane/midas-ruby","last_synced_at":"2025-11-17T14:09:37.041Z","repository":{"id":56883567,"uuid":"241294616","full_name":"ankane/midas-ruby","owner":"ankane","description":"Edge stream anomaly detection for Ruby","archived":false,"fork":false,"pushed_at":"2025-06-16T19:21:11.000Z","size":59,"stargazers_count":54,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-09T10:20:21.084Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"2020-02-18T07:04:38.000Z","updated_at":"2025-06-16T19:21:14.000Z","dependencies_parsed_at":"2024-10-03T12:10:33.673Z","dependency_job_id":"49e53aa1-adaa-4053-a3e5-a4714da046d2","html_url":"https://github.com/ankane/midas-ruby","commit_stats":{"total_commits":69,"total_committers":1,"mean_commits":69.0,"dds":0.0,"last_synced_commit":"dbd40d9ff11592663c5722209c5995f1a9904e72"},"previous_names":["ankane/midas"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/midas-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmidas-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmidas-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmidas-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmidas-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/midas-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmidas-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284893768,"owners_count":27080578,"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-06T08:02:20.008Z","updated_at":"2025-11-17T14:09:37.025Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","readme":"# MIDAS Ruby\n\n[MIDAS](https://github.com/bhatiasiddharth/MIDAS) - edge stream anomaly detection - for Ruby\n\n[![Build Status](https://github.com/ankane/midas-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/midas-ruby/actions)\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"midas-edge\"\n```\n\n## Getting Started\n\nPrep your data in the format `[source, destination, time]` (all integers) and sorted by time (ascending)\n\n```ruby\ndata = [\n  [2, 3, 1],\n  [3, 4, 2],\n  [5, 9, 2],\n  [2, 3, 3]\n]\n```\n\nGet anomaly scores\n\n```ruby\nmidas = Midas.new\nscores = midas.fit_predict(data)\n```\n\nHigher scores are more anomalous. There is [not currently](https://github.com/bhatiasiddharth/MIDAS/issues/4) a defined threshold for anomalies.\n\n## Parameters\n\nPass parameters - default values below\n\n```ruby\nMidas.new(\n  rows: 2,           # number of hash functions\n  buckets: 769,      # number of buckets\n  alpha: 0.5,        # temporal decay factor\n  threshold: nil,    # todo\n  relations: true,   # whether to use MIDAS-R or MIDAS\n  directed: true,    # treat the graph as directed or undirected\n  seed: 0            # random seed\n)\n```\n\n## Data\n\nData can be an array of arrays\n\n```ruby\n[[1, 2, 3], [4, 5, 6]]\n```\n\nOr a Numo array\n\n```ruby\nNumo::NArray.cast([[1, 2, 3], [4, 5, 6]])\n```\n\n## Performance\n\nFor large datasets, read data directly from files\n\n```ruby\nmidas.fit_predict(\"data.csv\")\n```\n\n## Resources\n\n- [MIDAS: Microcluster-Based Detector of Anomalies in Edge Streams](https://www.comp.nus.edu.sg/~sbhatia/assets/pdf/midas.pdf)\n\n## History\n\nView the [changelog](https://github.com/ankane/midas-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/midas-ruby/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/midas-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 --recursive https://github.com/ankane/midas-ruby.git\ncd midas-ruby\nbundle install\nbundle exec rake compile\nbundle exec rake test\n```\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fmidas-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Fmidas-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fmidas-ruby/lists"}