本文主要是介绍scipy.stats.multivariate_normal.pdf出错得到的值都为0,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
stats.multivariate_normal.pdf出错得到的值都为0
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
在询问大佬后知道是自己没对数据进行归一化,于是进行最小-最大归一化:
for i in range(data.shape[1]):data[:, i] = (data[:, i] - np.min(data[:, i]))/(np.max(data[:, i]) - np.min(data[:, i]))```然后得到数据的结果为:```python4.18897205e-151 1.13987517e-147 7.95874876e-152 2.76503598e-1503.60511750e-150 1.22062842e-151 4.32507464e-148 8.48378632e-1471.89369872e-149 4.08650124e-151 1.16397418e-151 1.97433124e-1482.50326295e-152 8.45951258e-150 1.09050328e-151 6.12453006e-1501.30832892e-148 3.57198316e-148 7.32707392e-152 2.88311757e-1494.23087527e-150 3.50743660e-147 5.01228125e-152 4.60006743e-1551.66880786e-150 2.25836900e-149 6.99214934e-151 1.12433877e-1489.65085082e-151 1.75663343e-150 4.54378500e-151 2.58133518e-1511.86822206e-152 2.46866331e-149 1.92024022e-150 5.84823915e-1501.08526728e-150 1.78429049e-150 2.72954384e-151 1.05887066e-1506.19816648e-152 2.55543630e-149 1.68227872e-151 2.35171091e-1524.94092057e-150 4.37719530e-153 8.98346236e-151 3.09081960e-1491.91240302e-151 5.67875277e-150 3.52593604e-152 1.40562605e-1513.35137957e-151 3.59156927e-150 1.04469753e-148 1.71450947e-1493.80058501e-152 4.49601925e-151 8.07742712e-151 1.45082037e-1491.93214713e-150 2.86300791e-150 1.44660116e-151 3.57894551e-1509.71405710e-151 3.81059833e-149 1.34318664e-148 4.49197395e-148]
注意:mean不能取的太大,否则还是会得到0值
这篇关于scipy.stats.multivariate_normal.pdf出错得到的值都为0的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!