{"id":16826472,"url":"https://github.com/benwiederhake/sample_convex_combinations","last_synced_at":"2026-05-18T15:36:41.138Z","repository":{"id":149598575,"uuid":"234587101","full_name":"BenWiederhake/sample_convex_combinations","owner":"BenWiederhake","description":"Samples from convex combination space","archived":false,"fork":false,"pushed_at":"2020-06-20T19:37:32.000Z","size":2017,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-15T00:32:44.579Z","etag":null,"topics":["combination","convex","distribution","probability","sampler","sampling"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/BenWiederhake.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-17T16:17:55.000Z","updated_at":"2020-06-20T19:37:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc85a90f-1f44-41ad-a18d-367fb2e7746b","html_url":"https://github.com/BenWiederhake/sample_convex_combinations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BenWiederhake/sample_convex_combinations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWiederhake%2Fsample_convex_combinations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWiederhake%2Fsample_convex_combinations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWiederhake%2Fsample_convex_combinations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWiederhake%2Fsample_convex_combinations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenWiederhake","download_url":"https://codeload.github.com/BenWiederhake/sample_convex_combinations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWiederhake%2Fsample_convex_combinations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33183173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["combination","convex","distribution","probability","sampler","sampling"],"created_at":"2024-10-13T11:17:30.336Z","updated_at":"2026-05-18T15:36:41.121Z","avatar_url":"https://github.com/BenWiederhake.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ABANDONED\n\n# sample_convex_combinations\n\n\u003e Samples from convex combination space.\n\nIn theory this module \"only\" provides a bit of math.\nIn practice, it's a useful piece of abstraction.\n\nThis module provides a function that pickes a convex combination of a\ndesired dimension (= number of items), uniformly distributed among all\nconvex combinations. It is possible supply your own RNG, or a\nhand-picked point from a hypercube (uniform distribution in the\nhypercube guarantees uniform distribution in \"convex\ncombination\"-space).\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [TODOs](#todos)\n- [Contribute](#contribute)\n\n## Install\n\nJust `pip install sample_convex_combinations`. (As soon as I have uploaded it to PyPI.)\n\nOr just copy `sample_convex_combinations/_impl.py` into your project as `sample_convex_combinations.py`.\n\nThere are no dependencies outside stdlib.\n\n## Usage\n\nLet's say you want to interpolate between three things, and wish the sum of the weights to be 1:\n\n```\n\u003e\u003e\u003e import sample_convex_combinations\n\u003e\u003e\u003e sample_convex_combinations.sample(3)\n[0.6847422669970515, 0.6847422669970515, 0.6847422669970515]  # FIXME\n```\n\nOr maybe you want the sum of the weights to be between 0 and 1:\n\n```\n\u003e\u003e\u003e sample_convex_combinations.sample(3, span_origin=True)\n[0.49931160565103394, 0.49931160565103394, 0.49931160565103394]  # FIXME\n```\n\nThe default `random.random` is not enough for your needs?  Sure thing!\nYou can substitute your own RNG, for example from `secrets`:\n\n```\n\u003e\u003e\u003e import secrets\n\u003e\u003e\u003e sample_convex_combinations.sample(3, rng=secrets.randbits(64) / (2 ** 64))\n[0.49931160565103394, 0.49931160565103394, 0.49931160565103394]  # FIXME\n```\n\nIsn't that nice? :D\n\n### Full documentation\n\nFIXME\n\n## TODOs\n\n* Implement\n* Document\n* Do WeirdStuff™ with it\n* Advertise\n\n## Contribute\n\nFeel free to dive in! [Open an issue](https://github.com/BenWiederhake/sample_convex_combinations/issues/new) or submit PRs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwiederhake%2Fsample_convex_combinations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenwiederhake%2Fsample_convex_combinations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwiederhake%2Fsample_convex_combinations/lists"}