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

Probabilistic reasoning and statistical analysis in TensorFlow

License

NotificationsYou must be signed in to change notification settings

tensorflow/probability

TensorFlow Probability is a library for probabilistic reasoning and statisticalanalysis in TensorFlow. As part of the TensorFlow ecosystem, TensorFlowProbability provides integration of probabilistic methods with deep networks,gradient-based inference via automatic differentiation, and scalability tolarge datasets and models via hardware acceleration (e.g., GPUs) and distributedcomputation.

TFP also works as "Tensor-friendly Probability" in pure JAX!:from tensorflow_probability.substrates import jax as tfp --Learn morehere.

Our probabilistic machine learning tools are structured as follows.

Layer 0: TensorFlow. Numerical operations. In particular, the LinearOperatorclass enables matrix-free implementations that can exploit special structure(diagonal, low-rank, etc.) for efficient computation. It is built and maintainedby the TensorFlow Probability team and is now part oftf.linalgin core TF.

Layer 1: Statistical Building Blocks

Layer 2: Model Building

  • Joint Distributions (e.g.,tfp.distributions.JointDistributionSequential):Joint distributions over one or more possibly-interdependent distributions.For an introduction to modeling with TFP'sJointDistributions, check outthis colab
  • Probabilistic Layers (tfp.layers):Neural network layers with uncertainty over the functions they represent,extending TensorFlow Layers.

Layer 3: Probabilistic Inference

TensorFlow Probability is under active development. Interfaces may change at anytime.

Examples

Seetensorflow_probability/examples/for end-to-end examples. It includes tutorial notebooks such as:

It also includes example scripts such as:

Representation learning with a latent code and variational inference.

Installation

For additional details on installing TensorFlow, guidance installingprerequisites, and (optionally) setting up virtual environments, see theTensorFlow installation guide.

Stable Builds

To install the latest stable version, run the following:

# Notes:# - The `--upgrade` flag ensures you'll get the latest version.# - The `--user` flag ensures the packages are installed to your user directory#   rather than the system directory.# - TensorFlow 2 packages require a pip >= 19.0python -m pip install --upgrade --user pippython -m pip install --upgrade --user tensorflow tensorflow_probability

For CPU-only usage (and a smaller install), install withtensorflow-cpu.

To use a pre-2.0 version of TensorFlow, run:

python -m pip install --upgrade --user"tensorflow<2""tensorflow_probability<0.9"

Note: SinceTensorFlow isnot includedas a dependency of the TensorFlow Probability package (insetup.py), you mustexplicitly install the TensorFlow package (tensorflow ortensorflow-cpu).This allows us to maintain one package instead of separate packages for CPU andGPU-enabled TensorFlow. See theTFP release notes for moredetails about dependencies between TensorFlow and TensorFlow Probability.

Nightly Builds

There are also nightly builds of TensorFlow Probability under the pip packagetfp-nightly, which depends on one oftf-nightly ortf-nightly-cpu.Nightly builds include newer features, but may be less stable than theversioned releases. Both stable and nightly docs are availablehere.

python -m pip install --upgrade --user tf-nightly tfp-nightly

Installing from Source

You can also install from source. This requires theBazel build system. It is highly recommended that you installthe nightly build of TensorFlow (tf-nightly) before trying to buildTensorFlow Probability from source. The most recent version of Bazel that TFPcurrently supports is 6.4.0; support for 7.0.0+ is WIP.

# sudo apt-get install bazel git python-pip  # Ubuntu; others, see above links.python -m pip install --upgrade --user tf-nightlygit clone https://github.com/tensorflow/probability.gitcd probabilitybazel build --copt=-O3 --copt=-march=native :pip_pkgPKGDIR=$(mktemp -d)./bazel-bin/pip_pkg$PKGDIRpython -m pip install --upgrade --user$PKGDIR/*.whl

Community

As part of TensorFlow, we're committed to fostering an open and welcomingenvironment.

See theTensorFlow Community page formore details. Check out our latest publicity here:

Contributing

We're eager to collaborate with you! SeeCONTRIBUTING.mdfor a guide on how to contribute. This project adheres to TensorFlow'scode of conduct. By participating, you are expected touphold this code.

References

If you use TensorFlow Probability in a paper, please cite:

  • TensorFlow Distributions. Joshua V. Dillon, Ian Langmore, Dustin Tran,Eugene Brevdo, Srinivas Vasudevan, Dave Moore, Brian Patton, Alex Alemi, MattHoffman, Rif A. Saurous.arXiv preprint arXiv:1711.10604, 2017.

(We're aware there's a lot more to TensorFlow Probability than Distributions, but the Distributions paper lays out our vision and is a fine thing to cite for now.)


[8]ページ先頭

©2009-2025 Movatter.jp