If you use Machine Learning Platform for AI (PAI) to configure components, global variables can be used to reduce the workload of repeat parameter configurations. You can create and delete global variables. You can also use the configuration copy feature to obtain the reference methods of global variables. This topic describes how to configure and use global variables.



A project and an experiment are created. For more information, see Quick Start.

Go to the global variable configuration page

  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 required project and click Machine Learning in the Operation column.
  4. In the left-side navigation pane, click Experiments. On the page that appears, click the required experiment.
  5. Click a component in the canvas.
  6. On the right side of the page, click the Global Variables tab. The Global Variables pane appears.Global variable configuration page

Example 1: Configure the parameters that are used by all the components in an experiment

The Heart Disease Prediction experiment is used in this example. If you configure the parameters, you can use global variables. The variables can also be used for the components that use the same parameters.

  1. Configure global variables.
    1. Go to the global variable configuration page.
    2. In the lower part of the Global Variable pane, click New Global Variable.
    3. Configure the Name and Value parameters.
      In this example, set Name to param. Then, the system automatically generates ${param} for Reference Method. If you replace a parameter with ${param}, you can reference this variable. The valid values of Value include cp and fbs.Configure the variable name and value
  2. Use global variables.
    Replace the parameter that uses a variable with the value of Reference Method for this variable.Use global variables
  3. Check whether the parameter is automatically replaced with the value you entered.Running test

Example 2: Replace scheduled scheduling parameters

Global variables can also be used for scheduling experiments associated with dates. In a PAI experiment, the configured values for global variables can only be used to run the experiment online. If scheduling is performed offline, the parameter values that you configured for the scheduling are used. In this example, the source data contains the data of two partitions.Experiment
  1. Prepare source data.Prepare source data
  2. Configure global variables.
    For more information, see Example 1: Configure the parameters that are used by all the components in an experiment. In this example, Name is set to date, and Value is set to 20190520.Global Variable
  3. Use global variables in SQL scripts.Use a variable
  4. Run the experiment online and view the result.Online experiment result
  5. Use global variables to configure offline scheduling.
    Note For more information, see Perform offline scheduling.
    1. Go to the offline scheduling page.
      When you go to the offline scheduling page, the system asks you to configure a parameter that has the same name as the global variable that you want to use.Go to the offline scheduling page
    2. Use global variables to configure an offline scheduling task.Use global parameters
    3. Run the scheduling task and view the result.
      The scheduling result shows that the variables in the generated instances are replaced with 20190519.Run the scheduling task