{ "info": { "author": "Flying Circus", "author_email": "ewingt1979@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7" ], "description": "# toms_dist_sampler\n\n## Introduction\n\nTom's Distribution Sampler makes creating Normal, Poisson and Binomial samples and getting the summary statistics on these in Python easy! I created the sampler as a bit of a pet project to get used to writing OOP and also releasing Python packages. This is my first attempt at it and whilst it was great fun, I learned a lot also! If anyone finds an actual use for it (possibly unlikely?) please let me know. Or buy me a beer. I'd rather the beer in all honesty.\n\n\n## Installation\n\nPresently toms_dist_sampler is only available for Python3. Sorry about that Python2 users. But it's probably as good an opportunity as any to upgrade!\n\n### Installation via pip\n\nI highly reccomend you install the package with `pip`:\n\n`pip install -i https://test.pypi.org/simple/ toms-dist-sampler`\n\nor alternatively if you have multple version of Python on your system:\n\n`pip3 install -i https://test.pypi.org/simple/ toms-dist-sampler`\n\n### Installation via Github\n\nYou can also install via github is as follows:\n\n```\ngit clone https://github.com/Tommo565/toms_dist_sampler\ncd toms_dist_sampler\npython setup.py install\n```\n\nIf the last line fails, it may be because you have multiple versions of Python installed on your system. So, you might also want to try:\n`python3 setup.py install`\n\n\n## Examples\n\nThe sampler itself is available both as a set of functions and also as a class. The base sample selection functionality within these is identical, however there are a few more options available in the Class which I'll cover below. which you use should be down to your own personal preference. \n\nIf you use this package you'll probably want to understand a bit about the underlying distributions as well. You can find a great in depth resource at [Minitab Express](https://support.minitab.com/en-us/minitab-express/1/help-and-how-to/basic-statistics/probability-distributions/supporting-topics/distributions/binomial-distribution/) or alternatively a cheat-sheet at [Cloudera](http://blog.cloudera.com/blog/2015/12/common-probability-distributions-the-data-scientists-crib-sheet/)\n\n### distribution_sampler Function\n\nI reccomend that you use the following convention to import:\n\n`from toms_dist_sampler.distribution_sampler import distribution_sampler as ds`\n\nFrom there you can run a sample for a Normal distribution like so:\n\n`norm = ds(dist='Normal', size=1000, mean=2, sd=5)`\n\nOr a Poisson distribution like so:\n\n`poisson = ds(dist='Poisson', size=5000, lam=3)`\n\nAnd finally a Binomial distribution like so:\n\n`binomial = ds(dist='Binomial', size=2500, trials=20, prob=0.2)`\n\nYou can also call the help function for a more detailed overview of the functionality and parameters:\n\n`help(ds)`\n\nAll samples are created in [numpy array](https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.array.html) format. You can convert them to a more traditional python list as follows:\n\n```\nnorm = ds(dist='Normal', size=1000, mean=2, sd=5)`\nnorm_list = norm.tolist()\n```\n\nNote that only the `size=` and `dist=` parameters are applicable to all distribution types. Depending upon the distribution that you choose, you will have to specify the right parameters for that distribution in the examples above. If you select an incorrect combination of parameters, you will receive an error message with further guidance on how to select the correct parameters.\n\n### DistributionSampler Class\n\nAs with functions I reccomend that you use the following convention to import the Class:\n\n`from toms_dist_sampler.DistributionSampler import DistributionSampler as DS`\n\nThe class is flexible and when creating the instance you can either do so with parameters:\n\n`my_instance = DS(dist='Normal', size=1000, mean=2, sd=5)`\n\nor without:\n\n`MyInstance = DS()`\n\nCreating an instance with parameters will result in the sample being generated immediately. However if you create it without parameters and want to add them, you can do so with the `set_parameters()` method as follows:\n\n`MyInstance.set_parameters(dist='Poisson', size=5000, lam=3)`\n\nYou can print the parameters at any time using the `print_parameters()` method as follows:\n\n`MyInstance.print_parameters()`\n\nNote that if you switch between distribution types (e.g. `dist=Normal` and `dist=Poisson`) then the previous parameters are retained. This will generate a warning, and won't affect your results but I do reccomend that if you wish to switch distribution types you create a different instance of the class as desribed above.\n\nTo create a new sample, you must use the `.draw()` method after you have set parameters as follows:\n\n`MyInstance.draw()`\n\nYou can also use the `.draw()` method at any time to create a new sample with your existing parameters.\n\nIt you want to print your sample you can use th `.print_sample()` method as follows:\n\n`MyInstance.print_sample()`\n\nThis prints your sample to the console.\n\nFinally the `.summarise()` method will print some summary statistics to the console, including minimum and maximum values as well as standard deviation and mean average:\n\n`MyInstance.summarise()`\n\nYou can also call the help function for a more detailed overview of the functionality and parameters:\n\n`help(DS)`\n\nAll samples are created in [numpy array](https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.array.html) format. You can convert them to a more traditional python list as follows:\n\n```\nMyInstance = DS(dist='Normal', size=1000, mean=2, sd=5)`\nnorm = MyInstance.draw()\nnorm_list = norm.tolist()\n```\n\nNote that only the `size=` and `dist=` parameters are applicable to all distribution types. Depending upon the distribution that you choose, you will have to specify the right parameters for that distribution in the examples above. If you select an incorrect combination of parameters, you will receive an error message with further guidance on how to select the correct parameters.\n\n\n## Tests\n\nTests are performed using the [PyTest](https://docs.pytest.org/en/latest/) package. To run these, navigate to the `./tests/` folder in the command line and run:\n\n`pytest -v`\n\n## Credits\n\nMassive thanks to [Matt Upson](https://github.com/ivyleavedtoadflax) whose help in checking this was invaluable. I probably owe him a beer! \ud83c\udf7a\n\n## License\n\nMIT \u00a9 [Tom Ewing](https://github.com/Tommo565)\n\n[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n\n\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Tommo565/distribution-sampler", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "toms-dist-sampler", "package_url": "https://pypi.org/project/toms-dist-sampler/", "platform": "", "project_url": "https://pypi.org/project/toms-dist-sampler/", "project_urls": { "Homepage": "https://github.com/Tommo565/distribution-sampler" }, "release_url": "https://pypi.org/project/toms-dist-sampler/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A distribution sampler for Normal, Poisson and Binomial distributions.", "version": "0.0.2" }, "last_serial": 4504340, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e3d8b97556fe62fd5d8955b8eb6ad556", "sha256": "4b00be4b13a01e9e0db5e8ec799c9376f1342d9e6fa637a3ac47a3f12c6d7d1e" }, "downloads": -1, "filename": "toms_dist_sampler-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e3d8b97556fe62fd5d8955b8eb6ad556", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9900, "upload_time": "2018-11-19T20:30:44", "url": "https://files.pythonhosted.org/packages/f4/46/98449d53364aff86f91696e02941becd177c719b50a4d7430980af588c2e/toms_dist_sampler-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbfbd0e648737abfeed14477f2c8cbc3", "sha256": "17003c896adea6e9aa116e6fd177a029cdf925c68277890ede01b887dd9a9ad3" }, "downloads": -1, "filename": "toms-dist-sampler-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fbfbd0e648737abfeed14477f2c8cbc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9988, "upload_time": "2018-11-19T20:30:47", "url": "https://files.pythonhosted.org/packages/3a/73/aed3b15930c1e3033a629324bfe30d2b6b35fb4e222e3b438640fbe8c2da/toms-dist-sampler-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "809322f8706d49482a8f30ced7f13a4c", "sha256": "45d200822bee24f5c45b291700714b9d5d48bd456e6155e924172a6d5b435dd8" }, "downloads": -1, "filename": "toms_dist_sampler-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "809322f8706d49482a8f30ced7f13a4c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9926, "upload_time": "2018-11-19T20:30:46", "url": "https://files.pythonhosted.org/packages/e1/7f/0e732aa25041162bbbfa8d0852ca0448f17e62069817643f302d6276c576/toms_dist_sampler-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6152fede90ec0c404396b9c1dedce86", "sha256": "693bcfb6914974619961c35d2d163a6f948ca36f51138da53102ba917aa4ecee" }, "downloads": -1, "filename": "toms-dist-sampler-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c6152fede90ec0c404396b9c1dedce86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10041, "upload_time": "2018-11-19T20:30:49", "url": "https://files.pythonhosted.org/packages/1d/e5/00891f6a78d254e37c1545d02d9d73945a4d24bf64f9054c863c21ed0cb6/toms-dist-sampler-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "809322f8706d49482a8f30ced7f13a4c", "sha256": "45d200822bee24f5c45b291700714b9d5d48bd456e6155e924172a6d5b435dd8" }, "downloads": -1, "filename": "toms_dist_sampler-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "809322f8706d49482a8f30ced7f13a4c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9926, "upload_time": "2018-11-19T20:30:46", "url": "https://files.pythonhosted.org/packages/e1/7f/0e732aa25041162bbbfa8d0852ca0448f17e62069817643f302d6276c576/toms_dist_sampler-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6152fede90ec0c404396b9c1dedce86", "sha256": "693bcfb6914974619961c35d2d163a6f948ca36f51138da53102ba917aa4ecee" }, "downloads": -1, "filename": "toms-dist-sampler-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c6152fede90ec0c404396b9c1dedce86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10041, "upload_time": "2018-11-19T20:30:49", "url": "https://files.pythonhosted.org/packages/1d/e5/00891f6a78d254e37c1545d02d9d73945a4d24bf64f9054c863c21ed0cb6/toms-dist-sampler-0.0.2.tar.gz" } ] }