{ "info": { "author": "Angus Williams ", "author_email": "anguswilliams91@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# bpl\n\n[![Build Status](https://travis-ci.org/anguswilliams91/bpl.svg?branch=master)](https://travis-ci.org/anguswilliams91/bpl)\n[![codecov](https://codecov.io/gh/anguswilliams91/bpl/branch/master/graph/badge.svg)](https://codecov.io/gh/anguswilliams91/bpl)\n\n`bpl` is a python 3 library for fitting Bayesian versions of the Dixon \\& Coles (1997) model to data.\nIt uses the `stan` library to fit models to data. \n\n ## Installation\n\nYou will need a working C++ compiler.\nIf you are using anaconda, you can install gcc with \n\n```bash\nconda install gcc\n``` \n\nYou can then install with `pip`:\n\n```bash\npip install bpl\n```\nThis may take a little while, as two stan models are compiled as part of the build.\n\n## Usage\n\n`bpl` provides a class `BPLModel` that can be used to forecast the outcome of football matches.\nData should be provided to the model as a `pandas` dataframe, with columns `home_team`, `away_team`, `home_goals` and `away_goals`.\nYou can also optionally provide a set of numerical covariates for each team (e.g. their ratings on FIFA) and these will be used in the fit.\nExample usage:\n```python\nimport bpl\nimport pandas as pd\n\ndf_train = pd.read_csv(\"\")\ndf_X = pd.read_csv(\"\")\nforecaster = bpl.BPLModel(data=df_train, X=df_X)\nforecaster.fit(seed=42)\n\n# calculate the probability that team 1 beats team 2 3-0 at home:\nforecaster.score_probability(\"Team 1\", \"Team 2\", 3, 0)\n\n# calculate the probabilities of a home win, an away win and a draw:\nforecaster.overall_probabilities(\"Team 1\", \"Team 2\")\n\n# compute home win, away win and draw probabilities for a collection of matches:\ndf_test = pd.read_csv(\"\") # must have columns \"home_team\" and \"away_team\"\nforecaster.predict_future_matches(df_test)\n\n# add a new, previously unseen team to the model by sampling from the prior\nX_3 = np.array([0.1, -0.5, 3.0]) # the covariates for the new team\nforecaster.add_new_team(\"Team 3\", X=X_3, seed=43)\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/anguswilliams91/bpl/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/anguswilliams91/bpl", "keywords": "", "license": "GPL-3.0", "maintainer": "", "maintainer_email": "", "name": "bpl", "package_url": "https://pypi.org/project/bpl/", "platform": "", "project_url": "https://pypi.org/project/bpl/", "project_urls": { "Download": "https://github.com/anguswilliams91/bpl/archive/master.zip", "Homepage": "https://github.com/anguswilliams91/bpl" }, "release_url": "https://pypi.org/project/bpl/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Bayesian models for football leagues", "version": "0.0.4" }, "last_serial": 5726349, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "c5f0de056602f8772b7d415390b4b523", "sha256": "dea86eebe6affa4b8c5af6a176d87539c7e3375b0bf686974e997d24457c0f29" }, "downloads": -1, "filename": "bpl-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c5f0de056602f8772b7d415390b4b523", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12180738, "upload_time": "2019-08-21T06:31:52", "url": "https://files.pythonhosted.org/packages/f6/19/90b319b10d45c40059eb6f986963441d03c5ea43ee7e852793bd4b9fe422/bpl-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ca01afa0eef0cfd94b6bcef7fca6ce41", "sha256": "b0313abc52a3cbe60f8064263f08f2addefc82ca91273324040c661618c3c4ae" }, "downloads": -1, "filename": "bpl-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ca01afa0eef0cfd94b6bcef7fca6ce41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10040, "upload_time": "2019-08-21T06:31:57", "url": "https://files.pythonhosted.org/packages/c7/07/6e4e69131d43aadee5b99df2ae2a8b0ddf1c5d9d522c955439e5bda9dcf6/bpl-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "fa0838e32f17d89ed0fc939cc12ac1f3", "sha256": "9cfc657cee6714f9fd83aa877b9dec0cc78c8a506c3b93a09f0d6eddb372a019" }, "downloads": -1, "filename": "bpl-0.0.2.tar.gz", "has_sig": false, "md5_digest": "fa0838e32f17d89ed0fc939cc12ac1f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10070, "upload_time": "2019-08-21T06:46:46", "url": "https://files.pythonhosted.org/packages/f5/8d/9b358c5288291d0e16c8133fc52295ee959871b83ecbea64c698cf1d9c62/bpl-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "808260ca88b83e3b9e6ddf1043e6c8ee", "sha256": "0bbdf2350adb9294e8cc166e8586ba042cafdb6b752609cfcc242b342304a9a8" }, "downloads": -1, "filename": "bpl-0.0.3.tar.gz", "has_sig": false, "md5_digest": "808260ca88b83e3b9e6ddf1043e6c8ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27807, "upload_time": "2019-08-25T07:37:43", "url": "https://files.pythonhosted.org/packages/6e/03/3f919e82daa014efc7d17261d25178373b26e9b31ee6377ca22bf9944821/bpl-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "6ea216bf95fa11449a437e6a5ffd3f7d", "sha256": "98241402bfb9238b03d1c650d7e9a854645800bcfdfcbbec444b581a718cdb10" }, "downloads": -1, "filename": "bpl-0.0.4.tar.gz", "has_sig": false, "md5_digest": "6ea216bf95fa11449a437e6a5ffd3f7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27628, "upload_time": "2019-08-25T07:47:12", "url": "https://files.pythonhosted.org/packages/ff/a3/16f6017f39c1fef52ee6ac866478597ec629d10e92137c6c53365c5204f8/bpl-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6ea216bf95fa11449a437e6a5ffd3f7d", "sha256": "98241402bfb9238b03d1c650d7e9a854645800bcfdfcbbec444b581a718cdb10" }, "downloads": -1, "filename": "bpl-0.0.4.tar.gz", "has_sig": false, "md5_digest": "6ea216bf95fa11449a437e6a5ffd3f7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27628, "upload_time": "2019-08-25T07:47:12", "url": "https://files.pythonhosted.org/packages/ff/a3/16f6017f39c1fef52ee6ac866478597ec629d10e92137c6c53365c5204f8/bpl-0.0.4.tar.gz" } ] }