Creating a classification task and building a classification model

This section shows how to create a value of type DM_ClasBldTask and how to insert it into the table IDMMX.CLASTASKS.
Use the following command to run the sample script heartClasTrain.db2 to create a DM_ClasBldTask value and start a classification training run:
db2 -stf heartClasTrain.db2
The first part of the sample script heartClasTrain.db2 contains an INSERT statement to build a DM_CLASBLDTASK to predict the column DISEASED in table HEART. The task is inserted into table IDMMX.CLASTASKS with ID HeartClasTask:
INSERT INTO  IDMMX."CLASTASKS" ( "ID", "TASK")
WITH "MYDATA" ( "MYDATACOL" ) AS 
  (VALUES(IDMMX.DM_MiningData()..DM_defMiningData('HEART')))
SELECT 'HeartClasTask',
  IDMMX.DM_ClasBldTask()..DM_defClasBldTask(
    "MYDATACOL", cast( NULL as IDMMX.DM_MiningData), 
    IDMMX.DM_ClasSettings()..
          DM_useClasDataSpec("MYDATACOL"..DM_genDataSpec())
                           ..DM_setClasTarget('DISEASED')) 
FROM "MYDATA";
The next part of the sample script calls the classification training stored procedure DM_buildClasModelCmd, which uses the DM_CLASBLDTASK value to build a classification model.
CALL IDMMX.DM_buildClasModelCmd('IDMMX.CLASTASKS', 'TASK', 'ID',
                       'HeartClasTask',
                       'IDMMX.CLASSIFMODELS', 'MODEL', 'MODELNAME',
                       'HeartClasModel' );


Feedback | Information roadmap