Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pymc-learn: Practical probabilistic machine learning in Python

License

NotificationsYou must be signed in to change notification settings

pymc-learn/pymc-learn

Pymc-Learn logo

statusTravisCoverageDocumentation StatusHex.pmPypiBinder

Contents:

  1. Github repo
  2. What is pymc-learn?
  3. Quick Install
  4. Quick Start
  5. Index

What is pymc-learn?

pymc-learn is a library for practical probabilisticmachine learning in Python.

It provides a variety of state-of-the art probabilistic models for supervisedand unsupervised machine learning.It is inspired byscikit-learnand focuses on bringing probabilisticmachine learning to non-specialists. It uses a syntax that mimics scikit-learn.Emphasis is put on ease of use, productivity, flexibility, performance,documentation, and an API consistent with scikit-learn. It depends on scikit-learnandPyMC3 and is distributed under the new BSD-3 license,encouraging its use in both academia and industry.

Users can now have calibrated quantities of uncertainty in their modelsusing powerful inference algorithms -- such as MCMC or Variational inference --provided byPyMC3.See:doc:`why` for a more detailed description of whypymc-learn wascreated.

Note

pymc-learn leverages and extends the Base template provided by thePyMC3 Models project:https://github.com/parsing-science/pymc3_models

Transitioning from PyMC3 to PyMC4

.@pymc_learn has been following closely the development of#PyMC4 with the aim of switching its backend from#PyMC3 to PyMC4 as the latter grows to maturity. Core devs are invited. Here's the tentative roadmap for PyMC4:https://t.co/Kwjkykqzup cc@pymc_devshttps://t.co/Ze0tyPsIGH

— pymc-learn (@pymc_learn)November 5, 2018

Familiar user interface

pymc-learn mimics scikit-learn. You don't have to completely rewriteyour scikit-learn ML code.

fromsklearn.linear_model \frompmlearn.linear_model \importLinearRegressionimportLinearRegressionlr=LinearRegression()lr=LinearRegression()lr.fit(X,y)lr.fit(X,y)

The difference between the two models is thatpymc-learn estimates modelparameters using Bayesian inference algorithms such as MCMC or variationalinference. This produces calibrated quantities of uncertainty for modelparameters and predictions.


Quick Install

pymc-learn requires a working Python interpreter (2.7 or 3.5+).It is recommend installing Python and key numerical libraries using theAnaconda Distribution,which has one-click installers available on all major platforms.

Assuming a standard Python environment is installed on your machine(including pip),pymc-learn itself can be installed in one line using pip:

You can installpymc-learn from PyPi using pip as follows:

pip install pymc-learn

Or from source as follows:

pip install git+https://github.com/pymc-learn/pymc-learn

Caution!

pymc-learn is under heavy development.

It is recommended installingpymc-learn in a Conda environment because itprovidesMath Kernel Library (MKL)routines to accelerate math functions. If you are having trouble, try usinga distribution of Python that includes these packages likeAnaconda.

Dependencies

pymc-learn is tested on Python 2.7, 3.5 & 3.6 and depends on Theano,PyMC3, Scikit-learn, NumPy, SciPy, and Matplotlib (seerequirements.txtfor version information).


Quick Start

# For regression using Bayesian Nonparametrics>>>fromsklearn.datasetsimportmake_friedman2>>>frompmlearn.gaussian_processimportGaussianProcessRegressor>>>frompmlearn.gaussian_process.kernelsimportDotProduct,WhiteKernel>>>X,y=make_friedman2(n_samples=500,noise=0,random_state=0)>>>kernel=DotProduct()+WhiteKernel()>>>gpr=GaussianProcessRegressor(kernel=kernel).fit(X,y)>>>gpr.score(X,y)0.3680...>>>gpr.predict(X[:2,:],return_std=True)(array([653.0...,592.1...]),array([316.6...,316.6...]))

Scales to Big Data & Complex Models

Recent research has led to the development of variational inference algorithmsthat are fast and almost as flexible as MCMC. For instance AutomaticDifferentation Variational Inference (ADVI) is illustrated in the code below.

frompmlearn.neural_networkimportMLPClassifiermodel=MLPClassifier()model.fit(X_train,y_train,inference_type="advi")

Instead of drawing samples from the posterior, these algorithms fita distribution (e.g. normal) to the posterior turning a sampling problem intoan optimization problem. ADVI is provided PyMC3.


Citing pymc-learn

To citepymc-learn in publications, please use the following:

Emaasit, Daniel (2018). Pymc-learn: Practical probabilistic machinelearning in Python. arXiv preprint arXiv:1811.00542.

Or using BibTex as follows:

@article{emaasit2018pymc,  title={Pymc-learn: Practical probabilistic machine learning in {P}ython},  author={Emaasit, Daniel and others},  journal={arXiv preprint arXiv:1811.00542},  year={2018}}

If you want to citepymc-learn for its API, you may also want to considerthis reference:

Carlson, Nicole (2018). Custom PyMC3 models built on top of the scikit-learnAPI. https://github.com/parsing-science/pymc3_models

Or using BibTex as follows:

@article{Pymc3_models,  title={pymc3_models: Custom PyMC3 models built on top of the scikit-learn API,  author={Carlson, Nicole},  journal={},  url={https://github.com/parsing-science/pymc3_models}  year={2018}}

License

New BSD-3 license


Index

Getting Started

.. toctree::   :maxdepth: 1   :hidden:   :caption: Getting Started   install.rst   support.rst   why.rst

User Guide

The main documentation. This contains an in-depth description of all modelsand how to apply them.

.. toctree::   :maxdepth: 1   :hidden:   :caption: User Guide   user_guide.rst

Examples

Pymc-learn provides probabilistic models for machine learning,in a familiar scikit-learn syntax.

.. toctree::   :maxdepth: 1   :hidden:   :caption: Examples   regression.rst   classification.rst   mixture.rst   neural_networks.rst

API Reference

pymc-learn leverages and extends the Base template provided by the PyMC3Models project:https://github.com/parsing-science/pymc3_models.

.. toctree::   :maxdepth: 1   :hidden:   :caption: API Reference   api.rst

Help & reference

.. toctree::   :maxdepth: 1   :hidden:   :caption: Help & reference   develop.rst   support.rst   changelog.rst   cite.rst

About

pymc-learn: Practical probabilistic machine learning in Python

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp