BrikerMan / Kashgari

Kashgari is a production-level NLP Transfer learning framework built on top of tf.keras for text-labeling and text-classification, includes Word2Vec, BERT, and GPT2 Language Embedding.
http://kashgari.readthedocs.io/
Apache License 2.0
2.39k stars 441 forks source link

英文预测结果问题 #405

Closed Jiannan28 closed 4 years ago

Jiannan28 commented 4 years ago

做英语的多class预测(根据这篇文章https://medium.com/@BrikerMan/multi-class-text-classification-with-kashgari-in-15mins-c3e744ce971d), new_model.predict(x)预测的时候会根据每个词预测出一个结果,而不是根据整个句子。是否需要把整个句子不分词,然后放到一个list里边做预测呢?

Mac OS Python 3.7

BrikerMan commented 4 years ago

这里可能有误,model.predict(x) 这里的 x 是一组样本,也就是 n 个被分词过的句子。当只有一个句子的时候,输入应该是 model.predict([sentence])

Jiannan28 commented 4 years ago

多谢!

james-robinhood commented 3 years ago

跟进一下这个问题。在新版本里如何可以输出top k的结果或者直接输出所有的概率而不是argmax?