All Products
Search
Document Center

Platform For AI:Linear model feature importance

Last Updated:Apr 01, 2026

The Linear Model Feature Importance component calculates feature importance scores for linear models, including linear regression and logistic regression for binary classification. It supports both sparse and dense input data formats.

Use this component to identify which features contribute most to model predictions — a key step in model debugging, feature selection, and building trust in model behavior.

Limitations

This component runs only on MaxCompute computing resources.

Prerequisites

Before you begin, make sure you have:

  • A trained linear model (linear regression or logistic regression for binary classification)

  • An input table in MaxCompute containing the feature columns and label column

Configure the component

Configure the component using one of the following methods.

Method 1: PAI console (Machine Learning Designer)

Set the parameters on the Fields Setting and Tuning tabs in Machine Learning Designer.

Fields Setting tab

ParameterRequiredDescriptionDefault
Feature columnsNoFeature columns for training from the input tableAll columns except the label column
Target columnYesThe label column. Click Select fields, search for the column by keyword, select it, and click OK.
Input sparse format dataNoSpecifies whether the input data is in sparse format

Tuning tab

ParameterRequiredDescriptionDefault
CoresNoNumber of cores for computingDetermined by the system
Memory size per coreNoMemory allocated to each core, in MBDetermined by the system

Method 2: PAI commands

Run the component using a PAI command. Use the SQL Script component to call PAI commands. For more information, see SQL Script.

PAI -name regression_feature_importance -project algo_public
    -DmodelName=xlab_m_logisticregressi_20317_v0
    -DoutputTableName=pai_temp_2252_20321_1
    -DlabelColName=y
    -DfeatureColNames=pdays,previous,emp_var_rate,cons_price_idx,cons_conf_idx,euribor3m,nr_employed,age,campaign
    -DenableSparse=false -DinputTableName=pai_dense_10_9;
ParameterRequiredDescriptionDefault
inputTableNameYesName of the input tableNone
outputTableNameYesName of the output tableNone
labelColNameYesLabel column from the input tableNone
modelNameYesName of the input modelNone
featureColNamesNoFeature columns from the input tableAll columns except the label column
inputTablePartitionsNoPartitions to read from the input tableFull table
enableSparseNoSpecifies whether the input data is in sparse formatfalse
itemDelimiterNoDelimiter between key-value pairs in sparse dataSpace
kvDelimiterNoDelimiter between keys and values in sparse dataColon (:)
lifecycleNoLifecycle of the output tableNot specified
coreNumNoNumber of coresDetermined by the system
memSizePerCoreNoMemory size per coreDetermined by the system

Example

This example uses the bank_data dataset to train a logistic regression model and then calculate feature importance scores.

  1. Create a table named bank_data and import data. For more information, see Create tables and Import data to tables.

  2. Run the following SQL statement to generate training data:

    CREATE TABLE IF NOT EXISTS pai_dense_10_9 AS
    SELECT
        age, campaign, pdays, previous, emp_var_rate,
        cons_price_idx, cons_conf_idx, euribor3m, nr_employed, fixed_deposit
    FROM bank_data LIMIT 10;
  3. Build and run a pipeline in Machine Learning Designer. For more information about creating pipelines, see Algorithm modeling.image

    1. In the component list, search for and drag the following three components onto the canvas: Read Table, Logistic Regression for Multiclass Classification, and Linear Model Feature Importance.

    2. Connect the components in the order shown in the figure above.

    3. Configure each component:

      • Click Read Table-1. On the Select table tab, set Table name to bank_data.

      • Click Logistic Regression for Multiclass Classification-1. On the Fields Setting tab, set Training feature columns to age, campaign, pdays, previous, emp_var_rate, cons_price_idx, cons_conf_idx, euribor3m, and nr_installed. Set Target columns to fixed_deposit.

      • Click Linear Model Feature Importance-1. On the Fields Setting tab, set Target column to fixed_deposit.

    4. Click image to run the pipeline.

  4. After the pipeline completes, right-click Linear Model Feature Importance-1 and choose View data > Model importance table.image The output table contains two columns:

    ColumnFormulaWhat it measures
    weightabs(w_)Absolute value of the feature coefficient
    importanceabs(w_j) × STD(f_i)Coefficient scaled by the feature's standard deviation (standard deviation of the training data)
  5. Right-click Linear Model Feature Importance-1 and select View analytics report to see visualized importance rankings.image

What's next

References