【问题标题】:AWS Comprehend custom classification job output has more rows than inputAWS Comprehend 自定义分类作业输出的行数多于输入行数
【发布时间】:2019-10-07 19:43:27
【问题描述】:

我使用 AWS Comprehend 训练了一个 NLP 模型。测试集上的预测运行成功,但输出文件的行数多于输入:

输入:1000 行

输出:2082 行

输出如下所示:

predictions.json <...>
{"File": "test.csv", "Line": "0", "Classes": [{"Name": "No", "Score": 0.7022}, {"Name": "Yes", "Score": 0.2892}, {"Name": "tag", "Score": 0.0086}]}
{"File": "test.csv", "Line": "1", "Classes": [{"Name": "No", "Score": 0.6252}, {"Name": "Yes", "Score": 0.3747}, {"Name": "tag", "Score": 0.0001}]}
{"File": "test.csv", "Line": "2", "Classes": [{"Name": "No", "Score": 0.9295}, {"Name": "Yes", "Score": 0.0705}, {"Name": "tag", "Score": 0.0}]}
{"File": "test.csv", "Line": "3", "Classes": [{"Name": "No", "Score": 0.5247}, {"Name": "Yes", "Score": 0.4753}, {"Name": "tag", "Score": 0.0}]}
...
{"File": "test.csv", "Line": "2080", "Classes": [{"Name": "No", "Score": 0.8528}, {"Name": "Yes", "Score": 0.1471}, {"Name": "tag", "Score": 0.0001}]}
{"File": "test.csv", "Line": "2081", "Classes": [{"Name": "No", "Score": 0.5318}, {"Name": "Yes", "Score": 0.4682}, {"Name": "tag", "Score": 0.0}]}

谁能帮助我如何使用输出?

【问题讨论】:

  • 我正在尝试了解自定义分类器训练数据步骤 - 你能分享你训练数据中的样本行吗?

标签: amazon-web-services amazon-comprehend


【解决方案1】:

我遇到了同样的问题。在我的情况下,错误是因为预测文件(在你的情况下为 Test.csv)不是指定的编码。 AWS Comprehend 需要 - “UTF-8”编码。
AWS Docs Link

【讨论】:

    【解决方案2】:

    一个选项是将每个句子拆分到不同的文件中,并使用整个文件夹作为测试集,修复选项:

     "InputFormat": "ONE_DOC_PER_FILE"
    

    其他选项是尝试找出数据集中有多少个“/n”,错误可能是这个。

    【讨论】:

      【解决方案3】:

      在我的例子中,除了 UTF-8 之外,文本中还存在回车符\r

      【讨论】:

        猜你喜欢
        • 2021-06-27
        • 2019-02-18
        • 2020-03-05
        • 2019-05-19
        • 2020-07-18
        • 1970-01-01
        • 2016-07-18
        • 1970-01-01
        • 2019-01-16
        相关资源
        最近更新 更多