`scipy.stats.multivariate_normal.pdf(...)`意外产生[0,1]以外的值 [英] `scipy.stats.multivariate_normal.pdf(...)` produce a value outside of [0,1] unexpectedly

查看:419
本文介绍了`scipy.stats.multivariate_normal.pdf(...)`意外产生[0,1]以外的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import scipy.stats
means = [2,2]
covariance = [[0.0020, 0.0008],
              [0.0008, 0.0020]]
scipy.stats.multivariate_normal(means, covaraince).pdf([2,2])
> 86.82613975535709

有关上述代码的两个问题:

Two questions about the above code:

  • In the documentation the pdf function allows you to (re?) define the mean and covariance. I don't understand that, the mean and covariance was defined in multivariate_normal(...) already. Why re-define it in the pdf function?

第二,对pdf([2,2])的调用结果远远超过1,但是PDF必须产生范围为[0,1]的结果.我必须在这里误解.

Second, the result of the call to pdf([2,2]) is well over 1, but a PDF must produce a result in the range [0,1]. I must misunderstand something here.

推荐答案

PDF原则上可以采用任何非负值,只要它可以集成为一个即可.您得到的结果是正确的.

A PDF can in principle take any non-negative value, as long as it integrates to one. The result you are getting is correct.

代表@Stelios的评论发表评论

Posted on behalf of @Stelios's answer in comments

这篇关于`scipy.stats.multivariate_normal.pdf(...)`意外产生[0,1]以外的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆