如何计算张量流中的PDF

时间:2017-01-25 07:31:29

标签: python statistics tensorflow probability-density

在Matlab中,我可以使用

计算高斯分布的概率密度函数(PDF)
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)

输出:

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

使用tensorflow,我尝试过这个

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)

我收到错误TypeError: pdf missing 1 required positional argument

如何将mu和sigma值输入到此分布中?得到类似的输出。

2 个答案:

答案 0 :(得分:5)

此功能<?php //Suposse that in $content it is the content html of the page $content .= "<p>Lorem ipsum</p>"; echo $content; ?> 更新为pdf

prob

答案 1 :(得分:3)

首先创建一个Normal distributions对象,然后使用pdf方法

dist = tf.contrib.distributions.Normal(1.0, 2.5)
y = dist.pdf(x)

有关详细信息,请参阅this