Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p7_TextCNN_train.py运行中出现ValueError #118

Open
haoshuangzhuang opened this issue Apr 29, 2019 · 1 comment
Open

p7_TextCNN_train.py运行中出现ValueError #118

haoshuangzhuang opened this issue Apr 29, 2019 · 1 comment

Comments

@haoshuangzhuang
Copy link

haoshuangzhuang commented Apr 29, 2019

python2.7+tensorflow1.8环境运行p7_TextCNN_train.py
问题一:出现ValueError错误:
predict += logits[0]
ValueError: operands could not be broadcast together with shapes (0,) (1999,)
此处见Issues中出现类似错误,回答是改成predict.extend[logits]
问题二:新错误:
_, _, f1_macro, f1_micro, _ = fastF1(predict, evalY)
ZeroDivisionError: integer division or modulo by zero
其中是因为p_total=0,而r_total=17664;
问题三:
if values == trueValue:
recallNum += 1
if values == predict[index]:
trueNum += 1
if predict[index] == trueValue:
precisionNum += 1
在统计fastF1的源码中,这段代码中values == trueValue与predict[index] == trueValue
为什么是拿一个整型数据跟一个一维数组进行==比较?
并且还判断为true
recallNum += 1得到r_total=17664
谢谢大神们指教,谢谢!

@TingNLP
Copy link

TingNLP commented Aug 15, 2019

问题一应修正为小括号
predict.extend(logits)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants