fastText原理和文本分类实战
https://blog.csdn.net/feilong_csdn/article/details/88655927
Python interface
https://github.com/salestock/fastText.py
import fasttext
root_path = "/Users/documents/"
train_file = root_path + "target.train"
valid_file = root_path + "target.valid"
model_save_path = root_path + "model_py"
def showResult(classifier, valid_file):
result = classifier.test(valid_file)
print("Number of examples:", result[0])
print("P@1:", result[1])
print("R@1:", result[2])
classifier = fasttext.train_supervised(input=train_file, epoch=15)
#classifier.save_model(model_save_path)
#classifier = fasttext.load_model(model_save_path)
showResult(classifier, valid_file)
result = classifier.predict("股票失败")
print(result)
来源:CSDN
作者:jingyi130705008
链接:https://blog.csdn.net/jingyi130705008/article/details/104008780