python - Numpy squeeze - 'list' object has no attribute ...
stackoverflow.com › questions › 50730780Jun 07, 2018 · Returns the following error: Traceback (most recent call last): File "C:\Users\leonardo.schettini\Documents\recrutai\recrutai\testenv\lib\site-packages umpy\core\fromnumeric.py", line 1240, in squeeze squeeze = a.squeeze AttributeError: 'list' object has no attribute 'squeeze' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\leonardo.
confusion_matrix error 'list' object has no attribute 'argmax'
stackoverflow.com › questions › 66831635Mar 27, 2021 · 2. This answer is not useful. Show activity on this post. Your predictions is obviously a Python list, and lists do not have an argmax attribute; you need to use the Numpy function argmax (): predictions = [ [0.1, 0.9], [0.8, 0.2]] # dummy data y_pred_binary = predictions.argmax (axis=1) # AttributeError: 'list' object has no attribute 'argmax' # Use Numpy: import numpy as np y_pred_binary = np.argmax (predictions, axis=1) y_pred_binary # array ( [1, 0])