{"id":19084774,"url":"https://github.com/ryu577/stochproc","last_synced_at":"2026-02-04T12:06:00.990Z","repository":{"id":57471535,"uuid":"151023092","full_name":"ryu577/stochproc","owner":"ryu577","description":"All kinds of stochastic processes","archived":false,"fork":false,"pushed_at":"2023-12-02T05:25:48.000Z","size":348,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-17T14:11:49.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryu577.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"ryu577","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-10-01T01:26:09.000Z","updated_at":"2023-03-05T13:20:09.000Z","dependencies_parsed_at":"2023-12-02T06:25:55.959Z","dependency_job_id":"e9f6a174-994c-48ac-9c14-955700e21daa","html_url":"https://github.com/ryu577/stochproc","commit_stats":{"total_commits":151,"total_committers":4,"mean_commits":37.75,"dds":0.2781456953642384,"last_synced_commit":"d215a3bcb6a888c6bedf1d1da6cb568335ba6764"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ryu577/stochproc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu577%2Fstochproc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu577%2Fstochproc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu577%2Fstochproc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu577%2Fstochproc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryu577","download_url":"https://codeload.github.com/ryu577/stochproc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu577%2Fstochproc/sbom","scorecard":{"id":793201,"data":{"date":"2025-08-11","repo":{"name":"github.com/ryu577/stochproc","commit":"499a6dd17d881db15d18d196d93421e70595ec98"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T08:09:50.399Z","repository_id":57471535,"created_at":"2025-08-23T08:09:50.399Z","updated_at":"2025-08-23T08:09:50.399Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29084088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"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":[],"created_at":"2024-11-09T02:52:36.063Z","updated_at":"2026-02-04T12:06:00.966Z","avatar_url":"https://github.com/ryu577.png","language":"Python","funding_links":["https://github.com/sponsors/ryu577"],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nThis repository aims to model and uncover the properties of all kinds of stochastic processes (processes\nthat are based on some kind of underlying phenomenon like a coin toss for which we can't know the outcome\nfor sure).\n\nSome of these are taken from the book, Introduction to probability models by Sheldon Ross.\n\nThe best way to demonstrate the capabilities of this library is to describe some stochastic processes\nit can model and show how to use it to extract some of their properties.\n\n# Installation\nTo install the library, run:\n\n```\npip install stochproc\n```\n\nMake sure you have all the requirements (requirements.txt) installed. If not, you can run:\n\n```\npip install -r requirements.txt\n```\n\nAlternately, you can fork/download the code and run from the main folder:\n\n```\npython setup.py install\n```\n\n\n# Machine reliability\n\nLet's say we start up a machine. It stays up some random amount of time before succumbing to failure.\nThe amount of time it stays up is a random variable. This variable models the mean time between failures.\n\nAnd once the machine is down, it takes a certain amount of time to get repaired. This is the mean time\nto repair.\n\n\nThe question is at any time t, what is the probability the machine is up and running?\n\nChapter 11 of [1] provides a closed form. However, we want to validate this with simulation.\n\n```python\nfrom stochproc.reliability.machinerepair import *\n\nfor i in range(10):\n\tprobs = []\n\tstds = []\n\tfor t in range(1,100):\n\t\tprob, std = updown(t)\n\t\tprobs.append(prob)\n\t\tstds.append(std)\n\tplt.plot(np.arange(1,100), probs,alpha=0.4,color='pink')\n\nxs = np.arange(1,100)\nplt.plot(xs, closed_form(xs),color='red')\nplt.xlabel('Time')\nplt.ylabel('Reliability of system')\nplt.show()\n```\n\nThis leads to the following plot.\n\n\u003ca href=\"https://medium.com/@rohitpandey576/coin-toss-markov-chains-7995cb303406\" \ntarget=\"_blank\"\u003e\u003cimg src=\"https://github.com/ryu577/stochproc/blob/master/plots/mcreliability.png\" \nalt=\"Image formed by above method\" width=\"240\" height=\"240\" border=\"10\" /\u003e\u003c/a\u003e\n\n\n# Coin toss sequences\n\nLet's say you and I start tossing fair coins. What is the probability you'll reach three consecutive heads before\nI reach two consecutive heads? What about in general you reaching (n+1) consecutive heads before I reach n consecutive\nheads?\n\n\n```python\nfrom stochproc.competitivecointoss.smallmarkov import *\n\nns = np.arange(2,15)\nwin_probs = []\nfor n in ns:\n    # The losing markov sequence of coin tosses that needs (n-1) heads.\n    lose_seq = MarkovSequence(get_consecutive_heads_mat(n))\n    # The winning markov sequence of coin tosses that needs n heads.\n    win_seq = MarkovSequence(get_consecutive_heads_mat(n+1))\n    # If you multiply the two sequence objects, you get the probability\n    # that the first one beats the second one.\n    win_prob = win_seq*lose_seq\n    win_probs.append(win_prob)\n\nplt.plot(ns, win_probs)\n```\n\nThis leads to the following plot:\n\n\n\u003ca href=\"https://medium.com/@rohitpandey576/coin-toss-markov-chains-7995cb303406\" \ntarget=\"_blank\"\u003e\u003cimg src=\"https://github.com/ryu577/ryu577.github.io/blob/master/Downloads/CompetitiveCoinToss/probs_with_n.png\" \nalt=\"Image formed by above method\" width=\"240\" height=\"240\" border=\"10\" /\u003e\u003c/a\u003e\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu577%2Fstochproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryu577%2Fstochproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu577%2Fstochproc/lists"}