Importing rule models and sample data

With the sample files, you can import rules models that show the products that are bought together.

The rules models are stored in the table IDMMX.RULEMODELS. The table RETAIL_SCORING contains various lists of transactions.

To create the sample table RETAIL_SCORING, run the sample script retailImport.db2 by using the following command:
db2 -stf retailImport.db2
The following excerpt from the sample script retailImport.db2 imports the associatioon rule model RetailAssocModel and the sequence rule model RetailSequencesModel into the table IDMMX.RULEMODELS:
IMPORT FROM ruleModels.del OF DEL MODIFIED BY LOBSINFILE
   INSERT INTO IDMMX."RULEMODELS" ( "MODELNAME", "MODEL","DESCRIPTION"); 

If you use PMML files that are not in compressed format, use the function IDMMX.DM_impRuleFile instead of the script retailImport.db2to import your own models.

The following excerpt from the sample script retailImport.db2 creates the sample table RETAIL_SCORING. This table contains the sample data.
CREATE TABLE "RETAIL_SCORING" (
    "CUSTOMER_ID" CHAR(7),
    "TRANSDATE"   DATE,
    "ITEMID"      CHAR(3),
    "TRANSID"     CHAR(5),
    "ITEMNAME"    CHAR(18) ); 
The following excerpt from the sample script retailImport.db2 imports retail data that is contained in the sample file retailScoring.data into the RETAIL_SCORING table.
IMPORT FROM retailScoring.data OF DEL INSERT INTO "RETAIL_SCORING"(
     "CUSTOMER_ID",
     "TRANSDATE",
     "ITEMID",
     "TRANSID",
     "ITEMNAME");


Feedback | Information roadmap