Questions tagged [tensorflow-probability]

For questions about TensorFlow Probability (a library for probabilistic reasoning and statistical analysis in TensorFlow), TF probability distributions (everything in `tf.distributions` and `tf.contrib.distributions`), use of Edward2 in Tensorflow and general probability related issues with Tensorflow.

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

253 questions
16
votes
1 answer

TypeError: An op outside of the function building code is being passed a Graph tensor

I am getting the following exception TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including a tf.init_scope in your…
nbro
  • 12,226
  • 19
  • 85
  • 163
11
votes
1 answer

What does the property losses of the Bayesian layers of TensorFlow Probability represent?

I am running the example code on Bayesian Neural Network implemented using Tensorflow Probability. My question is about the implementation of the ELBO loss used for variational inference. The ELBO equals the summation of two terms, namely…
rort1989
  • 253
  • 2
  • 9
6
votes
0 answers

Non-linear optimization with Tensorflow-probability

I'm trying to implement a Gaussian fitting using TensorFlow-probability's Nelder-Mead optimizer: tfp.optimizer.nelder_mead_minimize(). It does not converge, while scipy.optimizer.minimize() provide good result in less than 1 second of computation…
Anais
  • 69
  • 3
6
votes
1 answer

Variable tf.Variable has 'None' for gradient in TensorFlow Probability

I'm having trouble constructing a basic BNN in TFP. I'm new to TFP and BNNs in general, so I apologize if I've missed something simple. I can train a basic NN in Tensorflow by doing the following: model = keras.Sequential([ …
mackdelany
  • 158
  • 1
  • 7
4
votes
1 answer

Getting AttributeError: 'Tensor' object has no attribute 'log_prob' while saving a tensorflow model

I am trying to save a variational autoencoder built using TensorFlow and Tensorflow probability. My goal is to serve the model using TensorFlow serving. I am open to serving the model in other fashion. Here is my model: def…
4
votes
2 answers

Problem with "Regression with Probabilistic Layers in TensorFlow Probability"

I'm having trouble using tfp.layers.DistributionLambda, I'm a TF newbie trying hard to make the tensors flow. Can someone please provide some insights into how to set up the output distribution's parameters? Context: TFP team wrote a tutorial on…
Zilong Z
  • 441
  • 3
  • 10
4
votes
2 answers

Is there a way to call a Numpy function inside a TensorFlow session?

I am trying to implement a Expectation Maximization algorithm using TensorFlow and TensorFlow Probability. It worked very well until I tried to implement Missing Data (data can contain NaN values in some random dimensions). The problem is that with…
Iago GR
  • 127
  • 10
4
votes
1 answer

Reparametrization in tensorflow-probability: tf.GradientTape() doesn't calculate the gradient with respect to a distribution's mean

In tensorflow version 2.0.0-beta1, I am trying to implement a keras layer which has weights sampled from a normal random distribution. I would like to have the mean of the distribution as trainable parameter. Thanks to the "reparametrization trick"…
I. Schubert
  • 306
  • 1
  • 9
4
votes
3 answers

No module named 'tensorflow_probability'

I need to use Tensorflow and Tensorflow_Probability. After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook: import tensorflow_probability as tfp but it…
Ham82
  • 535
  • 3
  • 12
4
votes
1 answer

What are the losses associated with the losses property of the Bayesian layers, in TensorFlow Probability?

TensorFlow Probability layers (e.g. DenseFlipout) have a losses method (or property) which gets the "losses associated with this layer." Can someone explain what these losses are? After browsing the Flipout paper, I think the losses refer to the…
4
votes
0 answers

How to obtain prediction results in edward

Thank you for this community. I am a beginner and I have a very dumb question on using Edward. I am using a tutorial regression model. Everything is perfect. I was wondering how to obtain the prediction on testing set. for example, assuming y =…
Sufeng Niu
  • 619
  • 1
  • 5
  • 9
3
votes
0 answers

Extract learned NN posterior weight distribution parameters from DenseVariational layer

I also posted this question in the tensorflow probability Github issues: https://github.com/tensorflow/probability/issues/892 I'm using Tensorflow 2.1.0 and tensorflow-probability 0.9.0 in python 3.6.8. I'm working with a Tensorflow Probability…
Jed
  • 1,059
  • 13
  • 31
3
votes
2 answers

Specification of Multinomial model in Tensorflow Probability

I am playing with a mixed multinomial discrete choice model in Tensorflow Probability. The function should take an input of a choice among 3 alternatives. The chosen alternative is specified by CHOSEN (a # observationsx3 tensor). Below is an update…
Jason Hawkins
  • 545
  • 1
  • 8
  • 21
3
votes
1 answer

Composition of Joint Distributions in TensorFlow Probability

I am new to probabilistic programming and TFP. I am trying to use it for probabilistic graphical modelling, which appeals to me for its flexibility in breaking down complex models into simpler piecewise explanations. However I am having difficulty…
ocobb
  • 31
  • 4
3
votes
0 answers

How to incorporate many features into a TensorFlow Probability Structural Time Series

I'm new to Tensorflow and Bayesian Structural Time Series and could really use some help figuring out how to train a Multivariate BSTS model that automatically performs feature selection on hundreds of input time series. The TF-Probability BSTS blog…
1
2 3
16 17