我该如何解决此错误?似乎是此存储库中未解决的问题:https://github.com/shayanzare007/EntitySentiment/issues/7
$ 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()
答案 0 :(得分:2)
在测试对象的无效性时,建议的做法是始终使用is
:
if idxiter is None:
...
它更安全,特别是因为并非所有对象都支持与None
进行平等比较。