Using the application functions

Intelligent Miner® includes functions that apply imported mining models to selected data.

The following table lists each function together with a brief summary of how it is used.

Table 1. Functions for applying models
Application function Purpose
DM_applyClusModel Applies a model to selected data to produce results data, grouped into clusters. Clusters are identified when the model is built. They identify similar characteristics in data.

You can use this function in producing targeted mailshot letters.

DM_applyClasModel Applies a model to selected data to produce results data that is classified according to rules established when the model is built.

You can use this function in classifying insurance risks.

DM_applyRegModel Applies a model to selected data to calculate a predicted value. The predicted value is based on the values of input fields, according to a pattern established when the model is built.

You can use this function in ranking customers.

Each function has the following input arguments:
An imported mining model of the appropriate type
This input parameter can be:
  • A mining model that resides in a table. One column of the table contains the identifier or the name of the model. The other column contains the model itself. In this case, the WHERE clause in the SELECT statement determines which models are the input to the application function. If the WHERE clause selects more than one model, these models are applied to the data one after each other.
  • A mining model that resides in the model cache or in one of the model tables. You must specify only the name of the model. If a model with the same name already exists in the model cache, this model is used. Otherwise, a model with the specified name is used from a model table such as IDMMX.CLUSTERMODELS. If the model name cannot be resolved, the function fails.
The data the model is applied to
The data the model is applied to must be provided as an XML string that contains the column names and the values of a row.

Example:

<row><column name="DEPTNO">D01</column>
<column name="MGRNO" null= "true"/>
<column  name="ADMRDEPT">A00</column></row>

There are several ways of how to construct this XML string. The most convenient and best performing way is to use the DB2® REC2XML function. For the apply functions that expect an object of type DM_ApplicationData, you must use the DM_impApplData function to convert the REC2XML output of type VARCHAR into type DM_ApplicationData.

Example:

IDMMX.DM_impApplData( REC2XML( ... ) )
Result specification
The parameter resultspec is optional. It is only valid for DM_applyClusModel and DM_applyClasModel.

For more information refer to Customizing the results data.

The following list shows how to start the various types of the DM_applyXXXModel functions:
Specifying a model with the model name and a data record as a character string
DM_applyXXXModel( model name, data record )

Where XXX can be CLAS, CLUS, or REG.

Example:

IDMMX.DM_applyClusModel( 'DemoBanking', rec2xml( 1.0, 'COLATTVAL', '', 
"AGE","GENDER","MARITAL_STATUS" ) ) 
Specifying a model as a LOB and an application data object
DM_applyXXXModel( model, application data )

Where XXX can be CLAS, CLUS, or REG.

Example:

SELECT IDMMX.DM_applyClusModel( C."MODEL" ,
IDMMX.DM_impApplData(rec2xml( 1.0, 'COLATTVAL', '', 
B."AGE",B."GENDER",B."MARITAL_STATUS") ) )
FROM "BANKING_SCORING" B, IDMMX."CLUSTERMODELS" 
     C WHERE C."MODELNAME"='DemoBanking'
By using Clustering and Classification, you can additionally customize the scoring result with a third optional parameter:
DM_applyXXXModel (  model, application data, resultspec )
Where XXX can be CLAS or CLUS .
Example:
SELECT IDMMX.DM_applyClusModel( C."MODEL" ,
IDMMX.DM_impApplData(
rec2xml( 1.0, 'COLATTVAL', '', 
B."AGE",B."GENDER",B."MARITAL_STATUS") ) ,
IDMMX.DM_ClusResultSpec()..DM_setCluster(3) )
FROM "BANKING_SCORING" B, IDMMX."CLUSTERMODELS" C 
WHERE C."MODELNAME"='DemoBanking'

The function returns results data that contains the values that are calculated by the mining logic.

The field names contained in the XML data record value are mapped to the fields in the applied model using the following logic:


Feedback | Information roadmap