{ "info": { "author": "Brendan Hasz", "author_email": "winsto99@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "ProbFlow\n========\n\n|Version Badge| |Build Badge| |Docs Badge| |Coverage Badge|\n\n.. |Version Badge| image:: https://img.shields.io/pypi/v/probflow\n :target: https://pypi.org/project/probflow/\n\n.. |Build Badge| image:: https://travis-ci.com/brendanhasz/probflow.svg\n :target: https://travis-ci.com/brendanhasz/probflow\n\n.. |Docs Badge| image:: https://readthedocs.org/projects/probflow/badge/\n :target: http://probflow.readthedocs.io\n\n.. |Coverage Badge| image:: https://codecov.io/gh/brendanhasz/probflow/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/brendanhasz/probflow\n\n\nProbFlow is a Python package for building probabilistic Bayesian models with `TensorFlow 2.0 `_ or `PyTorch `_, performing variational inference with those models, and evaluating the models' inferences. It provides both high-level modules for building Bayesian neural networks, as well as low-level parameters and distributions for constructing custom Bayesian models.\n\nIt's very much still a work in progress.\n\n- **Git repository:** http://github.com/brendanhasz/probflow\n- **Documentation:** http://probflow.readthedocs.io\n- **Bug reports:** http://github.com/brendanhasz/probflow/issues\n\n\nGetting Started\n---------------\n\n**ProbFlow** allows you to quickly and less painfully build, fit, and evaluate custom Bayesian models (or `ready-made `_ ones!) which run on top of either `TensorFlow 2.0 `_ and `TensorFlow Probability `_ or `PyTorch `_.\n\nWith ProbFlow, the core building blocks of a Bayesian model are parameters, probability distributions, and modules (and, of course, the input data). Parameters define how the independent variables (the features) predict the probability distribution of the dependent variables (the target).\n\nFor example, a simple Bayesian linear regression\n\n.. image:: https://raw.githubusercontent.com/brendanhasz/probflow/master/docs/img/readme/regression_equation.svg?sanitize=true\n :width: 30 %\n :align: center\n\ncan be built by creating a ProbFlow Model:\n\n.. code-block:: python\n\n import probflow as pf\n\n class LinearRegression(pf.ContinuousModel):\n\n def __init__(self):\n self.weight = pf.Parameter(name='weight')\n self.bias = pf.Parameter(name='bias')\n self.std = pf.ScaleParameter(name='sigma')\n\n def __call__(self, x):\n return pf.Normal(x*self.weight()+self.bias(), self.std())\n\n model = LinearRegression()\n\nThen, the model can be fit using stochastic variational inference, in *one line*:\n\n.. code-block:: python\n\n # x and y are Numpy arrays or pandas DataFrame/Series\n model.fit(x, y)\n\nYou can generate predictions for new data:\n\n.. code-block:: python\n\n # x_test is a Numpy array or pandas DataFrame\n model.predict(x_test)\n\nCompute *probabilistic* predictions for new data, with 95% confidence intervals:\n\n.. code-block:: python\n\n model.pred_dist_plot(x_test, ci=0.95)\n\n.. image:: https://raw.githubusercontent.com/brendanhasz/probflow/master/docs/img/readme/pred_dist.svg?sanitize=true\n :width: 90 %\n :align: center\n\nEvaluate your model's performance using metrics:\n\n.. code-block:: python\n\n model.metric('mse', x_test, y_test)\n\nInspect the posterior distributions of your fit model's parameters, with 95% confidence intervals:\n\n.. code-block:: python\n\n model.posterior_plot(ci=0.95)\n\n.. image:: https://raw.githubusercontent.com/brendanhasz/probflow/master/docs/img/readme/posteriors.svg?sanitize=true\n :width: 90 %\n :align: center\n\nInvestigate how well your model is capturing uncertainty by examining how accurate its predictive intervals are:\n\n.. code-block:: python\n\n model.pred_dist_coverage(ci=0.95)\n\nand diagnose *where* your model is having problems capturing uncertainty:\n\n.. code-block:: python\n\n model.coverage_by(ci=0.95)\n\n.. image:: https://raw.githubusercontent.com/brendanhasz/probflow/master/docs/img/readme/coverage.svg?sanitize=true\n :width: 90 %\n :align: center\n\nProbFlow also provides more complex modules, such as those required for building Bayesian neural networks. Also, you can mix ProbFlow with TensorFlow (or PyTorch!) code. For example, a multi-layer Bayesian neural network can be built and fit using ProbFlow in only a few lines:\n\n.. code-block:: python\n\n import tensorflow as tf\n\n class DenseRegression(pf.ContinuousModel):\n\n def __init__(self, input_dims):\n self.net = pf.Sequential([\n pf.Dense(input_dims, 128),\n tf.nn.relu,\n pf.Dense(128, 64),\n tf.nn.relu,\n pf.Dense(64, 1),\n ])\n self.std = pf.ScaleParameter(name='std')\n\n def __call__(self, x):\n return pf.Normal(self.net(x), self.std())\n\n model = DenseRegression()\n model.fit(x, y)\n\nFor convenience, ProbFlow also includes several `pre-built models `_ for standard tasks (such as linear regressions, logistic regressions, and multi-layer dense neural networks). For example, the above linear regression example could have been done with much less work by using ProbFlow's ready-made LinearRegression model:\n\n.. code-block:: python\n\n model = pf.LinearRegression(7)\n model.fit(x, y)\n\nAnd the multi-layer Bayesian neural net could have been made more easily by using ProbFlow's ready-made DenseRegression model:\n\n.. code-block:: python\n\n model = pf.DenseRegression([7, 128, 64, 1])\n model.fit(x, y)\n\nUsing parameters and distributions as simple building blocks, ProbFlow allows for the painless creation of more complicated Bayesian models like `generalized linear models `_, `neural matrix factorization `_ models, and `Gaussian mixture models `_. Take a look at the `examples `_ section and the `user guide `_ for more!\n\n\nInstallation\n------------\n\nBefore installing ProbFlow, you'll first need to install either PyTorch, or TensorFlow 2.0 and TensorFlow Probability. See `more details here `_.\n\nThen, you can install ProbFlow itself:\n\n.. code-block:: bash\n\n pip install probflow\n\n\nSupport\n-------\n\nPost bug reports, feature requests, and tutorial requests in `GitHub issues `_.\n\n\nContributing\n------------\n\n`Pull requests `_ are totally welcome! Any contribution would be appreciated, from things as minor as pointing out typos to things as major as writing new applications and distributions.\n\n\nWhy the name, ProbFlow?\n-----------------------\n\nBecause it's a package for probabilistic modeling, and it was built on TensorFlow. \u00af\\\\_(\u30c4)_/\u00af\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/brendanhasz/probflow", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "probflow", "package_url": "https://pypi.org/project/probflow/", "platform": "", "project_url": "https://pypi.org/project/probflow/", "project_urls": { "Homepage": "https://github.com/brendanhasz/probflow" }, "release_url": "https://pypi.org/project/probflow/2.0.0a1/", "requires_dist": [ "tensorflow (==2.0.0) ; extra == 'docs'", "tensorflow-probability (==0.8.0) ; extra == 'docs'", "sphinx-tabs ; extra == 'docs'", "tensorflow (==2.0.0) ; extra == 'tests'", "tensorflow-probability (==0.8.0) ; extra == 'tests'", "torch (>=1.2.0) ; extra == 'tests'", "pytest (>=5.1.2) ; extra == 'tests'", "pytest-cov (>=2.7.1) ; extra == 'tests'", "pylint (>=2.3.1) ; extra == 'tests'" ], "requires_python": "", "summary": "A Python package for building Bayesian models with TensorFlow or PyTorch", "version": "2.0.0a1" }, "last_serial": 5992028, "releases": { "2.0.0a0": [ { "comment_text": "", "digests": { "md5": "cd8ec93782c8a6936262a4dd3c520f20", "sha256": "fe133d607ebdb48c314742bc17d205570c916cae5ea4844fbb0eab06163ba795" }, "downloads": -1, "filename": "probflow-2.0.0a0-py3-none-any.whl", "has_sig": false, "md5_digest": "cd8ec93782c8a6936262a4dd3c520f20", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 44646, "upload_time": "2019-09-19T08:11:48", "url": "https://files.pythonhosted.org/packages/9d/d4/77f85be9b780225059c7317a5a84684be4c92c19feb59026ad0ad9ec7110/probflow-2.0.0a0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cfed74df4988339e83484305342d0bd", "sha256": "00c6548ba626b2730df2b02745edc35202813165a72a1eb885a58a83bcd709ee" }, "downloads": -1, "filename": "probflow-2.0.0a0.tar.gz", "has_sig": false, "md5_digest": "4cfed74df4988339e83484305342d0bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 39914, "upload_time": "2019-09-19T08:11:53", "url": "https://files.pythonhosted.org/packages/42/15/c5e89c08cd4b9aff85c21f5eaff8d7ce86f9fe97b1352b02028734e5dd27/probflow-2.0.0a0.tar.gz" } ], "2.0.0a1": [ { "comment_text": "", "digests": { "md5": "c158461acbafeeb2b783006e09af982e", "sha256": "dcf90eef0319a3e996107cbe5a558c1efc6a6f00aa0a38ef8528917c4b789eb8" }, "downloads": -1, "filename": "probflow-2.0.0a1-py3-none-any.whl", "has_sig": false, "md5_digest": "c158461acbafeeb2b783006e09af982e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 48970, "upload_time": "2019-10-17T19:46:47", "url": "https://files.pythonhosted.org/packages/a7/5d/e648b612715fbdd5423bf30480908b90093d7c62b6697cc5862811f0b5dd/probflow-2.0.0a1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bddbe266d96ffc94b530ef7903c4bf3", "sha256": "a4c2a746f883963bae6c51c368afc7ce0d28968ecd05383f55c2d0226bfa8daf" }, "downloads": -1, "filename": "probflow-2.0.0a1.tar.gz", "has_sig": false, "md5_digest": "7bddbe266d96ffc94b530ef7903c4bf3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43702, "upload_time": "2019-10-17T19:46:49", "url": "https://files.pythonhosted.org/packages/a4/e9/525cfdecc373e07e2deefcadfc146d8dd8671b43299fdb2064a4e0074bcd/probflow-2.0.0a1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c158461acbafeeb2b783006e09af982e", "sha256": "dcf90eef0319a3e996107cbe5a558c1efc6a6f00aa0a38ef8528917c4b789eb8" }, "downloads": -1, "filename": "probflow-2.0.0a1-py3-none-any.whl", "has_sig": false, "md5_digest": "c158461acbafeeb2b783006e09af982e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 48970, "upload_time": "2019-10-17T19:46:47", "url": "https://files.pythonhosted.org/packages/a7/5d/e648b612715fbdd5423bf30480908b90093d7c62b6697cc5862811f0b5dd/probflow-2.0.0a1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bddbe266d96ffc94b530ef7903c4bf3", "sha256": "a4c2a746f883963bae6c51c368afc7ce0d28968ecd05383f55c2d0226bfa8daf" }, "downloads": -1, "filename": "probflow-2.0.0a1.tar.gz", "has_sig": false, "md5_digest": "7bddbe266d96ffc94b530ef7903c4bf3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43702, "upload_time": "2019-10-17T19:46:49", "url": "https://files.pythonhosted.org/packages/a4/e9/525cfdecc373e07e2deefcadfc146d8dd8671b43299fdb2064a4e0074bcd/probflow-2.0.0a1.tar.gz" } ] }