【发布时间】:2020-05-21 17:34:41
【问题描述】:
我尝试使用scipy.stats.multivariate_normal() 来评估点 x 处的 pdf,以获得不同的平均值和标准差值。但是,它不广播。
最小的工作示例
import numpy as np
from scipy import stats
# A single x where I want to evaluate it at
x = np.array([1.0])
# Multiple means where I want to evaluate the PDF at
means = np.array([1.0, 10.0])
standard_deviations = np.array([1.0, 2.0])
# If I use the stats function, it evaluates only at one point
stats.multivariate_normal.pdf(x=x, mean=means, cov=np.diag(means**2))
【问题讨论】:
-
您使用哪个版本的 SciPy?因为上面生成:
TypeError: pdf() got an unexpected keyword argument 'means' -
您只指定了一个多元正态分布。您想用两种不同的正态分布评估 x 的 pdf 吗?
-
@FBruzzesi 基本上我有一个观点
x=np.array([1.0]),我想评估大量的单变量正态分布。这些分布由均值和方差指定,我存储在均值向量和标准差向量中