{"id":15451506,"url":"https://github.com/davidar/polya","last_synced_at":"2025-07-23T16:32:27.586Z","repository":{"id":8079523,"uuid":"9492669","full_name":"davidar/polya","owner":"davidar","description":"Hierarchical Bayesian Nonparametrics (Python/C++)","archived":false,"fork":false,"pushed_at":"2021-05-30T03:21:42.000Z","size":37181,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-25T00:03:25.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/davidar.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}},"created_at":"2013-04-17T08:17:39.000Z","updated_at":"2024-02-03T10:22:21.000Z","dependencies_parsed_at":"2022-09-25T06:10:58.150Z","dependency_job_id":null,"html_url":"https://github.com/davidar/polya","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidar/polya","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidar%2Fpolya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidar%2Fpolya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidar%2Fpolya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidar%2Fpolya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidar","download_url":"https://codeload.github.com/davidar/polya/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidar%2Fpolya/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266713441,"owners_count":23972921,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-10-01T21:27:18.752Z","updated_at":"2025-07-23T16:32:27.472Z","avatar_url":"https://github.com/davidar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](pyphmm.png)\n\n**Polya** is a Python/C++ library for performing inference with [Pólya urn models](https://en.wikipedia.org/wiki/Polya_urn_model) (including [Chinese restaurant processes](https://en.wikipedia.org/wiki/Chinese_restaurant_process)) with an emphasis on (hierarchical) [Pitman-Yor processes](https://en.wikipedia.org/wiki/Pitman-Yor_process), although [Dirichlet processes](https://en.wikipedia.org/wiki/Dirichlet_process) and [Dirichlet-multinomial](https://en.wikipedia.org/wiki/Dirichlet-multinomial_distribution) (and [Beta-binomial](https://en.wikipedia.org/wiki/Beta-binomial_distribution)) models could be handled as special cases with minor modifications. Nonparametric mixture modelling is also partially supported (only when the number of components is bounded, for now).\n\nExample implementations of the [hierarchical Pitman-Yor language model (HPYLM)](http://dx.doi.org/10.3115/1220175.1220299), the [doubly-HPYLM (DHPYLM)](http://jmlr.org/proceedings/papers/v5/wood09a.html), and the [PYP-HMM](http://aclweb.org/anthology/P11-1087) are also provided:\n\n    $ cd data \u0026\u0026 python brown.py \u0026\u0026 python sou.py \u0026\u0026 cd ..\n    $ ./hpylm.py \u003c data/brown.reduc.txt \u003e hpylm.log\n    Perplexity: 231.818141085\n    $ cat data/{sou.norm.train,brown.norm,sou.norm.test}.txt | \\\n        ./hpylm.py 3 `wc -w \u003c data/sou.norm.test.txt` \u003e union.log\n    Perplexity: 169.793801556\n    $ ./dhpylm.py 3 data/{sou.norm.test,sou.norm.train,brown.norm}.txt \u003e dhpylm.log\n    Perplexity: 159.532152794\n    $ ./pyphmm.py \u003c data/brown.tagged.simp.txt \u003e pyphmm.log\n    M-1: 81.1001970389\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidar%2Fpolya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidar%2Fpolya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidar%2Fpolya/lists"}