The general-purpose model training plug-in allows you to automatically train models, tune hyperparameters, and evaluate models in scenarios where matching recall is required. This topic describes how to combine the collaborative filtering strategy of matching recall with the matching algorithms of Machine Learning Studio to streamline a complete recall process.
Data description
- The User-Item table stores the information about the historical behavior of a user, such as the behavior
of purchasing, clicking, and adding to favorites.
- user_id: the ID of the user.
- item_id: the ID of the commodity.
- active_type: the behavior of the user. Values of 0, 1, and 2 indicate the behavior of clicking, purchasing, and adding to favorites.
- The Item-Item table stores the information about item similarities that are calculated based on the collaborative filtering strategy.
- item_id: the matched commodity.
- similar_item_ids: stores key:value pairs. key indicates the ID of a source commodity, and value indicates the similarity between the source commodity and the matched commodity. A larger value indicates higher similarity. key:value pairs are separated by commas (,).
Procedure
- Step 1: Generate training data
Use Machine Learning Studio to create an experiment and generate training data.
- Step 2: Import the training data to Tablestore
Import the training data to Tablestore in the required format. For more information, see the Data description section of this topic.
- Step 3: Create an instance
Create a model instance for matching recall.
- Step 2: Configure matching strategies
Configure a matching strategy to reduce the number of recommendation candidates.
- Step 5: Deploy and test the model
AutoLearning automatically deploys the matching recall solution as an online service based on the matching strategy. After the service is tested, the solution can be deployed to EAS.
Step 1: Generate training data
- Go to a Machine Learning Studio project.
- Log on to the Machine Learning Platform for AI (PAI) console.
- In the left-side navigation pane, choose .
- In the upper-left corner of the page, select the region that you want to manage.
- Optional:In the search box on the PAI Visualization Modeling page, enter the name of a project to search for the project.
- Find the project and click Machine Learning in the Actions column.
- In the left-side navigation submenu, click Home.
- Click Create below [Recommended Algorithms] Product Recommendation.
- On the canvas, retain the following components and delete the other components.
The cf_training_data component corresponds to the data in the User-Item table. The Collaborative Filtering (etrec) component corresponds to the data in the Item-Item table.
- Click the Collaborative Filtering (etrec) component. On the Parameters Setting tab of the right-side panel, set the Top N parameter to 5. This way, five similar items are returned for each specified item.
- In the left-side navigation submenu, click Components.
- In the components list, click the Data Source/Target folder and drag the Write MaxCompute Table component to the canvas twice. Then, rename the two components as user_item_data and item_item_data respectively.
- Connect the output port of the cf_training_data component to the input port of the user_item_data component. Connect the output port of the Collaborative Filtering (etrec) component to the input port of the item_item_data component.
- On the top of the canvas, click Run
Step 2: Import the training data to Tablestore
The training data that is generated in Machine Learning Studio is stored in MaxCompute. You must import the training data to Tablestore before you can use the training data in AutoLearning.
Step 3: Create an instance
Step 2: Configure matching strategies
Step 5: Deploy and test the model
- In the Data filter strategy configuration step, click Deploy and test.
- In the Deployment confirmation message, check the configured matching and filtering strategies. Then, click OK.
- In the Test Module section, specify a user ID and set the Number of matching results parameter to 10.
- Click Send test request.
- In the Debug information section, view the return results. If the results meet your requirements, click Deploy to EAS to deploy the model instance to EAS as a RESTful service. For more information about how to deploy a model instance to EAS, see Upload and deploy models in the console.