如何以十为单位计算PDF

2024-09-30 04:37:15 发布

您现在位置:Python中文网/ 问答频道 /正文

在Matlab中,我可以用

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)

输出:

^{pr2}$

使用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值输入到这个分布中?得到相似的输出。在


Tags: pdftftensorflow错误pluscontribvariablesigma
2条回答

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

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

有关详细信息,请参见this。在

此函数pdf更新为prob

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

相关问题 更多 >

    热门问题