Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to calculate PDF in tensorflow

In Matlab, I can calculate the probability density function(PDF) of Gaussian distribution by using

x = [0.8147,0.9058,0.1270,0.9134,0.6324,0.0975,0.2785,0.5469,0.9575,0.9649]
y = normpdf(x,1.0,2.5)

output:

y = 0.1591    0.1595    0.1501    0.1595    0.1579    0.1495    0.1531    0.1570    0.1596    0.1596

Using tensorflow, I have tried with this

x = tf.variable([0.8147,0.9058,0.1270,0.9134,0.6324,0.0975,0.2785,0.5469,0.9575,0.9649],tf.float32)
y = tf.contrib.distributions.NormalWithSoftplusSigma.pdf(x)

I get an error TypeError: pdf missing 1 required positional argument

how to input the mu and sigma values to this distribution ? to get the similar output.

like image 879
Raady Avatar asked Feb 06 '23 06:02

Raady


1 Answers

This function pdf is updated as prob:

dist = tf.contrib.distributions.Normal(1.0, 2.5) 
y = dist.prob(x)
like image 193
daniel.kaifeng Avatar answered Feb 08 '23 14:02

daniel.kaifeng