Communications Mining
latest
false
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。
Communications Mining 開発者ガイド
Last updated 2024年7月19日

予測

ピン留めされたモデルの予測を取得する

/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict

必要な権限: ラベルの表示、ソースの表示

重要:

請求対象の操作

要求本文で提供されるコメントごとに 1 AI ユニットが課金されます。

  • bash
    curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nCould you send me the figures for today?"
              },
              "from": "alice@company.com",
              "sent_at": "2020-01-09T16:34:45Z",
              "signature": {
                "text": "Thanks,\nAlice"
              },
              "subject": {
                "text": "Figures Request"
              },
              "to": [
                "bob@organisation.org"
              ]
            }
          ],
          "timestamp": "2013-09-12T20:01:20.000000+00:00",
          "user_properties": {
            "string:City": "London"
          }
        },
        {
          "messages": [
            {
              "body": {
                "text": "Alice,\n\nHere are the figures for today."
              },
              "from": "bob@organisation.org",
              "sent_at": "2020-01-09T16:44:45Z",
              "signature": {
                "text": "Regards,\nBob"
              },
              "subject": {
                "text": "Re: Figures Request"
              },
              "to": [
                "alice@company.com"
              ]
            }
          ],
          "timestamp": "2011-12-12T10:04:30.000000+00:00",
          "user_properties": {
            "string:City": "Bucharest"
          }
        }
      ],
      "threshold": 0.25
    }'curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nCould you send me the figures for today?"
              },
              "from": "alice@company.com",
              "sent_at": "2020-01-09T16:34:45Z",
              "signature": {
                "text": "Thanks,\nAlice"
              },
              "subject": {
                "text": "Figures Request"
              },
              "to": [
                "bob@organisation.org"
              ]
            }
          ],
          "timestamp": "2013-09-12T20:01:20.000000+00:00",
          "user_properties": {
            "string:City": "London"
          }
        },
        {
          "messages": [
            {
              "body": {
                "text": "Alice,\n\nHere are the figures for today."
              },
              "from": "bob@organisation.org",
              "sent_at": "2020-01-09T16:44:45Z",
              "signature": {
                "text": "Regards,\nBob"
              },
              "subject": {
                "text": "Re: Figures Request"
              },
              "to": [
                "alice@company.com"
              ]
            }
          ],
          "timestamp": "2011-12-12T10:04:30.000000+00:00",
          "user_properties": {
            "string:City": "Bucharest"
          }
        }
      ],
      "threshold": 0.25
    }'
    
  • ノード
    const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              messages: [
                {
                  body: {
                    text: "Hi Bob,\n\nCould you send me the figures for today?",
                  },
                  from: "alice@company.com",
                  sent_at: "2020-01-09T16:34:45Z",
                  signature: { text: "Thanks,\nAlice" },
                  subject: { text: "Figures Request" },
                  to: ["bob@organisation.org"],
                },
              ],
              timestamp: "2013-09-12T20:01:20.000000+00:00",
              user_properties: { "string:City": "London" },
            },
            {
              messages: [
                {
                  body: { text: "Alice,\n\nHere are the figures for today." },
                  from: "bob@organisation.org",
                  sent_at: "2020-01-09T16:44:45Z",
                  signature: { text: "Regards,\nBob" },
                  subject: { text: "Re: Figures Request" },
                  to: ["alice@company.com"],
                },
              ],
              timestamp: "2011-12-12T10:04:30.000000+00:00",
              user_properties: { "string:City": "Bucharest" },
            },
          ],
          threshold: 0.25,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              messages: [
                {
                  body: {
                    text: "Hi Bob,\n\nCould you send me the figures for today?",
                  },
                  from: "alice@company.com",
                  sent_at: "2020-01-09T16:34:45Z",
                  signature: { text: "Thanks,\nAlice" },
                  subject: { text: "Figures Request" },
                  to: ["bob@organisation.org"],
                },
              ],
              timestamp: "2013-09-12T20:01:20.000000+00:00",
              user_properties: { "string:City": "London" },
            },
            {
              messages: [
                {
                  body: { text: "Alice,\n\nHere are the figures for today." },
                  from: "bob@organisation.org",
                  sent_at: "2020-01-09T16:44:45Z",
                  signature: { text: "Regards,\nBob" },
                  subject: { text: "Re: Figures Request" },
                  to: ["alice@company.com"],
                },
              ],
              timestamp: "2011-12-12T10:04:30.000000+00:00",
              user_properties: { "string:City": "Bucharest" },
            },
          ],
          threshold: 0.25,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "documents": [
                {
                    "messages": [
                        {
                            "from": "alice@company.com",
                            "to": ["bob@organisation.org"],
                            "sent_at": "2020-01-09T16:34:45Z",
                            "body": {
                                "text": "Hi Bob,\n\nCould you send me the figures for today?"
                            },
                            "subject": {"text": "Figures Request"},
                            "signature": {"text": "Thanks,\nAlice"},
                        }
                    ],
                    "timestamp": "2013-09-12T20:01:20.000000+00:00",
                    "user_properties": {"string:City": "London"},
                },
                {
                    "messages": [
                        {
                            "from": "bob@organisation.org",
                            "to": ["alice@company.com"],
                            "sent_at": "2020-01-09T16:44:45Z",
                            "body": {
                                "text": "Alice,\n\nHere are the figures for today."
                            },
                            "subject": {"text": "Re: Figures Request"},
                            "signature": {"text": "Regards,\nBob"},
                        }
                    ],
                    "timestamp": "2011-12-12T10:04:30.000000+00:00",
                    "user_properties": {"string:City": "Bucharest"},
                },
            ],
            "threshold": 0.25,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "documents": [
                {
                    "messages": [
                        {
                            "from": "alice@company.com",
                            "to": ["bob@organisation.org"],
                            "sent_at": "2020-01-09T16:34:45Z",
                            "body": {
                                "text": "Hi Bob,\n\nCould you send me the figures for today?"
                            },
                            "subject": {"text": "Figures Request"},
                            "signature": {"text": "Thanks,\nAlice"},
                        }
                    ],
                    "timestamp": "2013-09-12T20:01:20.000000+00:00",
                    "user_properties": {"string:City": "London"},
                },
                {
                    "messages": [
                        {
                            "from": "bob@organisation.org",
                            "to": ["alice@company.com"],
                            "sent_at": "2020-01-09T16:44:45Z",
                            "body": {
                                "text": "Alice,\n\nHere are the figures for today."
                            },
                            "subject": {"text": "Re: Figures Request"},
                            "signature": {"text": "Regards,\nBob"},
                        }
                    ],
                    "timestamp": "2011-12-12T10:04:30.000000+00:00",
                    "user_properties": {"string:City": "Bucharest"},
                },
            ],
            "threshold": 0.25,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "entities": [
        [
          {
            "capture_ids": [],
            "formatted_value": "Bob",
            "id": "76aebf2646577a1d",
            "kind": "person",
            "name": "person",
            "probability": null,
            "span": {
              "char_end": 6,
              "char_start": 3,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 12,
              "utf16_byte_start": 6
            }
          },
          {
            "capture_ids": [],
            "formatted_value": "2020-01-09 00:00 UTC",
            "id": "20beddf4c5f5bb61",
            "kind": "date",
            "name": "date",
            "probability": null,
            "span": {
              "char_end": 48,
              "char_start": 43,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 96,
              "utf16_byte_start": 86
            }
          }
        ],
        []
      ],
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        [
          {
            "name": ["Some Label"],
            "probability": 0.8896465003490448
          },
          {
            "name": ["Parent Label", "Child Label"],
            "probability": 0.26687008142471313,
            "sentiment": 0.8762539502232571
          }
        ],
        [
          {
            "name": ["Other Label"],
            "probability": 0.6406207121908665
          }
        ]
      ],
      "status": "ok"
    }{
      "entities": [
        [
          {
            "capture_ids": [],
            "formatted_value": "Bob",
            "id": "76aebf2646577a1d",
            "kind": "person",
            "name": "person",
            "probability": null,
            "span": {
              "char_end": 6,
              "char_start": 3,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 12,
              "utf16_byte_start": 6
            }
          },
          {
            "capture_ids": [],
            "formatted_value": "2020-01-09 00:00 UTC",
            "id": "20beddf4c5f5bb61",
            "kind": "date",
            "name": "date",
            "probability": null,
            "span": {
              "char_end": 48,
              "char_start": 43,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 96,
              "utf16_byte_start": 86
            }
          }
        ],
        []
      ],
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        [
          {
            "name": ["Some Label"],
            "probability": 0.8896465003490448
          },
          {
            "name": ["Parent Label", "Child Label"],
            "probability": 0.26687008142471313,
            "sentiment": 0.8762539502232571
          }
        ],
        [
          {
            "name": ["Other Label"],
            "probability": 0.6406207121908665
          }
        ]
      ],
      "status": "ok"
    }
要求で予測をクエリするモデルのバージョンを指定する必要があります。 整数のバージョン番号、または特殊な値 live または staging を使用して、現在のライブ モデルまたはステージング モデルのバージョンを照会できます。
要求の形式
名前必須説明
documentsarray<Comment>コメントの参照セクションに記載されている形式の、最大 4096 件のドキュメントのバッチです。大きなバッチは小さなバッチよりも (ドキュメント単位で) 高速です。
thresholdNumber×ラベルの結果をフィルター処理する際の基準となる信頼度のしきい値です。 1.0 から 0.0までの数値。0.0 すべての結果が含まれます。 自動しきい値を使用するには、"auto" に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。
labelsarray<Label>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。

ここで Label の形式は次のとおりです。

名前必須説明
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
thresholdNumber×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。
応答の形式
名前説明
statusstringok 要求が成功した場合。エラーの場合は error 。 エラー応答の詳細については、「 概要 」を参照してください。
predictionsarray<array<Label>>要求内のコメントと同じ順序で array<Label> のリスト。各 Label の形式は 、こちらで説明しています。
entitiesarray<array<Entity>>要求内のコメントと同じ順序で array<Entity> のリスト。各 Entity の形式は 、こちらで説明しています。
label_propertiesarray<LabelProperty>このコメントの予測ラベル プロパティを含む配列です。各LabelPropertyには、こちらで説明する形式があります。
modelモデル予測の作成に使用されたモデルに関する情報 ( こちらに記載されている形式)。

生の電子メールのピン留めされたモデルの予測を取得する

/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails

必要な権限: ラベルの表示、ソースの表示

重要:

請求対象の操作

要求本文で提供される直接メールごとに 1 AI ユニットが課金されます。

  • bash
    curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "raw_email": {
            "body": {
              "plain": "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice"
            },
            "headers": {
              "parsed": {
                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                "From": "alice@company.com",
                "Message-ID": "abcdef@company.com",
                "References": "<01234@company.com> <56789@company.com>",
                "Subject": "Figures Request",
                "To": "bob@organisation.org"
              }
            }
          },
          "user_properties": {
            "string:City": "London"
          }
        },
        {
          "raw_email": {
            "body": {
              "html": "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>"
            },
            "headers": {
              "raw": "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com"
            }
          },
          "user_properties": {
            "string:City": "Bucharest"
          }
        }
      ],
      "include_comments": false,
      "threshold": 0.25,
      "transform_tag": "generic.0.CONVKER5"
    }'curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "raw_email": {
            "body": {
              "plain": "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice"
            },
            "headers": {
              "parsed": {
                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                "From": "alice@company.com",
                "Message-ID": "abcdef@company.com",
                "References": "<01234@company.com> <56789@company.com>",
                "Subject": "Figures Request",
                "To": "bob@organisation.org"
              }
            }
          },
          "user_properties": {
            "string:City": "London"
          }
        },
        {
          "raw_email": {
            "body": {
              "html": "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>"
            },
            "headers": {
              "raw": "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com"
            }
          },
          "user_properties": {
            "string:City": "Bucharest"
          }
        }
      ],
      "include_comments": false,
      "threshold": 0.25,
      "transform_tag": "generic.0.CONVKER5"
    }'
    
  • ノード
    const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              raw_email: {
                body: {
                  plain:
                    "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice",
                },
                headers: {
                  parsed: {
                    Date: "Thu, 09 Jan 2020 16:34:45 +0000",
                    From: "alice@company.com",
                    "Message-ID": "abcdef@company.com",
                    References: "<01234@company.com> <56789@company.com>",
                    Subject: "Figures Request",
                    To: "bob@organisation.org",
                  },
                },
              },
              user_properties: { "string:City": "London" },
            },
            {
              raw_email: {
                body: {
                  html: "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>",
                },
                headers: {
                  raw: "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com",
                },
              },
              user_properties: { "string:City": "Bucharest" },
            },
          ],
          include_comments: false,
          threshold: 0.25,
          transform_tag: "generic.0.CONVKER5",
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              raw_email: {
                body: {
                  plain:
                    "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice",
                },
                headers: {
                  parsed: {
                    Date: "Thu, 09 Jan 2020 16:34:45 +0000",
                    From: "alice@company.com",
                    "Message-ID": "abcdef@company.com",
                    References: "<01234@company.com> <56789@company.com>",
                    Subject: "Figures Request",
                    To: "bob@organisation.org",
                  },
                },
              },
              user_properties: { "string:City": "London" },
            },
            {
              raw_email: {
                body: {
                  html: "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>",
                },
                headers: {
                  raw: "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com",
                },
              },
              user_properties: { "string:City": "Bucharest" },
            },
          ],
          include_comments: false,
          threshold: 0.25,
          transform_tag: "generic.0.CONVKER5",
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "transform_tag": "generic.0.CONVKER5",
            "documents": [
                {
                    "raw_email": {
                        "headers": {
                            "parsed": {
                                "Message-ID": "abcdef@company.com",
                                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                                "Subject": "Figures Request",
                                "From": "alice@company.com",
                                "To": "bob@organisation.org",
                                "References": "<01234@company.com> <56789@company.com>",
                            }
                        },
                        "body": {
                            "plain": "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice"
                        },
                    },
                    "user_properties": {"string:City": "London"},
                },
                {
                    "raw_email": {
                        "headers": {
                            "raw": "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com"
                        },
                        "body": {
                            "html": "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>"
                        },
                    },
                    "user_properties": {"string:City": "Bucharest"},
                },
            ],
            "threshold": 0.25,
            "include_comments": False,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-raw-emails",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "transform_tag": "generic.0.CONVKER5",
            "documents": [
                {
                    "raw_email": {
                        "headers": {
                            "parsed": {
                                "Message-ID": "abcdef@company.com",
                                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                                "Subject": "Figures Request",
                                "From": "alice@company.com",
                                "To": "bob@organisation.org",
                                "References": "<01234@company.com> <56789@company.com>",
                            }
                        },
                        "body": {
                            "plain": "Hi Bob,\n\nCould you send me the figures for today?\n\nThanks,\nAlice"
                        },
                    },
                    "user_properties": {"string:City": "London"},
                },
                {
                    "raw_email": {
                        "headers": {
                            "raw": "Message-ID: 012345@company.com\nDate: Thu, 09 Jan 2020 16:44:45 +0000\nSubject: Re: Figures Request\nFrom: bob@organisation.org\nTo: alice@company.com"
                        },
                        "body": {
                            "html": "<p>Alice,</p><p>Here are the figures for today.</p><p>Regards,<br/>Bob</p>"
                        },
                    },
                    "user_properties": {"string:City": "Bucharest"},
                },
            ],
            "threshold": 0.25,
            "include_comments": False,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "entities": [
        [
          {
            "capture_ids": [],
            "formatted_value": "Bob",
            "id": "76aebf2646577a1d",
            "kind": "person",
            "name": "person",
            "probability": null,
            "span": {
              "char_end": 6,
              "char_start": 3,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 12,
              "utf16_byte_start": 6
            }
          },
          {
            "capture_ids": [],
            "formatted_value": "2020-01-09 00:00 UTC",
            "id": "20beddf4c5f5bb61",
            "kind": "date",
            "name": "date",
            "probability": null,
            "span": {
              "char_end": 48,
              "char_start": 43,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 96,
              "utf16_byte_start": 86
            }
          }
        ],
        []
      ],
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        [
          {
            "name": ["Some Label"],
            "probability": 0.8896465003490448
          },
          {
            "name": ["Parent Label", "Child Label"],
            "probability": 0.26687008142471313,
            "sentiment": 0.8762539502232571
          }
        ],
        [
          {
            "name": ["Other Label"],
            "probability": 0.6406207121908665
          }
        ]
      ],
      "status": "ok"
    }{
      "entities": [
        [
          {
            "capture_ids": [],
            "formatted_value": "Bob",
            "id": "76aebf2646577a1d",
            "kind": "person",
            "name": "person",
            "probability": null,
            "span": {
              "char_end": 6,
              "char_start": 3,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 12,
              "utf16_byte_start": 6
            }
          },
          {
            "capture_ids": [],
            "formatted_value": "2020-01-09 00:00 UTC",
            "id": "20beddf4c5f5bb61",
            "kind": "date",
            "name": "date",
            "probability": null,
            "span": {
              "char_end": 48,
              "char_start": 43,
              "content_part": "body",
              "message_index": 0,
              "utf16_byte_end": 96,
              "utf16_byte_start": 86
            }
          }
        ],
        []
      ],
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        [
          {
            "name": ["Some Label"],
            "probability": 0.8896465003490448
          },
          {
            "name": ["Parent Label", "Child Label"],
            "probability": 0.26687008142471313,
            "sentiment": 0.8762539502232571
          }
        ],
        [
          {
            "name": ["Other Label"],
            "probability": 0.6406207121908665
          }
        ]
      ],
      "status": "ok"
    }
要求で予測をクエリするモデルのバージョンを指定する必要があります。 整数のバージョン番号、または特殊な値 live または staging を使用して、現在のライブ モデルまたはステージング モデルのバージョンを照会できます。
要求の形式
名前必須説明
transform_tagstring生データの処理方法を指定するタグ。
documentsarray<Document>以下に記載されている形式の、最大 4096 個のドキュメントのバッチです。大きなバッチは小さなバッチよりも (ドキュメント単位で) 高速です。
thresholdNumber×ラベルの結果をフィルター処理する際の基準となる信頼度のしきい値です。 1.0 から 0.0までの数値。0.0 すべての結果が含まれます。 自動しきい値を使用するには、"auto" に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。
labelsarray<Label>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。
include_commentsBoolean×true に設定すると、メールから解析されたコメントが応答の本文で返されます。
ここで Document の形式は次のとおりです。
名前必須説明
raw_emailRawEmailこちらで説明されている形式のメール データ。
user_propertiesmap<string, string | number>×コメントに適用されるユーザー定義のメタデータです。形式については、こちらをご覧ください。
メモ: 一部のユーザー プロパティは、電子メールの内容に基づいて生成されます。 これらがアップロードされたユーザー プロパティと競合する場合、要求は 422 Unprocessable Entityで失敗します。
ここで Label の形式は次のとおりです。
名前必須説明
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
thresholdNumber×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。
応答の形式
名前説明
statusstringok 要求が成功した場合。エラーの場合は error 。 エラー応答の詳細については、「 概要 」を参照してください。
commentsarray<Comment>アップロードされた生のメールから解析されたコメントのリストです。「 コメントの参照」に記載されている形式で表示されます。 要求に include_comments を設定した場合にのみ返されます。
predictionsarray<array<Label>>要求内のコメントと同じ順序で array<Label> のリスト。各 Label の形式は 、こちらで説明しています。
entitiesarray<array<Entity>>要求内のコメントと同じ順序で array<Entity> のリスト。各 Entity の形式は 、こちらで説明しています。
label_propertiesarray<LabelProperty>このコメントの予測ラベル プロパティを含む配列です。各LabelPropertyには、こちらで説明する形式があります。
modelモデル予測の作成に使用されたモデルに関する情報 ( こちらに記載されている形式)。
注:

要求が大きい場合、このエンドポイントは応答に時間がかかる場合があります。クライアントのタイムアウト値を増やす必要があります。

ピン留めされたモデルの予測をコメント ID で取得する

/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments

必要な権限: ラベルの表示、ソースの表示

  • bash
    curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "threshold": 0.25,
      "uids": [
        "18ba5ce699f8da1f.0001",
        "18ba5ce699f8da1f.0002"
      ]
    }'curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "threshold": 0.25,
      "uids": [
        "18ba5ce699f8da1f.0001",
        "18ba5ce699f8da1f.0002"
      ]
    }'
    
  • ノード
    const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          threshold: 0.25,
          uids: ["18ba5ce699f8da1f.0001", "18ba5ce699f8da1f.0002"],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          threshold: 0.25,
          uids: ["18ba5ce699f8da1f.0001", "18ba5ce699f8da1f.0002"],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "uids": ["18ba5ce699f8da1f.0001", "18ba5ce699f8da1f.0002"],
            "threshold": 0.25,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/predict-comments",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "uids": ["18ba5ce699f8da1f.0001", "18ba5ce699f8da1f.0002"],
            "threshold": 0.25,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        {
          "entities": [
            {
              "capture_ids": [],
              "formatted_value": "Bob",
              "id": "76aebf2646577a1d",
              "kind": "person",
              "name": "person",
              "probability": null,
              "span": {
                "char_end": 6,
                "char_start": 3,
                "content_part": "body",
                "message_index": 0,
                "utf16_byte_end": 12,
                "utf16_byte_start": 6
              }
            },
            {
              "capture_ids": [],
              "formatted_value": "2020-01-09 00:00 UTC",
              "id": "20beddf4c5f5bb61",
              "kind": "date",
              "name": "date",
              "probability": null,
              "span": {
                "char_end": 48,
                "char_start": 43,
                "content_part": "body",
                "message_index": 0,
                "utf16_byte_end": 96,
                "utf16_byte_start": 86
              }
            }
          ],
          "labels": [
            {
              "name": ["Some Label"],
              "probability": 0.8896465003490448
            },
            {
              "name": ["Parent Label", "Child Label"],
              "probability": 0.26687008142471313,
              "sentiment": 0.8762539502232571
            }
          ],
          "uid": "18ba5ce699f8da1f.0001"
        },
        {
          "entities": [],
          "labels": [
            {
              "name": ["Other Label"],
              "probability": 0.6406207121908665
            }
          ],
          "uid": "18ba5ce699f8da1f.0002"
        }
      ],
      "status": "ok"
    }{
      "model": {
        "time": "2020-02-06T20:42:58.047000Z",
        "version": 5
      },
      "predictions": [
        {
          "entities": [
            {
              "capture_ids": [],
              "formatted_value": "Bob",
              "id": "76aebf2646577a1d",
              "kind": "person",
              "name": "person",
              "probability": null,
              "span": {
                "char_end": 6,
                "char_start": 3,
                "content_part": "body",
                "message_index": 0,
                "utf16_byte_end": 12,
                "utf16_byte_start": 6
              }
            },
            {
              "capture_ids": [],
              "formatted_value": "2020-01-09 00:00 UTC",
              "id": "20beddf4c5f5bb61",
              "kind": "date",
              "name": "date",
              "probability": null,
              "span": {
                "char_end": 48,
                "char_start": 43,
                "content_part": "body",
                "message_index": 0,
                "utf16_byte_end": 96,
                "utf16_byte_start": 86
              }
            }
          ],
          "labels": [
            {
              "name": ["Some Label"],
              "probability": 0.8896465003490448
            },
            {
              "name": ["Parent Label", "Child Label"],
              "probability": 0.26687008142471313,
              "sentiment": 0.8762539502232571
            }
          ],
          "uid": "18ba5ce699f8da1f.0001"
        },
        {
          "entities": [],
          "labels": [
            {
              "name": ["Other Label"],
              "probability": 0.6406207121908665
            }
          ],
          "uid": "18ba5ce699f8da1f.0002"
        }
      ],
      "status": "ok"
    }
要求で予測をクエリするモデルのバージョンを指定する必要があります。 整数のバージョン番号、または特殊な値 live または staging を使用して、現在のライブ モデルまたはステージング モデルのバージョンを照会できます。
要求の形式
名前必須説明
uidsarray<string>最大 4096 の形式の -s と comment_id-s source_idの組み合わせのリストsource_id.comment_id。ソースは現在のデータセットに属している必要はないため、別の(またはデータセットなし)のソースに対するコメントの予測をリクエストできます。 大きなリストは、小さなリストよりも(コメントごとに)高速です。
thresholdNumber×ラベルの結果をフィルター処理する際の基準となる信頼度のしきい値です。 1.0 から 0.0までの数値。0.0 すべての結果が含まれます。 自動しきい値を使用するには、"auto" に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。
labelsarray<Label>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。
ここで Label の形式は次のとおりです。
名前必須説明
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
thresholdNumber×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。
応答の形式
名前説明
statusstringok 要求が成功した場合。エラーの場合は error 。 エラー応答の詳細については、「 概要 」を参照してください。
predictionsarray<Prediction>以下に説明する形式の予測のリスト。
modelモデル予測の作成に使用されたモデルに関する情報 ( こちらに記載されている形式)。
ここで Prediction の形式は次のとおりです。
名前説明
uidstringsource_id.comment_id形式のsource_idcomment_idの組み合わせ。
labelsarray<Label>このコメントの予測ラベルを含む配列です。 Label の形式は 、こちらで説明しています。
entitiesarray<Entity>このコメントの予測されたエンティティを含む配列です。 Entity の形式は 、こちらで説明しています。
label_propertiesarray<LabelProperty>このコメントの予測ラベル プロパティを含む配列です。各LabelPropertyには、こちらで説明する形式があります。
メモ: 要求が大きい場合、このエンドポイントの応答に時間がかかる場合があります。 クライアントのタイムアウトを増やす必要があります。

モデル検証統計を取得する

/api/v1/datasets/<project>/<dataset_name>/labellers/<version>/validation

必要な権限: ラベルの表示、ソースの表示

  • bash
    curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • ノード
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/labellers/live/validation",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "status": "ok",
      "validation": {
        "coverage": 0.9119927883148193,
        "dataset_quality": "good",
        "labels": [
          {
            "name": "Notification",
            "parts": ["Notification"]
          },
          {
            "name": "Notification > Out of Office",
            "parts": ["Notification", "Out of Office"]
          },
          {
            "name": "Notification > Public Holiday",
            "parts": ["Notification", "Public Holiday"]
          }
        ],
        "mean_average_precision_safe": 0.83,
        "num_amber_labels": 1,
        "num_labels": 3,
        "num_red_labels": 1,
        "num_reviewed_comments": 10251,
        "version": 5
      }
    }{
      "status": "ok",
      "validation": {
        "coverage": 0.9119927883148193,
        "dataset_quality": "good",
        "labels": [
          {
            "name": "Notification",
            "parts": ["Notification"]
          },
          {
            "name": "Notification > Out of Office",
            "parts": ["Notification", "Out of Office"]
          },
          {
            "name": "Notification > Public Holiday",
            "parts": ["Notification", "Public Holiday"]
          }
        ],
        "mean_average_precision_safe": 0.83,
        "num_amber_labels": 1,
        "num_labels": 3,
        "num_red_labels": 1,
        "num_reviewed_comments": 10251,
        "version": 5
      }
    }
このルートは、モデルのパフォーマンスの統計を返します。 同じ統計情報を [検証] ページで表示できます。 モデルの統計情報は、整数 version 数で要求できます。 特殊値 live および staging を使用して、現在のライブまたはステージング モデル バージョンの統計、または最後に使用可能なモデル バージョンの特殊値 latest を取得できます。
このエンドポイントは、ピン留めされたモデル バージョンとピン留めされていないモデル バージョンの両方を受け入れますが、ピン留めされていないモデル バージョンの統計情報を使用できることは保証されないため、ピン留めされたモデル バージョンまたは特別な値 latestのいずれかをクエリすることをお勧めします。

応答 validation オブジェクトには、次のフィールドが含まれます。
名前説明
mean_average_precision_safefloat平均平均精度スコア ( 0.0 から 1.0の間)。 このフィールドは、MAP が使用できない場合に null されます。
num_labelsNumber分類データ内のラベルの数 (モデルのバージョンがピン留めされた時点)。
labelsarray<Label>分類データ内のラベルのリスト (モデルのバージョンがピン留めされた時点)。 応答の例が示すように、親ラベルは、子ラベルの一部として返されるだけでなく、別のラベルとして返されることに注意してください。
num_reviewed_commentsNumberデータセット内のレビュー済みのコメントの数 (モデルのバージョンがピン留めされた時点)。
versionNumberモデルのバージョン。
num_amber_labelsNumber警告ステータスがオレンジ色のラベルの数。
num_red_labelsNumber赤色の警告状態のラベルの数。
dataset_scoreNumberデータセットの総合スコア ( 0 から 100) です。
dataset_qualitystring"poor", "average", "good", "excellent"のいずれかで、データセットの全体的な品質ランクを表します。十分なデータがない場合に null できます。
balancefloatレビュー済みのコメントとレビューされていないコメント ( 0.01.0の間) の類似性の尺度です。 十分なデータがない場合に null できます。
balance_qualitystring"poor""average""good""excellent"のいずれかは、バランス品質ランクを表します。十分なデータがない場合に null できます。
coveragefloatデータセット内のラベル カバレッジの小数部の値 ( 0.0 から 1.0の間)。 十分なデータがない場合に null できます。
coverage_qualitystringカバレッジ品質ランクを表す "poor""average""good""excellent"のいずれか。 十分なデータがない場合に null できます。
all_labels_qualitystring"poor""average""good""excellent"のいずれかは、すべてのラベルの品質ランクを表します。十分なデータがない場合に null できます。
underperforming_labels_qualitystring"poor""average""good""excellent"のいずれかは、パフォーマンスの低いラベルの品質ランクを表します。十分なデータがない場合に null できます。
ここで Label の形式は次のとおりです。
名前説明
namestringラベルの名前 (文字列として書式設定)。
partsarray<string>階層ラベルのリストとして書式設定されたラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は次のとおりです ["Parent Label", "Child Label"]

このページは役に立ちましたか?

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
Uipath Logo White
信頼とセキュリティ
© 2005-2024 UiPath. All rights reserved.