36.6 The CREATE_MODEL2 Procedure

The CREATE_MODEL2 procedure of the DBMS_DATA_MINING package is a procedure for defining model settings to build a model.

By using the CREATE_MODEL2 procedure, the user does not need to create transient database objects. The model can use configuration settings and user-specified transformations. In the CREATE_MODEL2 procedure, the input is a table or a view and if such an object is not already present, the user must create it.

DBMS_DATA_MINING.CREATE_MODEL2 (     
model_name            IN VARCHAR2,     
mining_function       IN VARCHAR2,     
data_query            IN CLOB,     
set_list              IN SETTING_LIST,     
case_id_column_name   IN VARCHAR2 DEFAULT NULL,     
target_column_name    IN VARCHAR2 DEFAULT NULL,     
xform_list            IN TRANSFORM_LIST DEFAULT NULL);

The data_query parameter species a query which provides training data for building the model. The set_list parameter specifies the SETTING_LIST. SETTING_LIST is a table of CLOB index by VARCHAR2(30); Where the index is the setting name and the CLOB is the setting value for that name. The rest of the parameters are covered in the CREATE_MODEL procedure.

You can also rename the model using the RENAME_MODEL procedure of the DBMS_DATA_MINING package. The procedure changes the value of the machine learning model specified against MODEL_NAME with another name that you specify.

The following CREATE_MODEL2 procedure builds a classification model using SVM algorithm. The following example mining_data_build_v data set to arrive at likelihood of customers opting the affinity card program. .

DECLARE
    v_setlist DBMS_DATA_MINING.SETTING_LIST;
BEGIN
    v_setlist('PREP_AUTO') := 'ON';
    v_setlist('ALGO_NAME') := 'ALGO_SUPPORT_VECTOR_MACHINES';
    v_setlist('SVMS_KERNEL_FUNCTION') := 'SVMS_LINEAR';
 
    DBMS_DATA_MINING.CREATE_MODEL2(
        MODEL_NAME          => 'SVM_MODEL',
        MINING_FUNCTION     => 'CLASSIFICATION',
        DATA_QUERY          => 'select * from mining_data_build_v',
        SET_LIST            => v_setlist,
        CASE_ID_COLUMN_NAME => 'CUST_ID,
	TARGET_COLUMN_NAME  => 'AFFINITY_CARD');
END;