brightmart / text_classification

all kinds of text classification models and more with deep learning
MIT License
7.87k stars 2.57k forks source link

p7_TextCNN_train.py运行中出现ValueError #118

Open haoshuangzhuang opened 5 years ago

haoshuangzhuang commented 5 years ago

python2.7+tensorflow1.8环境运行p7_TextCNNtrain.py 问题一:出现ValueError错误: predict += logits[0] ValueError: operands could not be broadcast together with shapes (0,) (1999,) 此处见Issues中出现类似错误,回答是改成predict.extend[logits] 问题二:新错误: , _, f1_macro, f1micro, = 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 commented 5 years ago

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