All Products
Search
Document Center

Artificial Intelligence Recommendation:Configure coarse ranking

Last Updated:Aug 26, 2024

After the recall, filtering, and exposure processes are complete, the number of items must be cut before the ranking process starts to achieve a better performance. Sometimes, you can cut the number of items by configuring parameters such as AdjustCountFilter and PriorityAdjustCountFilter.

PAI-Rec allows you to call models to obtain coarse ranking scores. Then, you can cut the number of items based on the scores. Using models for coarse ranking helps achieve a more personalized and refined recall.

Coarse ranking can be divided into the following phases. Each phase is optional. You can set the phases based on your business requirements.

  • Load features. The loading of features is the same as that of fine ranking. For more information, see Configure features.

  • Call models. The algorithm configuration is the same as that of fine ranking. For more information, see Configure algorithms.

  • Perform actions. You can perform multiple operations such as sorting and filtering. For example, after you call a coarse ranking model, you must sort items first and then obtain items with higher scores. After you configure actions, you must perform them in sequence.

When you configure coarse ranking, you must consider items returned by cold start algorithms. If you use a uniform coarse ranking model, such items may have low scores due to lack of features. Therefore, you must configure custom coarse ranking settings for these items. You can configure coarse ranking in a main recommendation process and in a cold start recall process. If no cold start recall process is required, you need to configure coarse ranking only in the main recommendation process. If a cold start recall process is required, we recommend that you use a pipeline to set the cold start recall process. For more information, see Custom pipeline processes.

GeneralRankConfs

You can configure coarse ranking in the main recommendation process by setting the GeneralRankConfs section. GeneralRankConfs employs the Map[string]object structure. Keys specify scenarios. You can use different coarse ranking policies for different scenarios.

Sample configurations:

{
"GeneralRankConfs":{
    "scene_name":{
        "FeatureLoadConfs":[
            {
                "FeatureDaoConf":{
                    "AdapterType":"hologres",
                    "HologresName":"",
                    "FeatureKey":"user:uid",
                    "UserFeatureKeyName":"userid",
                    "HologresTableName":"",
                    "UserSelectFields":"*",
                    "FeatureStore":"user"
                },
                "Features":[

                ]
            }
        ],
        "RankConf":{
            "RankAlgoList":[
                "sv_rocket_launching"
            ],
            "RankScore":"${sv_rocket_launching}",
            "ContextFeatures":["none"],
            "BatchCount":100,
            "Processor":"EasyRec"
        },
        "ActionConfs":[
            {
                "ActionType":"sort",
                "ActionName":"ItemRankScore"
            },
            {
                "ActionType":"filter",
                "ActionName":"GeneralCountFilter"
            }
        ]
    }
},
"FilterConfs" :[
{
      "Name": "GeneralCountFilter",
      "FilterType": "AdjustCountFilter",
      "ShuffleItem": false,
      "RetainNum": 500
}
]
}

The configurations of the FeatureLoadConfs and RankConf sections are the same as those of fine ranking. These two sections are optional.

The ActionConfs section specifies actions. The ActionType parameter specifies the action type. The valid values of ActionType are sort and filter. The ActionName parameter specifies the action name. The action name must be set in the corresponding configuration in advance. For example, ItemRankScore indicates that items are ranked based on their scores, which is predefined by the PAI-Rec engine. GeneralCountFilter must be configured in the FilterConfs section.

The preceding ActionConfs configuration specifies that the system first ranks items based on their scores in descending order and then adjust the number of items and retain 500 items. The value of the ShuffleItem parameter is false, which indicates that the positions of the items do not need to be adjusted.

ColdStartGeneralRankConfs

The coarse ranking configuration for cold start is separately described. Compared with the configuration of GeneralRankConfs, the RecallNames parameter is added. The RecallNames parameter indicates the recalls for which cold start-specific coarse ranking settings are configured.

Sample configurations:

"ColdStartGeneralRankConfs": {
    "scene_name": {
      "RecallNames": [
        "ColdStartRecall",
        "ColdStartVideoVectorRecall",
        "VideoColdStartRecall1",
        "VideoColdStartRecall2",
        "VideoColdStartRecall3",
        "VideoColdStartRecall4",
        "LinUcbRecall",
        "LinUcbRecall_default",
        "LinUcbRecall_highQuality",
        "LinUcbRecall_default2"
      ],
      "ActionConfs": [
        {
          "ActionType": "filter",
          "ActionName": "PriorityAdjustCountFilterV4"
        }
      ]
    }
  }