• Register
0 votes
875 views

Problem :

I am finding solution on following issue
deprecationwarning: elementwise == comparison failed; this will raise an error in the future.
6.9k points

1 Answer

0 votes

Solution :

I guess the error occurs in this expression:

np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1))

In numpy you can compare arrays of the same size only  but it is treaky when it comes to comparing arrays that do not match in size:

e.g.

In [522]: np.arange(10)==np.arange(5,15)
Out[522]: array([False, False, False, False, False, False, False, False, False, False], dtype=bool)
In [523]: np.arange(10)==np.arange(5,14)
/usr/local/bin/ipython3:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
  #!/usr/bin/python3
Out[523]: False
36.1k points

Related questions

0 votes
1 answer 31 views
31 views
Problem : I am new to python. I have tried to install below softwares: Python 2.5.4, Numpy 1.5.0 win32, Matplotlib 1.0.0 win32, pywin32 218. After doing so much of hard work I am still unable to plot the graphs in Python. I am facing ... > from matplotlib._path import affine_transform ImportError: DLL load failed: The specified module could not be found. Can somebody help me in fixing this error?
asked Feb 22 mphil 2.3k points
0 votes
2 answers 889 views
889 views
Problem : I got following rather cryptic error message: the truth value of an array with more than one element is ambiguous. use a.any() or a.all()
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
1 answer 314 views
314 views
Problem : I want to learn the Machine Learning but I am unabe to resolve below error. My Specs : · Mac High Sierra 10.13.2 · Python3.4.5 · Numpy1.13.3 Used below Command: $ python3 -c "import jupyter, matplotlib, numpy, pandas, scipy, sklearn" I am ... to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 162 views
162 views
Problem : I am trying to execute below commands. import numpy as np import cv But I am getting following error on my console: >>> runfile('/Users/isaiahnields/.spyder2/temp.py', wdir='/Users/isaiahnields/.spyder2') RuntimeError: module compiled against API version a but this ... it is not working. I had added cv.py to the python2.7 folder in Spyder-Py2 is there anything else I need to add?
asked Dec 4, 2019 alecxe 7.5k points
1 vote
1 answer 208 views
208 views
Problem : Currently I am learning r. I have the data table "normal" which has the numeric as far as I know normalized values. If I try to execute the below command k <- kmeans(normal,center=3) Then I always face the below error: &ldquo;Error in do_one(nmeth) : NA/NaN/ ... call (arg 1)&rdquo; I am trying to fix it by researching on it but still unable to fix it. Can somebody help me in fixing it?
asked Mar 28 morrisBson 3.2k points