{"id":16759387,"url":"https://github.com/cleoold/linearly_varying_binomial_distribution_calcs_python","last_synced_at":"2025-03-16T08:26:20.371Z","repository":{"id":62576171,"uuid":"243919630","full_name":"cleoold/linearly_varying_binomial_distribution_calcs_Python","owner":"cleoold","description":"a \"binomial\" distribution with linearly increasing chance.","archived":false,"fork":false,"pushed_at":"2020-05-10T19:27:08.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T04:48:12.976Z","etag":null,"topics":["probability","python-c-extension","statistics"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/linearly-varying-binomial-distribution/","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/cleoold.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":"2020-02-29T06:49:42.000Z","updated_at":"2020-05-10T19:27:10.000Z","dependencies_parsed_at":"2022-11-03T20:10:03.284Z","dependency_job_id":null,"html_url":"https://github.com/cleoold/linearly_varying_binomial_distribution_calcs_Python","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Flinearly_varying_binomial_distribution_calcs_Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Flinearly_varying_binomial_distribution_calcs_Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Flinearly_varying_binomial_distribution_calcs_Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Flinearly_varying_binomial_distribution_calcs_Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cleoold","download_url":"https://codeload.github.com/cleoold/linearly_varying_binomial_distribution_calcs_Python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243844178,"owners_count":20356991,"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":["probability","python-c-extension","statistics"],"created_at":"2024-10-13T04:08:00.294Z","updated_at":"2025-03-16T08:26:20.340Z","avatar_url":"https://github.com/cleoold.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linearly varying_binomial distribution calculations\n\n```\npip install linearly-varying-binomial-distribution\n```\n\nThis is a wrapper module for the previous repo: [C PROGRAM](https://github.com/cleoold/linearly_varying_binomial_distribution_calcs)\n\n### Description of the math\n\nImagine the cardpool of a ptw game looks like:\n\nOne can flip a card. there is a probability (here say 0.02) to have a prize at the beginning.\n* If one does not have the prize for 50 attempts in a row, the constant (here say 0.02) will be added to the existing probability (so that the chance of having the prize is increasing) until one finally has the prize, at which point the chance will reset to the original one.\n\nFor example, one tried 52 times and there have been no successes. At this point their chance for success for the 53rd time will be 0.08. If the 53-rd try is a success, then the chance for the 54-th try will be reset to 0.02, otherwise the chance becomes 0.10. Also the maximum number of tries allowed here is calculated 99, where the chance is 1.\n\nIf he tries 60 times, we can calculate the chance of getting the prize with the following code:\n```py\nfrom lvbdist import LVBdistribution\nx = LVBdistribution(\n    0.02, # the starting probability \n    0.02, # the constant to add\n    50    # numbr of failures before triggering the addition\n)\nx.have_success_within_n_attempts(60) # 0.911490\n\n```\nHow about the probability they just get the prize at the 60th turn\n```py\nx.have_first_success_at_n(60) # 0.024964\n```\n\nWe can calculate the average number of attempts they need to make to have the prize:\n```py\nx.have_first_success_at_n_E() # 34.59455\n```\n\nWe can also calculate the average successes in 60 attempts:\n```py\nx.have_m_successes_within_n_attempts_E(60) # 1.443428\n```\n\nFunction names are self-descriptive. Note that functions ending with `_E` are expectated values. There always exist a function without the `_E` suffix.\n\nRefer to [the lazily generated doc](https://cleoold.github.io/linearly_varying_binomial_distribution_calcs_Python/doc/) for all functions.\n\n\n### Building\n\nRequirements: setuptools, and any modern C compiler shall work\n\nClone the repository:\n```bash\ngit clone --recurse-submodules https://github.com/cleoold/linearly_varying_binomial_distribution_calcs_Python\n```\n\nYou can install the package by running\n```bash\nmake install\n```\n\n#### Developing\n\n(Optional) set up a virtual env\n```bash\npython3 -m venv . # pyvenv .\nsource bin/activate\n```\n\nbuild the package in-place in the `lvbdist` folder by running\n```bash\nmake debugging\n```\nAnd then build the distributable:\n```bash\nbin/pip3 install wheel\nmake release\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleoold%2Flinearly_varying_binomial_distribution_calcs_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleoold%2Flinearly_varying_binomial_distribution_calcs_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleoold%2Flinearly_varying_binomial_distribution_calcs_python/lists"}