Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 关于多维数组唯一数的计数输出_Python_Numpy_Scipy - Fatal编程技术网

Python 关于多维数组唯一数的计数输出

Python 关于多维数组唯一数的计数输出,python,numpy,scipy,Python,Numpy,Scipy,预测模型生成多维数组。我想检查这个数组的值。这是我的密码 print('Predictions shape ',predictions.shape) unique_items, counts = np.unique(predictions,return_counts=True) print('unique_items ',unique_items) print('counts ',counts) 这就是结果。我不太理解用黄色标记的

预测模型生成多维数组。我想检查这个数组的值。这是我的密码

    print('Predictions shape ',predictions.shape)        
    unique_items, counts = np.unique(predictions,return_counts=True)        
    print('unique_items ',unique_items)
    print('counts ',counts)
这就是结果。我不太理解用黄色标记的输出项。为什么它不能给出准确的值而不是
1…
。谢谢


这只是numpy阵列的打印输出

您可以自己设置
线宽
边缘

试试这个:

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)
另一种方法是将
np.array
转换为
list
并打印()


这只是numpy阵列的打印输出

您可以自己设置
线宽
边缘

试试这个:

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)
另一种方法是将
np.array
转换为
list
并打印()


不是值估计。这仅仅意味着数组被连接到屏幕上。只显示前几个和最后几个元素。您想知道为什么打印输出是这样的吗?这只是因为阵列的长度对于控制台来说太长。尝试使用
打印唯一的\u项[0:5]
不是值估计。这仅仅意味着数组被连接到屏幕上。只显示前几个和最后几个元素。您想知道为什么打印输出是这样的吗?这只是因为阵列的长度对于控制台来说太长。尝试打印唯一的\u项[0:5]