text_classification icon indicating copy to clipboard operation
text_classification copied to clipboard

fixed f1 score后的TextCNN_train.py中出现操作ValueError

Open GUOXINTONG opened this issue 6 years ago • 2 comments
trafficstars

line 137: predict = [] line 145: predict += logits[0]

会报错:operands could not be broadcast together with shapes (0,) (n,) (n是label个数)

原因应该是在循环中空数组和预测值logits的第0维相加出现了维度问题。 我改成了 line 137: predict = np.zeros(n) 解决 不知道只是我的bug吗还是?

GUOXINTONG avatar May 12 '19 20:05 GUOXINTONG

我也出现了这样的问题

lilyhong420 avatar Jun 28 '19 19:06 lilyhong420

不太明白为何只加logits[0] 应该把logits全部的结果列表起来与vaild_y计算F1才是?

另外logits的值是sigmoid后的结果?

TingNLP avatar Aug 15 '19 15:08 TingNLP