EntitySentiment
EntitySentiment copied to clipboard
Error in base.py
ValueError Traceback (most recent call last)
/Users/Desktop/Python/EntitySentiment-master/nn/base.py in train_sgd(self, X, y, idxiter, alphaiter, printevery, costevery, devidx) 384 printevery=10000, costevery=10000, 385 devidx=None): --> 386 if idxiter==None: # default training schedule 387 idxiter = xrange(len(y)) 388 if alphaiter == None: # default training schedule
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I have the same error:
$ python RunRNN.py
Number of unique words: 9869
Opening the file...
File successfully read
Opening the file...
File successfully read
Opening the file...
File successfully read
Number of training samples 5003
Traceback (most recent call last):
File "RunRNN.py", line 84, in <module>
curve = model.train_sgd(X,Y,idxiter_random,None,400,400)
File "/scratch2/debate_tweets/sentiment/EntitySentiment/nn/base.py", line 386, in train_sgd
if idxiter == None: # default training schedule
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
@tavni96 did you solve it?
Fix with if idxiter is None:
Don't use ==
comparisons when testing for nullity, use is
instead, it's safer and faster.