All Products
Search
Document Center

OpenSearch:Model pengurutan kustom

Last Updated:Jun 22, 2026

Dokumen ini menjelaskan cara menggunakan fitur model pengurutan kustom di OpenSearch Edisi Algoritma Industri.

Prosedur

  1. Di Feature Management, buat fitur bidang yang diperlukan. Contoh ini menggunakan tabel system_item. Jika fitur yang Anda butuhkan tidak tersedia di tabel tersebut, Anda harus terlebih dahulu mendaftarkan tabel MaxCompute eksternal yang memuatnya. Untuk bidang title, buat fitur untuk nilai mentahnya (custom_title), fitur pencarian setelah tokenisasi (custom_title_match), dan jumlah token setelah tokenisasi (custom_title_len). Anda dapat menambahkan fitur lain sesuai kebutuhan bisnis. Fitur yang dijelaskan dalam bagian ini merupakan contoh untuk membangun model tingkat klik (CTR).

Demikian pula, untuk bidang description, buat custom_description, custom_desc_match, dan custom_desc_len; untuk bidang brand_name, buat custom_tags dan custom_tags_match; serta untuk bidang category_name, buat custom_category.

  1. Gabungkan fitur bawaan dari tabel system_internal dengan fitur bidang yang telah Anda buat pada langkah sebelumnya. Proses ini disebut rekayasa fitur.

Untuk mendaftarkan fitur secara massal guna model CTR khas, gunakan operasi API CreateFunctionResource:

Dalam permintaan Anda, atur parameter ResourceType ke feature_generator, dan atur parameter Data ke objek JSON berikut. Catatan: Pastikan semua fitur input yang diawali dengan custom_ telah dibuat seperti yang dijelaskan pada Langkah 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"
    }
]

Setelah fitur dibuat, Anda dapat mengeditnya di halaman Feature Management.

Anda harus menentukan cara menggunakan fitur-fitur tersebut dalam kode model.

Berdasarkan Quick Start, ubah daftar fitur yang akan digunakan. Biasanya, Anda menentukan fitur-fitur ini di embedding_columns.

Di halaman konfigurasi custom sorting model, tentukan nama deskripsi model, misalnya model1. Di file Python, definisikan variabel self.embedding_columns dan masukkan bidang output dari konfigurasi fitur Anda—seperti comb_q_nid, comb_uid_nid, dan comb_uid_tags—sebagai daftar fitur penyematan ke model.

  1. Tentukan deskripsi fitur dan deskripsi model yang akan digunakan dalam model pengurutan kustom Anda.

Di panel navigasi, pilih custom sorting model. Di halaman pembuatan model, konfigurasikan parameter berikut: pilih target application, masukkan nama model (misalnya, rank_model; panjangnya 1 hingga 30 karakter, dimulai dengan huruf, dan hanya boleh berisi huruf besar, huruf kecil, angka, serta garis bawah), atur tipe model ke custom sorting model, aktifkan scheduled training jika diperlukan, lalu pilih deskripsi fitur (misalnya, fg1) dan deskripsi model (misalnya, model1) yang telah Anda buat.

  1. Setelah model berhasil dilatih, Anda dapat menggunakannya di Cava seperti halnya model CTR. Untuk informasi selengkapnya, lihat custom sorting model. Sebelum menerapkan model, validasi performanya dengan menjalankan A/B test.