[英]regarding the output of counting the unique numbers of multi-dimension array
There is a multi-dimensional array generated from a prediction model. 存在从预测模型生成的多维阵列。 I would like to check the values of this array.
我想检查一下这个数组的值。 Here is my code.
这是我的代码。
print('Predictions shape ',predictions.shape)
unique_items, counts = np.unique(predictions,return_counts=True)
print('unique_items ',unique_items)
print('counts ',counts)
This is the result. 这是结果。 I do not quite understand the output item marked with yellow.
我不太明白标有黄色的输出项目。 Why it cannot give the exact value instead of
1...
. 为什么它不能给出确切的值而不是
1...
Thanks. 谢谢。
This is just the print output of a numpy array. 这只是numpy数组的打印输出。
You can set the linewidth
and edgeitems
yourself numpy.set_printoptions 您可以自己设置
linewidth
和edgeitems
numpy.set_printoptions
Try this: 尝试这个:
import numpy as np
np.set_printoptions(linewidth=1000, edgeitems=5)
predictions = np.random.rand(3249, 4096, 2)
print('Predictions shape ',predictions.shape)
unique_items, counts = np.unique(predictions,return_counts=True)
print('unique_items ',unique_items)
print('counts ',counts)
Another way would be to convert np.array
to list
and print that ( docs ) 另一种方法是将
np.array
转换为list
并打印( docs )
# beware, this takes like forever :)
print('unique_items ',unique_items.tolist())
print('counts ',counts.tolist())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.