You can use Intelligent Miner Scoring functions to import certain types of mining modules into a DB2 table, apply the models to data within DB2, and receive scoring results. DB2 QMF for Windows provides these Intelligent Miner Scoring functions:
For more information on DB2 Intelligent Miner, see Using DB2 Intelligent Miner for Data.
The example below shows a simple query that uses IM Scoring:
SELECT A.Name Q.PredictClass('DemoBanking', REX2XML(2,'COLATTVAL',", A.Type, A.Age, A.Siblings, A.Income) ) As RiskClass FROM BankCustomers A
This query refers to the arbitrary table, BankCustomers, which contains information about customers of a bank. For each customer, the scoring function computes a value that might be a classification of credit risk. This prediction is implemented by the scoring function Q.PredictClass. The first argument, DemoBanking, is the name of a mining module. The second argument is the input data, constructed by REC2XML.
The query results contain simple values such as:
Name | Risk class |
---|---|
Joe Padeni | high |
Susan Sztuba | high |
Callie Atchue | low |
The Q.PredictClass function returns a VARCHAR. In the example, it produces a high or low value. A mining model contains the patterns and formulas needed to predict clusters, classes, or numeric values. These patterns are read by the user defined function in order to compute predictions.