This topic describes the Prediction component provided by Machine Learning Studio.

Configure the component

Traditional data mining algorithms can use the Prediction component to perform model prediction. The component uses the training model and prediction data as input and generates the prediction result.

You can configure the component by using one of the following methods:
  • Machine Learning Platform for AI (PAI) console
    Tab Parameter Description
    Fields Setting Feature Column The feature columns selected from the input table for prediction. By default, all columns in the input table are selected.
    Reserved Columns The columns that you want to reserve in the output table. We recommend that you add a label column to facilitate evaluation.
    Output Result Column The result column in the output table.
    Output Score Column The score column in the output table.
    Output Detail Column The details column in the output table.
    Sparse Matrix Specifies whether to indicate sparse data in the key-value format.
    KV Delimiter The delimiter used between keys and values. Colons (:) are used by default.
    KV Pair Delimiter The delimiter used between key-value pairs. Commas (,) are used by default.
    Tuning Cores The number of cores. This parameter is used with Memory Size per Core. The value of this parameter must be a positive integer.
    Memory Size per Core The memory size of each core. This parameter is used with Cores. Unit: MB.
  • PAI command
    pai -name prediction
        -DmodelName=nb_model
        -DinputTableName=wpbc
        -DoutputTableName=wpbc_pred
        -DappendColNames=label;
    Parameter Required Description Default value
    inputTableName Yes The name of the input table. No default value
    featureColNames No The feature columns selected from the input table for prediction. Separate multiple columns with commas (,). All columns
    appendColNames No The prediction columns selected from the input table and appended to the output table. No default value
    inputTablePartitions No The partitions selected from the input table for training. Specify this parameter in one of the following formats:
    • Partition_name=value
    • name1=value1/name2=value2: multi-level partitions
    Note If you specify multiple partitions, separate them with commas (,).
    Full table
    outputTablePartition No The partitions whose results are contained in the output table. No default value
    resultColName No The result column in the output table. prediction_result
    scoreColName No The score column in the output table. prediction_score
    detailColName No The details column in the output table. prediction_detail
    enableSparse No Specifies whether data in the input table is in the sparse format. Valid values: true and false. false
    itemDelimiter No The delimiter used between key-value pairs in the sparse format. ,
    kvDelimiter No The delimiter used between keys and values in the sparse format. :
    modelName Yes The name of the input clustering model. No default value
    outputTableName Yes The name of the output table. No default value
    lifecycle No The lifecycle of the output table. No default value
    coreNum No The number of cores. Automatically allocated
    memSizePerCore No The memory size of each core. Unit: MB. Automatically allocated

Example

  1. Execute the following SQL statement to generate test data:
    create table pai_rf_test_input as
    select * from
    (
    select 1 as f0,2 as f1, "good" as class from dual
    union all
    select 1 as f0,3 as f1, "good" as class from dual
    union all
    select 1 as f0,4 as f1, "bad" as class from dual
    union all
    select 0 as f0,3 as f1, "good" as class from dual
    union all
    select 0 as f0,4 as f1, "bad" as class from dual
    )tmp;
  2. Run the following PAI command to build a model. The random forest algorithm is used in this example.
    PAI -name randomforests
       -project algo_public
       -DinputTableName="pai_rf_test_input"
       -DmodelName="pai_rf_test_model"
       -DforceCategorical="f1"
       -DlabelColName="class"
       -DfeatureColNames="f0,f1"
       -DmaxRecordSize="100000"
       -DminNumPer="0"
       -DminNumObj="2"
       -DtreeNum="3";
  3. Run the following PAI command to submit the parameters configured for the Prediction component:
    PAI -name prediction
        -project algo_public
        -DinputTableName=pai_rf_test_input
        -DmodelName=pai_rf_test_model
        -DresultColName=prediction_result
        -DscoreColName=prediction_score
        -DdetailColName=prediction_detail
        -DoutputTableName=pai_temp_2283_76333_1
  4. View the output result table pai_temp_2283_76333_1 shown in the following figure.Prediction result