- はじめに
- アクセス制御と管理
- ソースとデータセットを管理する
- モデルのトレーニングと保守
- 生成 AI による抽出
- 分析と監視を使用する
- オートメーションと Communications Mining™
- 開発者
- 機械が単語を理解する方法:NLPに埋め込むためのガイド
- トランスフォーマーによるプロンプトベースの学習
- 効率的な変圧器II:知識蒸留と微調整
- 効率的な変圧器I:注意メカニズム
- 階層的な教師なしインテントモデリング:トレーニングデータなしで価値を得る
- Communications Mining™ でアノテーションの偏りを修正する
- アクティブ ラーニング: より優れた ML モデルを短時間で実現
- それはすべて数字にあります-メトリックを使用してモデルのパフォーマンスを評価します
- モデルの検証が重要な理由
- 対話データ分析 AI としての Communications Mining™ と Google AutoML を比較する
- ライセンス
- よくある質問など
Automation Cloud の Communications Mining でトレーニング済みのデータセット ラベラーに対して予測要求を送信するための API リファレンスです。
Get predictions for a published model
/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 を使用して、現在のライブ モデルまたはステージング モデルのバージョンを照会できます。
要求の形式
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
documents | array<Comment> | ○ | コメントの参照セクションに記載されている形式の、最大 4096 件のドキュメントのバッチです。大きなバッチは小さなバッチよりも (ドキュメント単位で) 高速です。 |
threshold | Number | × | ラベルの結果をフィルター処理するための信頼度のしきい値です。1.0 から 0.0までの数値です。0.0 には、すべての結果が含まれます。自動しきい値を使用するには、["auto"] に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。 |
labels | array<Label> | × | オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。 |
documents | array<Comment> | ○ | コメントの参照セクションに記載されている形式の、最大 4096 件のドキュメントのバッチです。大きなバッチは小さなバッチよりも (ドキュメント単位で) 高速です。 |
threshold | Number | × | ラベルの結果をフィルター処理するための信頼度のしきい値です。1.0 から 0.0までの数値です。0.0 には、すべての結果が含まれます。自動しきい値を使用するには、["auto"] に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。 |
labels | array<Label> | × | オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。 |
ここで Label の形式は次のとおりです。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
threshold | Number | × | ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。 |
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
threshold | Number | × | ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。 |
応答の形式
| 名前 | 型 | 説明 |
|---|---|---|
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
predictions | array<array<Label>> | 要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。 |
entities | array<array<Entity>> | 要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。 |
label_properties | array<LabelProperty> | このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。 |
model | モデル | 予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。 |
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
predictions | array<array<Label>> | 要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。 |
entities | array<array<Entity>> | 要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。 |
label_properties | array<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
/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_tag | string | ○ | 未加工のメールをメッセージに変換する方法を指定するタグ。トレーニング データのアップロードに使用したものと同じタグを使用します。利用可能なタグについては、「 メール変換タグ」をご覧ください。 |
documents | array<Document> | ○ | 次の表に示す形式の、最大 4096 個のドキュメントのバッチです。大きなバッチは小さなバッチよりも (ドキュメント単位で) 高速です。 |
threshold | Number | × | ラベルの結果をフィルター処理するための信頼度のしきい値です。1.0 から 0.0までの数値です。0.0 には、すべての結果が含まれます。自動しきい値を使用するには、["auto"] に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。 |
labels | array<Label> | × | オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。 |
include_comments | Boolean | × | true に設定すると、メールから解析されたコメントが応答の本文で返されます。 |
ここで Document の形式は次のとおりです。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
raw_email | RawEmail | ○ | 記述された コメント形式のメール データです。 |
user_properties | 'map<string, string | number>' | × |
ここで Label の形式は次のとおりです。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
threshold | Number | × | ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。 |
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
threshold | Number | × | ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。 |
応答の形式
| 名前 | 型 | 説明 |
|---|---|---|
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
comments | array<Comment> | アップロードされた未加工のメールから解析されたコメントのリストです。 「コメント」に記載されている形式です。要求に include_comments を設定した場合にのみ返されます。 |
predictions | array<array<Label>> | 要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。 |
entities | array<array<Entity>> | 要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。 |
label_properties | array<LabelProperty> | このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。 |
model | モデル | 予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。 |
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
comments | array<Comment> | アップロードされた未加工のメールから解析されたコメントのリストです。 「コメント」に記載されている形式です。要求に include_comments を設定した場合にのみ返されます。 |
predictions | array<array<Label>> | 要求のコメントと同じ順序で array<Label> のリストです。各 Label は、 こちらで説明している形式のものです。 |
entities | array<array<Entity>> | 要求のコメントと同じ順序で array<Entity> のリストです。各 Entity は、 こちらで説明している形式のものです。 |
label_properties | array<LabelProperty> | このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。 |
model | モデル | 予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。 |
要求が大きい場合、このエンドポイントは応答に時間がかかる場合があります。クライアントのタイムアウト値を増やす必要があります。
Get predictions for a published model by comment 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 を使用して、現在のライブ モデルまたはステージング モデルのバージョンを照会できます。
要求の形式
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
uids | array<string> | ○ | 最大 4096 の形式の -s と comment_id-s source_idの組み合わせのリストsource_id.comment_id。ソースは現在のデータセットに属している必要はないため、別の(またはデータセットなし)のソースに対するコメントの予測をリクエストできます。 大きなリストは、小さなリストよりも(コメントごとに)高速です。 |
uids | array<string> | ○ | 最大 4096 の形式の -s と comment_id-s source_idの組み合わせのリストsource_id.comment_id。ソースは現在のデータセットに属している必要はないため、別の(またはデータセットなし)のソースに対するコメントの予測をリクエストできます。 大きなリストは、小さなリストよりも(コメントごとに)高速です。 |
threshold | Number | × | ラベルの結果をフィルター処理するための信頼度のしきい値です。1.0 から 0.0までの数値です。0.0 には、すべての結果が含まれます。自動しきい値を使用するには、["auto"] に設定します。設定しない場合は、既定のしきい値である 0.25 が使用されます。 |
labels | array<Label> | × | オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。 |
labels | array<Label> | × | オプションでラベル固有のしきい値とともに返される要求されたラベルのリスト。 |
ここで Label の形式は次のとおりです。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
name | array<string> | ○ | 階層ラベルのリストとして書式設定された、返されるラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は ["Parent Label", "Child Label"]になります。 |
threshold | Number | × | ラベルに使用する信頼度のしきい値です。 指定しない場合、既定では最上位レベルで指定されたしきい値になります。 |
応答の形式
| 名前 | 型 | 説明 |
|---|---|---|
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
predictions | array<Prediction> | 次の表に示す形式の予測のリストです。 |
model | モデル | 予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。 |
status | string | ok 要求が成功したかどうか、またはエラーの場合は error 。エラー応答について詳しくは、「 概要」をご覧ください。 |
predictions | array<Prediction> | 次の表に示す形式の予測のリストです。 |
model | モデル | 予測に使用されたモデルに関する情報です。 こちらに記載されている形式です。 |
ここで Prediction の形式は次のとおりです。
| 名前 | 型 | 説明 |
|---|---|---|
uid | string | source_id.comment_id形式のsource_idとcomment_idの組み合わせ。 |
labels | array<Label> | このコメントに対して予測されたラベルを含む配列です。 Label 形式は こちらで説明しています。 |
entities | array<Entity> | このコメントに対して予測されたエンティティを含む配列です。 Entity の形式は、 こちらで説明しています。 |
label_properties | array<LabelProperty> | このコメントに対して予測されたラベル プロパティを含む配列です。各 LabelProperty の形式は、 こちらで説明しています。 |
uid | string | source_id.comment_id形式のsource_idとcomment_idの組み合わせ。 |
labels | array<Label> | このコメントに対して予測されたラベルを含む配列です。 Label 形式は こちらで説明しています。 |
entities | array<Entity> | このコメントに対して予測されたエンティティを含む配列です。 Entity の形式は、 こちらで説明しています。 |
label_properties | array<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 を取得できます。
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_safe | float | 平均平均精度スコア ( 0.0 から 1.0の間)。 このフィールドは、MAP が使用できない場合に null されます。 |
num_labels | Number | Number of labels in the taxonomy (at the time the model version was published). |
labels | array<Label> | List of labels in the taxonomy (at the time the model version was published). 注: 応答の例に示すように、親ラベルは、子ラベルの一部として返されるだけでなく、別のラベルとしても返されます。 |
num_reviewed_comments | Number | Number of reviewed comments in the dataset (at the time the model version was published). |
version | Number | モデルのバージョン。 |
num_amber_labels | Number | 警告ステータスがオレンジ色のラベルの数。 |
num_red_labels | Number | 赤色の警告状態のラベルの数。 |
dataset_score | Number | データセットの総合スコア ( 0 から 100) です。 |
dataset_quality | string | "poor", "average", "good", "excellent"のいずれかで、データセットの全体的な品質ランクを表します。十分なデータがない場合に null できます。 |
balance | float | レビュー済みのコメントとレビューされていないコメント ( 0.0 と 1.0の間) の類似性の尺度です。 十分なデータがない場合に null できます。 |
balance_quality | string | "poor"、"average"、"good"、"excellent"のいずれかは、バランス品質ランクを表します。十分なデータがない場合に null できます。 |
coverage | float | データセット内のラベル カバレッジの小数部の値 ( 0.0 から 1.0の間)。 十分なデータがない場合に null できます。 |
coverage_quality | string | カバレッジ品質ランクを表す "poor"、 "average"、 "good"、 "excellent"のいずれか。 十分なデータがない場合に null できます。 |
all_labels_quality | string | "poor"、"average"、"good"、"excellent"のいずれかは、すべてのラベルの品質ランクを表します。十分なデータがない場合に null できます。 |
underperforming_labels_quality | string | "poor"、"average"、"good"、"excellent"のいずれかは、パフォーマンスの低いラベルの品質ランクを表します。十分なデータがない場合に null できます。 |
ここで Label の形式は次のとおりです。
| 名前 | 型 | 説明 |
|---|---|---|
name | string | ラベルの名前 (文字列として書式設定)。 |
parts | array<string> | 階層ラベルのリストとして書式設定されたラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は次のとおりです ["Parent Label", "Child Label"] |
name | string | ラベルの名前 (文字列として書式設定)。 |
parts | array<string> | 階層ラベルのリストとして書式設定されたラベルの名前。 たとえば、ラベル "Parent Label > Child Label" の形式は次のとおりです ["Parent Label", "Child Label"] |