{"id":19745167,"url":"https://github.com/castle/tdigest","last_synced_at":"2025-07-21T08:32:49.440Z","repository":{"id":56896932,"uuid":"45959828","full_name":"castle/tdigest","owner":"castle","description":"Ruby implementation of Dunning's T-Digest for streaming quantile approximation","archived":false,"fork":false,"pushed_at":"2023-08-21T14:05:04.000Z","size":61,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-30T07:43:21.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/castle.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2015-11-11T04:32:00.000Z","updated_at":"2024-02-10T16:50:47.000Z","dependencies_parsed_at":"2024-06-21T07:09:53.797Z","dependency_job_id":"d4494816-ae29-4f7b-9d3e-8aa831891edb","html_url":"https://github.com/castle/tdigest","commit_stats":{"total_commits":58,"total_committers":4,"mean_commits":14.5,"dds":0.2586206896551724,"last_synced_commit":"be056cc9693d040f75902def26602d4d8d741623"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/castle/tdigest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Ftdigest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Ftdigest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Ftdigest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Ftdigest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/castle","download_url":"https://codeload.github.com/castle/tdigest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Ftdigest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266267290,"owners_count":23902334,"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","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-11-12T02:04:32.131Z","updated_at":"2025-07-21T08:32:49.422Z","avatar_url":"https://github.com/castle.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# t-digest Ruby\n\n[![Ruby CI](https://github.com/castle/tdigest/actions/workflows/specs.yml/badge.svg?branch=master)](https://github.com/castle/tdigest/actions/workflows/specs.yml)\n[![Gem Version](https://badge.fury.io/rb/tdigest.svg)](https://badge.fury.io/rb/tdigest)\n\nRuby implementation of Ted Dunning's [t-digest](https://github.com/tdunning/t-digest) data structure.\n\nInspired by the [Javascript implementation](https://github.com/welch/tdigest) by [Will Welch](https://github.com/welch)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'tdigest'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install tdigest\n\n## Usage\n\n```ruby\ntd = ::TDigest::TDigest.new\n1_000.times { td.push(rand) }\ntd.compress!\n\nputs td.percentile(0.5)\nputs td.p_rank(0.95)\n```\n\n#### Serialization\n\nThis gem offers the same serialization options as the original [Java implementation](https://github.com/tdunning/t-digest). You can read more about T-digest persistence in [Chapter 3 in the paper](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf).\n\n**Standard encoding**\n\nThis encoding uses 8-byte Double for the means and a 4-byte integer for counts. Size per centroid is a fixed 12-bytes.\n\n```ruby\nbytes = tdigest.as_bytes\n```\n\n**Compressed encoding**\n\nThis encoding uses delta encoding with 4-byte floats for the means and variable length encoding for the counts. Size per centroid is between 5-12 bytes.\n\n```ruby\nbytes = tdigest.as_small_bytes\n```\n\n**Deserializing**\n\nDeserialization will automatically detect compression format\n\n```ruby\n tdigest = TDigest::TDigest.from_bytes(bytes)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/castle/tdigest.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastle%2Ftdigest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcastle%2Ftdigest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastle%2Ftdigest/lists"}