【问题标题】:How to get the predictions of the textdata in fasttext python?如何在fasttext python中获取文本数据的预测?
【发布时间】:2020-08-13 12:02:22
【问题描述】:

我正在为 fasttext 中的文本分类构建一个监督模型。

为了预测特定字符串的输出,我们可以在 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>

【问题讨论】:

    标签: python machine-learning nlp fasttext


    【解决方案1】:

    我找到了解决办法

    def predict(row):
        return model.predict(row['input'])
    test['predictions'] = test.apply(predict,axis=1)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-19
      • 1970-01-01
      • 2021-12-11
      • 2019-05-06
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      相关资源
      最近更新 更多