This topic describes how to use the FM-Embedding for Rec-System template that is preset in Machine Learning Studio to create a recommendation model.

Background information

The Factorization Machine (FM) algorithm is a nonlinear model that takes into account the interaction between features. This algorithm is widely used in the recommendation scenarios of e-commerce, advertising, and live streaming. The FM-Embedding for Rec-System template that is provided by Machine Learning Studio include FM training, FM prediction, and evaluation components.


  1. Go to the Machine Learning Studio console.
    1. Log on to the PAI console.
    2. In the left-side navigation pane, choose Model Training > Studio-Modeling Visualization.
    3. On the PAI Visualization Modeling page, find the project in which you want to create an experiment and click Machine Learning in the Operation column.Machine Learning
  2. Create an experiment.
    1. In the left-side navigation pane, click Home.
    2. In the Templates section, click Create below FM-Embedding for Rec-System.
    3. In the New Experiment dialog box, set the experiment parameters such as Name and Description.
    4. Click OK.
    5. Wait about 10 seconds for the canvas of the experiment to appear. The following figure shows the canvas.FM model
  3. Set the parameters for FM Train-1.
    1. Click FM Train-1 on the canvas.
    2. On the Fields Setting tab in the right-side pane, set the parameters.
      Parameter Description
      Feature column The name of the feature column. The data in the feature column is in the key:value format. Multiple key-value pairs in the feature column are separated with commas (,).
      Label column The name of the label column. The label column must be of the DOUBLE data type.
      The FM algorithm that is provided by Machine Learning Studio supports only data in the LIBSVM format. You can convert data that is in other formats to the LIBSVM format by using a one-hot encoding component. The input data must include a feature column and a label column, as shown in the following figure.Input data
    3. On the Parameters Setting and Tuning tabs in the right-side pane, set the training parameters.
      Assume that the experiment involves 120 million sample data records and 1.3 million feature data records. We recommend that you set the training parameters that are described in the following table to the recommended values, and use the default values for other parameters. You can modify the training parameters based on the amount of data that is involved.
      Tab Parameter Description
      Parameters Setting Learning rate The learning rate. Recommended value: 0.005. If the training is divergent, set this parameter to a smaller value.
      Dimension The number of dimensions. Recommended value: 1,1,16.
      Block size The size of the block. If less than 2 million feature data records are involved, we recommend that you set this parameter to 1000000. If 2 million feature data records or more are involved, you do not need to set this parameter.
      Tuning cluster number The number of nodes to be used. Recommended value: 32. If a large amount of data is involved, set this parameter to a greater value.
      Memory size of a single node, unit M The memory size to be allocated for each node. Recommended value: 16384.
  4. In the top toolbar of the canvas, click Run.
  5. After the experiment is run, right-click Binary Classification Evaluation-1 on the canvas and select View Evaluation Report.
    Based on the data of the FM-Embedding for Rec-System template, the FM algorithm of Machine Learning Studio can create a model with an area under curve (AUC) close to 0.97.Evaluation report