• Register
0 votes
2.8k views

Problem :

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

Please log in or register to answer this question.

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
38.6k points

Related questions

0 votes
1 answer 99 views
99 views
Problem: HELP: deprecationwarning: elementwise == comparison failed; this will raise an error in the future.
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 21 views
21 views
Problem: Please,I want an answer : What is random_state in train_test_split?
asked Jun 3 Chi Omega 168k points
0 votes
1 answer 41 views
41 views
Problem: I am running into the following error when trying to train this on this dataset. Since this is the configuration published in the paper, I am assuming I am doing something incredibly wrong. This error arrives on a ... expanded_input, expanded_target, _Reduction.get_enum(reduction)) RuntimeError: reduce failed to synchronize: cudaErrorAssert: device-side assert triggered Any ideas?
asked May 1 anika11 32.2k points
0 votes
1 answer 38 views
38 views
Problem: I am having a serious problem; Can anyone assist me?: This will throw an error in a future version of php .
asked May 20 Isac Christiaan 103k points
1 vote
1 answer 13 views
13 views
Problem: Everytime I run a svmlight command I get the following error : DeprecationWarning: using a non-integer number instead of an integer will result in an error >in the future How can I solve this ? I’m using python 2.7.5 along with scikit_learn-0.14 on my Mac OSX Mountain Lion.
asked Apr 25 Raj Tyagi 16k points
0 votes
1 answer 1.5k views
1.5k views
Problem: np.nan is an invalid document, expected byte or unicode string.
asked Feb 21 charles mathews 5.5k points
0 votes
1 answer 5 views
5 views
Problem: Tf.nn.softmax_cross_entropy_with_logits?
asked Jul 22 Nahil 128k points
0 votes
1 answer 2 views
2 views
Problem: Update your `dense` call to the keras 2 api
asked Jul 12 asha 121k points
0 votes
1 answer 8 views
8 views
Probelm: Which language is best for machine learning?
asked Jul 10 Mezbah 130k points
0 votes
1 answer 1 view
1 view
Problem: Tensorflow softmax_cross_entropy_with_logits
asked Jul 10 asha 121k points