このトピックでは、OpenSearch Industry Algorithm Edition を使用してカスタムソートモデルを作成する方法について説明します。
手順
OpenSearch Industry Algorithm Edition コンソールの機能管理ページで、フィールド機能を作成します。この例では、system_item テーブルを使用します。必要な機能が system_item テーブルにリストされていない場合は、外部の MaxCompute テーブルに登録できます。たとえば、title フィールドに custom_title、custom_title_match、custom_title_len の機能を作成します。他のフィールドの機能も同様に作成します。ビジネス要件に基づいて機能を追加できます。この例では、クリック率 (CTR) モデルのフィールドを使用します。
手順 1 で作成したフィールド機能と組み合わせて、system_internal テーブルにリストされている組み込み機能を使用して、機能生成を実行します。
この例では、CTR モデルの一般的な機能生成プロセスを使用します。CreateFunctionResource オペレーションを呼び出して、複数の機能を一度に登録できます。
ResourceType
パラメーターを feature_generator
に設定し、Data
パラメーターに次の情報を指定します。名前が custom_
で始まる入力機能は、事前に準備する必要があります。このような機能は、手順 1 の機能管理ページで作成できます。
[
{
"input": {
"features": [
{
"type": "user",
"name": "system_raw_q_ultra"
},
{
"type": "item",
"name": "system_item_id"
}
]
},
"generator": "combo",
"output": "comb_q_nid"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_user_id"
},
{
"type": "item",
"name": "system_item_id"
}
]
},
"generator": "combo",
"output": "comb_uid_nid"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_user_id"
},
{
"type": "item",
"name": "custom_tags"
}
]
},
"generator": "combo",
"output": "comb_uid_tags"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_raw_q_ultra"
},
{
"type": "item",
"name": "custom_tags"
}
]
},
"generator": "combo",
"output": "comb_q_tags"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_exp_time"
}
]
},
"generator": "id",
"output": "exp_time"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "id",
"output": "terms2"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_raw_q_ultra"
}
]
},
"generator": "id",
"output": "raw_q_ultra"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_user_id"
}
]
},
"generator": "id",
"output": "user_id"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_item_id"
}
]
},
"generator": "id",
"output": "item_id"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_description"
}
]
},
"generator": "id",
"output": "description"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_desc_len"
}
]
},
"generator": "id",
"output": "desc_len"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_title"
}
]
},
"generator": "id",
"output": "title"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_title_len"
}
]
},
"generator": "id",
"output": "title_len"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_category"
}
]
},
"generator": "id",
"output": "category"
},
{
"input": {
"features": [
{
"type": "item",
"name": "custom_tags"
}
]
},
"generator": "id",
"output": "tags"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ctr_30"
}
]
},
"generator": "id",
"output": "all_nid_ctr_30"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ctr_7"
}
]
},
"generator": "id",
"output": "all_nid_ctr_7"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ctr_1"
}
]
},
"generator": "id",
"output": "all_nid_ctr_1"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_pv_30"
}
]
},
"generator": "id",
"output": "all_nid_pv_30"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_pv_7"
}
]
},
"generator": "id",
"output": "all_nid_pv_7"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_pv_1"
}
]
},
"generator": "id",
"output": "all_nid_pv_1"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ipv_30"
}
]
},
"generator": "id",
"output": "all_nid_ipv_30"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ipv_7"
}
]
},
"generator": "id",
"output": "all_nid_ipv_7"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_all_nid_ipv_1"
}
]
},
"generator": "id",
"output": "all_nid_ipv_1"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "custom_title_match"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "term_title_match"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "custom_desc_match"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "term_desc_match"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "custom_tags_match"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "term_tags_match"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "system_qterm_match_decay"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "term_os_kw_match"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_query_cnt"
}
]
},
"generator": "id",
"output": "opensearch_query_cnt"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_qterm_cnt"
}
]
},
"generator": "id",
"output": "opensearch_qterm_cnt"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "system_query_ctr_decay"
},
{
"role": "key",
"type": "user",
"name": "system_raw_q_ultra"
}
]
},
"generator": "lookup",
"output": "os_q_ctr_decay"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "system_qterm_ctr_decay"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "os_term_ctr_decay"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "system_query_ctr_decay"
},
{
"role": "key",
"type": "user",
"name": "system_raw_q_ultra"
}
]
},
"generator": "lookup",
"output": "os_q_ctr_decay_nokey"
},
{
"input": {
"features": [
{
"role": "map",
"type": "item",
"name": "system_qterm_ctr_decay"
},
{
"role": "key",
"type": "user",
"name": "system_terms2"
}
]
},
"generator": "lookup",
"output": "os_term_ctr_decay_nokey"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_query_seq_decay"
}
]
},
"generator": "id",
"output": "os_q_seq_decay"
},
{
"input": {
"features": [
{
"type": "item",
"name": "system_qterm_seq_decay"
}
]
},
"generator": "id",
"output": "os_term_seq_decay"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "system_qterm_seq_decay"
}
],
"method": "query_common_ratio"
},
"generator": "overlap",
"output": "os_qterm_q_common_ratio"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "system_qterm_seq_decay"
}
],
"method": "title_common_ratio"
},
"generator": "overlap",
"output": "os_qterm_title_common_ratio"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "custom_title"
}
],
"method": "query_common_ratio"
},
"generator": "overlap",
"output": "title_q_common_ratio"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "custom_title"
}
],
"method": "title_common_ratio"
},
"generator": "overlap",
"output": "title_title_common_ratio"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "custom_description"
}
],
"method": "query_common_ratio"
},
"generator": "overlap",
"output": "desc_q_common_ratio"
},
{
"input": {
"features": [
{
"role": "query",
"type": "user",
"name": "system_terms2"
},
{
"role": "title",
"type": "item",
"name": "custom_description"
}
],
"method": "title_common_ratio"
},
"generator": "overlap",
"output": "desc_title_common_ratio"
},
{
"input": {
"features": [
{
"type": "user",
"name": "system_term_seq_length"
}
],
"dimension": 1
},
"generator": "raw",
"output": "term_seq_length"
}
]
機能が作成された後、対応する機能の説明ページで各機能を構成できます。
機能が生成されます。機能を使用するには、モデルコードで機能を指定する必要があります。
モデル記述を作成します。
「カスタムソートモデルの開発者ガイド」トピックのカスタムソートモデルの概要セクションに記載されている手順を完了した後、使用する機能を変更できます。ほとんどの場合、embedding_colums パラメーターが使用されます。
カスタムソートモデルを作成するときに、機能記述とモデル記述を指定します。
カスタムソートモデルが作成およびトレーニングされた後、CTR モデルと同じ方法で Cava でカスタムソートモデルを使用できます。モデルを公開する前に、A/B テストを実行してモデルのパフォーマンスをテストできます。