Help Center> RES> Getting Started> Intelligent Scenarios (You May Also Like)

Intelligent Scenarios (You May Also Like)

RES provides intelligent scenarios including "You May Also Like", "Frequently Used Together", and "Most Searched". In just a few steps, you can train jobs and obtain recommendation results.

This section uses "You May Also Like" as an example to help you quickly familiarize yourself with the usage process of intelligent scenarios. Before you start, carefully complete the preparations described in Preparations. Perform the following steps to obtain recommendation results in intelligent scenarios:

Preparations

  • You have registered a HUAWEI CLOUD account that is not in arrears or frozen.
  • You have created buckets and folders in OBS for storing sample data.

    For details on how to create an OBS bucket and folder, see Creating a Bucket and Creating a Folder. Ensure that the OBS directory you use and RES are in the same region.

Step 1: Preparing Data

RES provides a sample dataset named test-data used in the "You May Also Like" scenario. This example uses this dataset to build a model. Perform the following operations to upload the dataset to the created OBS directory.

  1. Click sample data to download the test-data dataset to the local PC.
  2. Decompress the test-data package to the test-data directory on the local PC.
  3. Upload all files in the test-data folder to the OBS path created in preparation. For details, see Uploading a File.

Step 2: Creating an Offline Data Source

After the data is downloaded and uploaded to OBS, you need to create a data source for later calculations. The procedure is as follows:

  1. Log in to the RES management console. Choose Data Sources from the left navigation bar. The Data Sources page is displayed.
  2. Click Create. On the displayed page, enter a data source name and click to select an OBS path that stores the data.
    Figure 1 Creating an offline data source
  3. After selecting the path, click Create Now.
  4. Return to the data source list and locate the data source you just created to perform data quality management. See Data Source Quality Management in the RES User Guide. The created data source is available only after data exploration is complete and a data quality report is generated.

Step 3: Creating an Intelligent Scenario

  1. Log in to the RES management console. Choose Recommendation Scenarios > Intelligent Scenarios from the left navigation bar. The intelligent scenario list is displayed by default.
  2. Click Create in the upper right corner to go to the page where you can create an intelligent scenario.
  3. On the Select Template tab page, click You May Also Like to set parameters. Set parameters in the Basic Info area and Personalized Settings area.
    Figure 2 Creating an intelligent scenario

    Parameter description:

    • Matched Feature Pair: Select a pair of features to be matched. At least one pair of features must be added. The built-in algorithm can then match them. For example, if a user of a certain age group matches an item applicable to their age group, the matching is complete.
    • Behavior Filter: online filter function. The example shown in Figure 2 indicates that items browsed by users in the last three days will be filtered to avoid repeated recommendations.
  4. When the configuration is complete, click Create.

The system will then automatically switch to the intelligent scenario list page and display a message indicating that the scenario is created successfully. You can then publish a created intelligent scenario. You can also click the name of a scenario with the Running status to go to the scenario details page where you can perform editing, prediction, and effect evaluation.

Step 4: Obtaining Prediction Results

When an intelligent scenario is successfully published and in the Running status, the scenario is normal. You can use the prediction function to further adjust job parameters based on recommendation results. You can also call an API to obtain recommendation results.

  1. Log in to the RES management console. Choose Recommendation Scenarios > Intelligent Scenarios from the left navigation bar. The intelligent scenario list is displayed by default.
  2. Click the name of a scenario with the Completed status to go to the scenario details page. Click the Predict tab. There are two prediction modes available. Step 4: Obtaining Prediction Results uses the prediction code as an example to guide you in obtaining recommendation results.
  3. Select Code, enter the prediction code in the box on the left, and click Predict to display the prediction results on the right. See Figure 3 for details. Enter the user ID and the recommended number, and return the prediction results based on your settings.
    Figure 3 Prediction
    • Request code

      id is the user ID that needs to be requested. rec_num indicates the number of recommended items.

      {   
          "id":"user894", 
          "rec_num": 10
      }
    • Prediction result

      flow_id indicates the processing flow ID. rec_num indicates the number of recommended items. candidates indicates the candidate set result. id indicates the ID of the recommended item. score indicates the score of the recommended item. source indicates the source policy of the recommended item.

      {
      "flow_id": "flow1",
      "rec_num": 10,
      "candidates": [
      {
      "id": "item235",
      "score": 0.58418584,
      "source": "WeightBehavior-DIREC"
      },
      {
      "id": "item338",
      "score": 0.5653803,
      "source": "WeightBehavior-DIREC"
      },
      {
      "id": "item709",
      "score": 0.55219465,
      "source": "WeightBehavior-DIREC"
      },
      {
      "id": "item960",
      "score": 0.55219465,
      "source": "WeightBehavior-DIREC"
      },
      {
      "id": "item469",
      "score": 0.55219465,
      "source": "WeightBehavior-DIREC"
      },
      {
      "id": "item236",
      "score": 0.55219465,
      "source": "WeightBehavior-DIREC"
      }
      ]
      }

Step 5: Deleting Related Resources to Avoid Unnecessary Charging

To avoid unnecessary charging, you are advised to delete related resources, such as data sources, intelligent scenarios, and OBS paths after trial use.

  • On the Data Sources page, locate data sources you no longer need and click Delete in the Operation column to delete them.
  • On the Intelligent Scenarios page, locate intelligent scenarios you no longer need and click Delete in the Operation column to delete them.
  • To delete data, access OBS, delete the uploaded data, and delete the corresponding folders and OBS buckets.