{"id":13416500,"url":"https://github.com/stripe/rainier","last_synced_at":"2025-06-21T17:08:24.674Z","repository":{"id":47694800,"uuid":"124964747","full_name":"stripe/rainier","owner":"stripe","description":"Bayesian inference in Scala.","archived":false,"fork":false,"pushed_at":"2023-05-12T11:47:28.000Z","size":5722,"stargazers_count":435,"open_issues_count":31,"forks_count":44,"subscribers_count":32,"default_branch":"develop","last_synced_at":"2025-06-07T23:53:07.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rainier.fit","language":"Scala","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/stripe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-12T23:35:29.000Z","updated_at":"2025-05-04T20:15:44.000Z","dependencies_parsed_at":"2022-09-26T19:52:39.357Z","dependency_job_id":"db9c87ad-fceb-495a-b9e7-a6fdd57617be","html_url":"https://github.com/stripe/rainier","commit_stats":{"total_commits":949,"total_committers":26,"mean_commits":36.5,"dds":0.4077976817702845,"last_synced_commit":"92695bffdc3b1a899019634f8d8b57c8b379efdd"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/stripe/rainier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Frainier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Frainier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Frainier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Frainier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stripe","download_url":"https://codeload.github.com/stripe/rainier/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Frainier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261162073,"owners_count":23118221,"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-07-30T21:00:59.806Z","updated_at":"2025-06-21T17:08:19.659Z","avatar_url":"https://github.com/stripe.png","language":"Scala","funding_links":[],"categories":["Scala","人工智能"],"sub_categories":[],"readme":"![Mt. Rainier with lenticular clouds (credit: US National Park Service)](rainier.jpg)\n\n# Rainier\n\nRainier provides a high-performance Scala API for bayesian inference via Markov Chain Monte Carlo.\n\nRainier supports fixed-structure generative models with continuous parameters. Models are built using idiomatic, functional Scala to compose primitive distributions and mathematical transformations. Once built, you can condition the model on observed data to infer a posterior distribution over the parameter values, and then use that posterior distribution to generate decisions and predictions.\n\nUnderlying this high-level API is a static, TensorFlow-style compute graph with auto-differentiation and very fast CPU-based execution.\n\nRainier is implemented in pure Scala, with minimal external dependencies and no JNI libs, and as such is convenient to deploy, including to Spark or Hadoop clusters.\n\nInference is based on variants of the `Hamiltonian Monte Carlo` sampler; similar to, and targeting the same types of models as, both [Stan](http://mc-stan.org/) and [PyMC3](https://github.com/pymc-devs/pymc3). Depending on your background, you might think of Rainier as aspiring to be either \"Stan, but on the JVM\", or \"TensorFlow, but for small data\".\n\n## Example\n\nHere's what it looks like to fit a simple linear regression in Rainier:\n\n```scala\nval xs: List[(Double, Double, Double)] = ???\nval ys: List[Double] = ???\n\nval sigma = Exponential(1).latent\nval alpha = Normal(0,1).latent\nval betas = Normal(0,1).latentVec(3)\n\nval model = Model.observe(ys, Vec.from(xs).map{\n     case (u, v, w) =\u003e \n     val mu = alpha + Vec(u,v,w).dot(betas)\n     Normal(mu, sigma)\n})\n```\n\n## Getting Started and Documentation\n\nThere's a detailed overview and reference documentation at [rainier.fit](https://rainier.fit/docs/intro).\n\n## Performance and Scale\n\nRainier requires that all of the observations or training data for a given model fit comfortably into RAM on a single machine. It does not make use of GPUs or of SIMD instructions.\n\nWithin those constraints, however, it is extremely fast. Rainier takes advantage of knowing all of your data ahead of time by aggressively precomputing as much as it can, which can be a significant practical benefit relative to systems that compile a data-agnostic model. It produces optimized, unboxed, JIT-friendly JVM bytecode for all numerical calculations. This compilation happens in-process and is fast enough for interactive use at a REPL.\n\nFor example, on a MacBook Pro, gradient evaluation for Neal's funnel takes under a microsecond, and end-to-end compilation and sampling for 10,000 iterations of HMC with 5 leapfrog steps each takes around 50ms.\n\nOur benchmarking shows that you should expect gradient evaluation to be roughly on par with Stan (some models will be faster, some will be slower). However, please note that Stan currently has a more sophisticated dynamic HMC implementation that may well produce more effective samples per second (at least if you ignore the lengthy C++ compilation times).\n\n## Authors\n\nRainier's primary author is [Avi Bryant](http://twitter.com/avibryant) with major contributions from [Mio Alter](https://twitter.com/mioalter) and Andrew Metcalf. Many thanks also for contributions and support from:\n * Christian Anderson\n * Alex Beal\n * Arthur Bit-Monnot\n * Travis Brown\n * Peadar Coyle\n * Mike Heaton\n * Grzegorz Kossakowski\n * Roban Kramer\n * Jonny Law\n * Michael Manapat\n * Alan O'Donnell\n * Adam Reese\n * Sam Ritchie\n * David Rodriguez\n * Andy Scott\n * Aaron Steele\n * Andrew Valencik\n * Kai(luo) Wang\n * Darren Wilkinson\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe%2Frainier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstripe%2Frainier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe%2Frainier/lists"}