如何获得np.array的准确值?
How to get the exacte value of an np.array?
我刚刚计算了一个概率 np.array:
Proba = [[7.4687206e-10]]
但是当我计算这个概率的补码时,我得到:
Comp = 1- Proba = [[1.]]
预期值为Comp = [[0.99999999925]]
谁能解释一下为什么 np.array 没有给出确切的值,我应该怎么做才能获得想要的值。
谢谢!!!
值正确。这就是它的印刷方式。试试这个
np.set_printoptions(precision=15)
Proba = np.array([[7.4687206e-10]])
output = 1 - Proba
print(output)
在你的代码之前
您可以 comp[0][0]
简单地或
如果你的 np 数组是这样的 [[2],[3],[5]...]
这样做
comp = [i for j in comp for i in j]
我刚刚计算了一个概率 np.array:
Proba = [[7.4687206e-10]]
但是当我计算这个概率的补码时,我得到:
Comp = 1- Proba = [[1.]]
预期值为Comp = [[0.99999999925]]
谁能解释一下为什么 np.array 没有给出确切的值,我应该怎么做才能获得想要的值。
谢谢!!!
值正确。这就是它的印刷方式。试试这个
np.set_printoptions(precision=15)
Proba = np.array([[7.4687206e-10]])
output = 1 - Proba
print(output)
在你的代码之前
您可以 comp[0][0]
简单地或
如果你的 np 数组是这样的 [[2],[3],[5]...]
这样做
comp = [i for j in comp for i in j]