问题描述
要预测特定字符串的输出,我们可以在python中使用它
model.predict("Why not put knives in the dishwasher?")
但是如何通过python命令获得整个测试集的预测?在命令行中可以这样做
./fasttext predict <path to model> <path to test file> k > <path to prediction file>
解决方法
我找到了解决方法
def predict(row):
return model.predict(row['input'])
test['predictions'] = test.apply(predict,axis=1)