{ "info": { "author": "Will McGinnis", "author_email": "will@pedalwrencher.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python :: 3" ], "description": "petersburg\n==========\n\nversion number: 0.0.1\nauthor: Will McGinnis\n\nOverview\n========\n\nA simple framework for analyzing decision processes as directed graphs. \n\nSimulating uncertain decisions\n------------------------------\n\nInspired by the [St. Petersburg paradox](https://en.wikipedia.org/wiki/St._Petersburg_paradox),\nwhere the expected value of a simple game is infinity, unless reasonable contraints are set (i.e. the bank doesn't have\nand infinite bankroll, you don't have infinite time to play, etc.). The idea is that we can represent decisions and the\ndecisions they lead to as directed acyclic graphs, wherein the nodes have payoffs, edges have costs, and at each node, \nthe edge to progress on to is selected at random (with weights). \n \nWith such a graph assembled, we can simulate the different first choices to see what the expected (simulated) outcome of \neach is.\n\nFuture goals\n------------\n\nIn the future the plan is to add things like extremely rare and extreme events at each node (i.e. unknown unknowns, or \nblack swans), more complex switching logic at nodes than weighted random, more complex cost and payoff models (utility),\nand better methods for building complex graphs.\n\nThe first outcome will be more detailed metrics on the simulated outcomes than just mean (simulated expected value). Of \ncourse a positive expected value with extremely high risk is different than the same expected value without. We'd love \nto capture that concisely. \n\nInstallation / Usage\n====================\n\nTo install use pip:\n\n $ pip install petersburg\n\n\nOr clone the repo:\n\n $ git clone https://github.com/wdm0006/petersburg.git\n $ python setup.py install\n \nContributing\n============\n\nTBD\n\nExample\n=======\n\nHere is a simple example of simulating the St. Petersburg Paradox game, with some slight variations. In this case the \nentrance fee is $10, and the game only has a maximum of 10,000 flips and is played 10,000,000 times.\n\n from petersburg import Graph\n \n if __name__ == '__main__':\n g = Graph()\n \n # st petersburg paradox w/ $10 entrance fee and only 10000 possible flips\n entrance_fee = 10\n gd = {1: {'payoff': 0, 'after': []}, 2: {'payoff': 0, 'after': [{'node_id': 1, 'cost': entrance_fee}]}}\n nn = 3\n for idx in range(10000):\n node_id = 2 * (idx + 1)\n payoff = 2 ** (idx + 1)\n gd[nn] = {'payoff': payoff, 'after': [{'node_id': node_id, 'cost': 0, 'weight': 1}]}\n nn += 1\n gd[nn] = {'payoff': 0, 'after': [{'node_id': node_id, 'cost': 0, 'weight': 1}]}\n nn += 1\n g.from_dict(gd)\n \n outcomes = []\n for _ in range(10000000):\n outcomes.append(g.get_outcome())\n \n print('\\n\\nSimulated Output')\n print(sum(outcomes))\n\nVia simulation, the outcome of this is a profit of: $197,592,288. This will, of course, vary depending on the run, but\nwill approach infinity as the number of games goes to infinity, regardless of cost-to-play.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/wdm0006/petersburg/tarball/0.0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wdm0006/petersburg", "keywords": "", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "petersburg", "package_url": "https://pypi.org/project/petersburg/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/petersburg/", "project_urls": { "Download": "https://github.com/wdm0006/petersburg/tarball/0.0.1", "Homepage": "https://github.com/wdm0006/petersburg" }, "release_url": "https://pypi.org/project/petersburg/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "A simple framework for analyzing probabalistic decision processes as directed graphs", "version": "0.0.1" }, "last_serial": 1907891, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "aeb6e2cf81d81cdab79418ca0f26b914", "sha256": "94164498c3cac233eb40224f16404edd8901d487f6c681a020308a167aadfc01" }, "downloads": -1, "filename": "petersburg-0.0.1.tar.gz", "has_sig": false, "md5_digest": "aeb6e2cf81d81cdab79418ca0f26b914", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6478, "upload_time": "2016-01-16T22:50:20", "url": "https://files.pythonhosted.org/packages/1a/6f/0c929d3392d3639b27fbfc60326235fbfca1970194cd87eb62eb3eaca6e8/petersburg-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aeb6e2cf81d81cdab79418ca0f26b914", "sha256": "94164498c3cac233eb40224f16404edd8901d487f6c681a020308a167aadfc01" }, "downloads": -1, "filename": "petersburg-0.0.1.tar.gz", "has_sig": false, "md5_digest": "aeb6e2cf81d81cdab79418ca0f26b914", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6478, "upload_time": "2016-01-16T22:50:20", "url": "https://files.pythonhosted.org/packages/1a/6f/0c929d3392d3639b27fbfc60326235fbfca1970194cd87eb62eb3eaca6e8/petersburg-0.0.1.tar.gz" } ] }