UiPath Documentation
ixp
latest
false
Communications Mining ガイド
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

予測

Automation Cloud の Communications Mining でトレーニング済みのデータセット ラベラーに対して予測要求を送信するための API リファレンスです。

Get predictions for a published model

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

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

重要:

請求対象の操作 要求本文に記述されたコメントごとに、1 AI ユニットまたはプラットフォーム ユニット 0.2 が課金されます。

  • 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>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。
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×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。
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モデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。
statusstringok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。
predictionsarray<array<Label>>要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。
entitiesarray<array<Entity>>要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。
label_propertiesarray<LabelProperty>このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。
modelモデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。

最新のモデル バージョンの予測を取得する

To get predictions from the latest available model version for a dataset, refer to the instructions in Get predictions for a published model, but use latest instead of a published model version.

Get predictions for a published model for raw emails

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

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

重要:

請求対象の操作 要求本文で指定した未加工のメールごとに 1 AI ユニットまたは 0.2 プラットフォーム ユニットが請求されます。

  • 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_simple_markup_set_id.0.3LPWBXWR"
    }'
    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_simple_markup_set_id.0.3LPWBXWR"
    }'
    
  • ノード
    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_simple_markup_set_id.0.3LPWBXWR",
        },
      },
      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_simple_markup_set_id.0.3LPWBXWR",
        },
      },
      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_simple_markup_set_id.0.3LPWBXWR",
            "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_simple_markup_set_id.0.3LPWBXWR",
            "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_properties'map<string, stringnumber>'×

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

名前必須説明
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
thresholdNumber×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。
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モデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。
statusstringok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。
commentsarray<Comment>アップロードされた未加工のメールから解析されたコメントのリストです。 「コメント」に記載されている形式です。要求に include_comments を設定した場合にのみ返されます。
predictionsarray<array<Label>>要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。
entitiesarray<array<Entity>>要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。
label_propertiesarray<LabelProperty>このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。
modelモデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。
注:

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

Get predictions for a published model by comment id

docs image /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。ソースは現在のデータセットに属している必要はないため、別の(またはデータセットなし)のソースに対するコメントの予測をリクエストできます。 大きなリストは、小さなリストよりも(コメントごとに)高速です。
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>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。
labelsarray<Label>×オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。

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

名前必須説明
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
namearray<string>階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。
thresholdNumber×ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。

応答の形式

名前説明
statusstringok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。
predictionsarray<Prediction>次の表に示す形式の予測のリストです。
modelモデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。
statusstringok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。
predictionsarray<Prediction>次の表に示す形式の予測のリストです。
modelモデル予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。

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

名前説明
uidstringsource_id.comment_id形式のsource_idcomment_idの組み合わせ。
labelsarray<Label>このコメントに対して予測されたラベルを含む配列です。 Label 形式は こちらで説明しています。
entitiesarray<Entity>このコメントに対して予測されたエンティティを含む配列です。 Entity の形式は、 こちらで説明しています。
label_propertiesarray<LabelProperty>このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。
uidstringsource_id.comment_id形式のsource_idcomment_idの組み合わせ。
labelsarray<Label>このコメントに対して予測されたラベルを含む配列です。 Label 形式は こちらで説明しています。
entitiesarray<Entity>このコメントに対して予測されたエンティティを含む配列です。 Entity の形式は、 こちらで説明しています。
label_propertiesarray<LabelProperty>このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。
注:

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

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

docs image /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 数値で要求できます。特別な値 livestaging を使用して、現在の本稼働またはステージングのモデル バージョンの統計情報、または利用可能な最新のモデル バージョンの特別な値 latest を取得できます。

Although this endpoint accepts both published and unpublished model versions, we recommend querying either published model versions or the special value latest, as statistics are not guaranteed to be available for unpublished model versions.

応答 validation オブジェクトには、次のフィールドが含まれます。

名前説明
mean_average_precision_safefloat平均平均精度スコア ( 0.0 から 1.0の間)。 このフィールドは、MAP が使用できない場合に null されます。
num_labelsNumberNumber of labels in the taxonomy (at the time the model version was published).
labelsarray<Label>List of labels in the taxonomy (at the time the model version was published).
注: 応答の例に示すように、親ラベルは、子ラベルの一部として返されるだけでなく、別のラベルとしても返されます。
num_reviewed_commentsNumberNumber of reviewed comments in the dataset (at the time the model version was published).
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"]
namestringラベルの名前 (文字列として書式設定)。
partsarray<string>階層ラベルのリストとして書式設定されたラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は次のとおりです ["Parent Label", "Child Label"]

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得