All Products
Search
Document Center

Platform For AI:FM algorithm

Last Updated:Apr 01, 2026

The Factorization Machine (FM) algorithm is a general-purpose predictive model suited for high-dimensional sparse data. It models pairwise feature interactions using latent vectors, extending classical matrix factorization. Common use cases include recommendation systems and click-through rate (CTR) prediction.

How it works

The FM algorithm comprises two processes: FM training and FM prediction. These two processes correspond to the model construction and application phases, respectively.

  • FM training: The core objective of this process is to learn the model parameters from a given training dataset so that the model can accurately predict the target variable. During this phase, the algorithm analyzes the input data and optimizes the parameters to ensure the efficiency and accuracy of the model.

  • FM prediction: In this process, the already trained model is used to make predictions on new input data. During the FM prediction phase, the model parameters are fixed, allowing the model to compute and output the predicted results for the new data using these established parameters.

Configure the components

Method 1: Configure on the pipeline page

FM training

On the pipeline page, add an FM Train component and configure the following parameters.

Fields setting

ParameterDescription
Feature columnsSelect feature columns from the input table. STRING and DOUBLE types are supported.
Label columnSelect the label column. Only DOUBLE type is supported.

Parameters setting

ParameterRequiredDefaultDescription
Task typeYesregressionTask type: regression or binary_classification. For binary classification, label values must be 0 or 1.
Number of iterationsNo10Total number of training epochs. More epochs can improve accuracy but increase training time.
Regularization coefficientNo0.01,0.01,0.01Three comma-separated floats representing the regularization coefficients for the 0th, 1st, and 2nd order terms. Example: 0.01,0.01,0.01. Increase to reduce overfitting.
Learning rateNo0.01Step size for parameter updates. If training diverges, reduce this value.
Parameter initialization standard deviationNo0.05Standard deviation for initializing model parameters. DOUBLE type.
DimensionsNo1,1,10Three comma-separated positive integers specifying the lengths of the 0th, 1st, and 2nd order terms. The third value (default: 10) controls the size of the factorization vectors.
Output table lifecycleNoLifecycle of the output table. Available only in Machine Learning Studio.

Advanced options

Available only in Machine Learning Designer. Select Advanced options to configure the Flink configuration item. For details, see Configure Flink.

Tuning

Running modeDescription
MaxComputeUse MaxCompute or Flink computing resources. For worker and memory configuration, see Appendix: How to estimate resource usage.
FlinkUse Flink computing resources. For worker and memory configuration, see Appendix: How to estimate resource usage.
DLCUse DLC computing resources. Configure specifications based on the prompts.

FM prediction

On the pipeline page, add an FM Prediction component and configure the following parameters.

Parameters setting

ParameterRequiredDefaultDescription
Prediction result columnNoprediction_resultName of the output column for prediction results.
Output detail columnNoprediction_detailName of the output column for prediction details.
Reserved columnsNoAll columnsColumns to include in the output table.

Advanced configuration

Available only in Machine Learning Designer. Select Advanced configuration to configure Number of threads used by each worker and Type of model size.

Tuning

Running modeDescription
MaxComputeUse MaxCompute or Flink computing resources. For worker and memory configuration, see Appendix: How to estimate resource usage.
FlinkUse Flink computing resources. For worker and memory configuration, see Appendix: How to estimate resource usage.
DLCUse DLC computing resources. Configure specifications based on the prompts.

Method 2: Use PAI commands

Use PAI commands to configure the FM Train and FM Prediction components.

FM Train

ParameterRequiredDefaultDescription
tensorColNameYesFeature column name. Data must be in key-value format. Separate multiple names with commas. Example: 1:1.0,3:1.0.
labelColNameYesLabel column name. Only numeric types are supported. For binary_classification, values must be 0 or 1.
taskYesregressionTask type. Valid values: regression, binary_classification.
numEpochsNo10Number of training iterations.
dimNo1,1,10Three comma-separated positive integers specifying the lengths of the 0th, 1st, and 2nd order terms. The third value controls the size of the factorization vectors.
learnRateNo0.01Learning rate. If training diverges, reduce this value.
lambdaNo0.01,0.01,0.01Three comma-separated floats representing the regularization coefficients for the 0th, 1st, and 2nd order terms.
initStdevNo0.05Standard deviation for parameter initialization.

FM Prediction

ParameterRequiredDefaultDescription
predResultColNameNoprediction_resultName of the prediction result column.
predScoreColNameNoprediction_scoreName of the prediction score column.
predDetailColNameNoprediction_detailName of the prediction detail column.
keepColNamesNoAll columnsColumns to include in the output table.

Example

The following example uses the FM recommendation model based on the Alink framework template.

Input data:

Input data

After training, the model achieves an area under the curve (AUC) of approximately 0.97.

AUC

What's next

Create an FM recommendation model based on the Alink framework