Before using this information and the product it supports, be sure to read the information in Appendix E. Notices.
This edition applies to Version 8.2 of IBM DB2 Intelligent Miner Modeling, program number 5765-F32, and to all subsequent releases and modifications until otherwise indicated in new editions.
This edition replaces SH12-6736-00.
IBM(R) DB2(R) Intelligent Miner(TM) Modeling is a DB2 SQL application programming interface. It consists of a set of database objects that enable you to build data mining models from information that is held in IBM DB2 databases. The DB2 SQL interface supports the rapid creation of data mining modeling applications.
Throughout this book, the following abbreviations are used:
This book describes how to install and use IM Modeling. It also provides a comprehensive reference resource to all of the database objects that make up IM Modeling.
For more information on:
This book is intended for use by the following users:
In DB2, the names of functions, data types, tables, and table columns are created in uppercase characters, even if you used, for example, lowercase characters. In this book, these names are represented in mixed case for better readability.
CREATE TABLE "BANKING_SCORING" ( "CLIENT_ID" CHAR(9) NOT NULL PRIMARY KEY, "AGE" REAL, "GENDER" CHAR(2), "MARITAL_STATUS" CHAR(12), "PROFESSION" CHAR(24), "NBR_YEARS_CLI" REAL, "SAVINGS_ACCOUNT" CHAR(3), "HAS_LIFE_INSURANCE" CHAR(3), "INT_CREDITCARD" CHAR(3), "ONLINE_ACCESS" CHAR(3), "JOINED_ACCOUNTS" CHAR(3), "BANKCARD" CHAR(3), "AVERAGE_BALANCE" DECIMAL(10,2), "NO_CRED_TRANS" REAL, "NO_DEBIT_TRANS" REAL ) NOT LOGGED INITIALLY
Table 1 shows the formatting conventions used in this book.
| Convention used | How it is used |
|---|---|
| Command syntax is shown in a monospaced font. | db2 -stf idmtab.db2 |
The names of the following are shown in a monospaced
font:
|
Use the DM_defMiningData method to construct a new DM_MiningData value. The column information is automatically retrieved. For more information refer to DM_defMiningData. |
| Variables within syntax descriptions, which you should replace by a real value, are shown in italics. If they consist of more than one word they are placed between angle brackets. | idmdisabledb <db name> |
| Italics are used to highlight the introduction of a new term, or for emphasis. | The Classification mining function analyzes records that are already known to belong to a certain class. |
Table 2 shows the abbreviations used in this book.
| Abbreviation | Full form |
|---|---|
| API | Application programming interface |
| CRM | Customer Relationship Management |
| EMT | Error message table |
| ISV | Independent software vendor |
| PIT | Progress information table |
| PMML | Predictive Model Markup Language |
| RPM | Redhat Package Manager |
| SQL | Structured Query Language |
| UDF | User-defined function |
| UDM | User-defined method |
| UDT | User-defined data type |
| XML | Extensible Markup Language |
This book is divided into the following parts:
The appendixes provide information about the interfaces provided by IM Modeling and how IM Modeling is related to other data mining products. You can also find a glossary of terms related to data mining, a bibliography, and an index.
In the reference part of this book, the syntax for IM Modeling's functionality is described using the following structure:
The >>--- symbol indicates the beginning of a statement.
The ---> symbol indicates that the statement syntax is continued on the next line.
The >--- symbol indicates that a statement is continued from the previous line.
The -->< symbol indicates the end of a statement.
>>-required item-----------------------------------------------><
>>-+---------------+------------------------------------------->< '-optional item-'
If you must choose one of the items, one item of the stack appears on the main path.
>>-+-required choice1-+---------------------------------------->< '-required choice2-'
If choosing none of the items is an option, the entire stack appears below the main path.
>>-+------------------+---------------------------------------->< +-optional choice1-+ '-optional choice2-'
A repeat arrow above a stack indicates that you can make more than one choice from the stacked items.
.----------------------. V | >>---+------------------+-+------------------------------------>< +-optional choice1-+ '-optional choice2-'
Your feedback is important in helping us to provide you with the most accurate and high-quality information possible. If you have any comments about this book:
This section introduces you to the new features in IM Modeling.
IM Modeling is available as 32-bit and 64-bit version. In addition to Windows(R), Linux(R), AIX(R), and Solaris platforms, IM Modeling now supports HP/UX (Itanium). On AIX, Linux (Itanium), and Solaris, IM Modeling now natively supports 64-bit DB2 instances.
The standards for data mining are outlined in ISO/IEC 13249; the description appears in Part 6: Data Mining of the standards specification. This specification has the general title Information technology - Database languages - SQL Multimedia and Application Packages.
IM Scoring shares common infrastructure like XML parsing, error handling, tracing, licensing, and diagnostics with IM Modeling.
You should consider the following consistency notices when using IM Modeling V8.2:
The IBM DB2 Intelligent Miner is a set of the following products:
These products provide rapid enablement of IM analytics that are embedded in Business Intelligence (BI), eCommerce, or traditional Online Transaction Processing (OLTP) application programs. They are available as separately priced products. They are also available in the IBM DB2 Data Warehouse Edition, except for IM for Data.
In addition to the set of IM products, the following features for Intelligent Miner are available for free on alphaWorks(R) at the alphaWorks home page:
IM Scoring and IM Modeling constitute a software development kit (SDK). They consist of Oracle cartridges (IM Scoring only) or DB2 extensions that include an SQL API. You can embed the SQL API in business applications to exploit the data mining functions from this business application.
The SQL API consists of the following layers that provide different granularity and a different degree of abstraction:
In DB2, professionals can interactively issue SQL statements from the command center or from the command line processor. They can also start Intelligent Miner functions from one of these interfaces.
Intelligent Miner V8.2 provides an add-in demo that is based on an Excel spreadsheet. This demo illustrates the functionality of the SQL API and how to use it. With this demo, you can prototype IM functions to develop a proof-of-concept without dealing with the complexity of the SQL API.
To assist application developers, Intelligent Miner V8.2 provides a WebSphere Studio Plug-in. This plug-in contains graphical wizards and editors that are integrated in the WebSphere Studio Plug-in environment. With these tools, application developers can graphically model mining tasks and generate the SQL to embed IM SQL functionality into their business applications.
Depending on the experience, the personal preferences, the mining skills, and the complexity of the problem to solve, you can choose between the following approaches to develop a mining solution:
Figure 1 shows a typical scenario of how you can use the IM products in your business environment:
For more information refer to:
IM Scoring provides scoring technology as database extenders, DB2 extenders, and Oracle cartridges. It enables application programs to apply PMML models to large databases, subsets of databases, or single rows or cases. Application programs use the SQL API, which consists of user-defined functions (UDFs) and user-defined methods (UDMs), to perform the scoring operation. The PMML models might have been created by one of the Intelligent Miner products or by other applications and tools that support PMML models.
The following table shows the different PMML models that can be applied by different mining algorithms.
| Data mining function | PMML model type | Mining algorithm | Generated by IM for Data | Generated by IM Modeling |
|---|---|---|---|---|
| Clustering | Center-based clustering | Center-based Clustering algorithm | yes | no |
| Distribution-based clustering | Distribution-based Clustering algorithm | yes | yes | |
| Classification | Neural networks | Neural Classification algorithm | yes | no |
| Decision tree | Tree Classification algorithm | yes | yes | |
| Regression | Logistic Regression algorithm | no | no | |
| Regression | Regression | Linear Regression algorithm | yes | no |
| composite MiningModel (see Notes) | Transform Regression algorithm | no | yes | |
| Proprietary XML | RBF Prediction algorithm | yes | no | |
| Neural networks | Neural Regression algorithm | yes | no |
IM Scoring includes IM Scoring Java Beans, which enables you to score a single data record in a Java application given a PMML model. This can be used to integrate scoring in e-business applications, for example, for real-time scoring in customer relationship management (CRM) systems.
IM Modeling provides IM Modeling technology as DB2 extenders. It enables SQL application programs to develop analytic models based on data accessed by DB2 Universal Database(TM) Version 8.1 or Version 8.2 SQL. Using the SQL API, you can build Associations, Distribution-based Clustering, Tree Classification, and Transform Regression PMML models that are stored in DB2 tables. They can be processed by IM Scoring or IM Visualization.
IM Modeling is easy to understand for users who are familiar with the mining functions in IM for Data.
IM Visualization provides the following JAVA visualizers to present data modeling results for analysis:
You can use the Intelligent Miner Visualizers to visualize PMML-conforming mining models. Applications can call these visualizers to present model results, or you can deploy the visualizers as applets in a Web browser for ready dissemination. The models might have been developed by using IM Modeling or other applications and tools that support interoperability through the use of PMML models, or models of the Intelligent Miner for Data might have been exported as PMML models. Models are stored as flat files, or you can directly visualize mining models from the database. The models in the database have been created by IM Modeling or they have been imported into the database using the import functions of IM Scoring.
The focus of the PMML standard is interoperability for scoring. The best results with IM Visualization can be achieved if the PMML models contain IM Visualization extensions such as distribution statistics or quality information as produced by IM Modeling. For more information on IM Visualization extensions contact your IBM representative.
IM Visualization Version 8.2 provides the following enhancements:
The Intelligent Miner Visualizers Version 8.1 are also included in Intelligent Miner for Data Version 8.1.
Intelligent Miner for Data Version 8.1 is an independent product that provides the following mining functions to build and apply mining models based on database or flat file data:
The Processing functions can be used only on database tables.
IM for Data Version 8.1 is a stand-alone data mining application (workbench) for end users and primarily statisticians with advanced data mining skills. It includes the Intelligent Miner Visualizers and the PMML conversion component of IM Scoring, which allows you to export mining models in PMML format.
Data mining is an innovative way of gaining new and valuable business insights by analyzing the information held in your company database. These insights can enable you to identify market niches, and they support and facilitate the making of well-informed business decisions. Essentially, data mining is a ground-breaking way to leverage the information that your company already has in order to plan a business strategy for the future.
Data mining uncovers this in-depth business intelligence by using advanced analytical and modeling techniques. With data mining, you can ask far more sophisticated questions of your data than you can with conventional querying methods. The information that data mining provides can lead to an immense improvement in the quality and dependability of business decision-making.
Conventional methods can tell a bank, for example, which of the bank account types that it provides is the most profitable. However, only data mining enables the bank to create profiles of the customers who already have this type of account. The bank can then use data mining to find other customers who match that profile, so that it can accurately target a marketing campaign to them.
Data mining can identify patterns in company data, for example, in records of supermarket purchases. If, for example, customers buy product A and product B, which product C are they most likely to buy as well? Accurate answers to questions like these are invaluable aids to marketing strategies.
Data mining can identify the characteristics of a known group of customers, for example, those who have a proven record as poor credit risks. The company can then use these characteristics to screen new customers and to predict if they also will be poor credit risks.
Data mining tools ease and automate the process of discovering this kind of information from large stores of data.
A data mining analyst wants to obtain the rules contained in historic data. A specific mining algorithm is selected, configured, and applied to a specified set of input data. The execution of the mining algorithm is called training phase. The result of the training phase is a data mining model. The model can then be used in:
In Figure 2 the Modeling buildModel function receives a BldTask object that describes the physical (MiningData) and logical (LogicalDataSpec) schema of the input table as well as the settings that configure the mining algorithm. It produces a mining model.
The training phase consists of the following steps:
Consists of source table name, column names, and types, optional alias names
Holds for each field in the source table the mining field name and mining field type. It also optionally holds name mappings, taxonomies, or numerical field properties. A mining field name matches an alias name in mining data to map the fields during the training run.
Consists of the logical data specification and additional mining function/algorithm, specific settings, such as:
Combines mining settings with mining data. Additionally some control parameters can be set such as the location for error or progress information. For example:
INSERT INTO IDMMX.ClasTasks (ID,TASK)
WITH MyData (MyDataCol) AS (VALUES(
IDMMX.DM_MiningData()..DM_defMiningData('HEART')))
SELECT 'HeartTask', 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;
Executing a predefined mining task. The mining model is written into a table during execution. For example:
CALL IDMMX.DM_buildClasModelCmd( 'IDMMX.CLASTASKS', 'TASK','ID','HeartTask',
'IDMMX.CLASSIFMODELS','MODEL','MODELNAME','CustModel'); Familiarizing yourself with model training summarizes how to train a model. Here you find a more detailed overview of the individual steps that are required to build, test, and work with models.
You begin a data mining project with a well-defined business intelligence project plan. The business analysts in your company define a problem that they want to solve, and a definite business intelligence goal that they want to achieve. The better this initial formulation, the clearer your guidelines about what data and which mining functions you use to achieve the desired result.
Your data mining project consists of the following major phases:
During the model-building process, after preparing your data you specify your decisions about:
IM Modeling uses the following database objects when building a model:
These database objects are introduced in Introducing database objects and data mining in SQL.
You can test a Classification or Regression model. Then you can analyze the quality of the model.
You can display your data mining results to analyze and interpret them. Use IM Visualization to view and analyze the results.
You apply a model to other data in the application phase of data mining. Use IM Scoring to score the data records.
You can use various functions to retrieve information about the model in tables for further processing by other application programs.
For detailed instructions on how to build, test, and work with a model refer to Using IM Modeling.
When building a mining model you must first specify the source data that will be the subject of the training run. You specify the name of the table that holds your source data, and optionally the columns that it contains. The definition also specifies an optional alias name for each column. The alias name is usually the same as the column name.
For detailed instructions refer to:
Next, you define some generic settings that are necessary for mining fields. For each column in your source data, a mining field holds logical settings that are important for your training run. These settings are largely independent of the data mining function you are using; they are held together in the logical data specification.
The most important information contained in the logical data specification is the field name and field type for each mining field. If you are not sure what fields to use for mining, IM Modeling can determine whether a field should be used or not. The field name must match an alias name in the mining data definition in order to map the field name to the appropriate field in the mining data definition. The specification can also contain name mappings and taxonomies; for information about these features, see:
The easiest way to define a logical data specification is to let IM Modeling do it for you from the input data definition that you create at the beginning. This is also the recommended way. However, you can also create or modify the logical data specification separately if you want. You might do this if, for example, a logical data specification already exists, and you want to use it for a new set of source data.
For detailed instructions refer to:
Next, you define the mining settings that contain the specific instructions necessary for the mining function you want to use. Each mining function requires its own specific settings. For example, if you are using the:
For the Classification or Regression mining function, you must specify the name of the target field.
The logical data specification, which you have already created, also becomes part of the mining settings. You can limit the fields that are used for mining by manually indicating the fields to use.
You can use autonomic preprocessing and customization to identify which fields to use or to drop, for more information refer to Autonomic variable selection. It:
For detailed instructions refer to:
Next, you create the mining task. A mining task brings together all the information actually needed to start a training run and to compute the mining model. This information consists of the mining settings you created in the previous step, and the input data definition that you created at the beginning.
You can define tasks for test runs also. These tasks bring together all the information actually needed to start a test run. This information consists of the mining data used to test a mining model and a location of the mining model to be tested.
For detailed instructions refer to:
Next, you build the mining model by using a predefined stored procedure that builds the model and stores it in a database table. You specify the mining task that you built in the previous step, as well as the database location for the model. This model contains the rules and patterns found in the data.
The model-building process is often iterative. That is why this process is referred to as the training of a mining model. Usually, several passes over the input data are necessary before a model is generated; any repeated passes that are necessary are performed by the mining algorithm. After a model is complete, you usually store it as a database object.
For detailed instructions refer to:
You can test a model (Classification or Regression models) , and you can also analyze its quality by extracting quality information from the test result or model.
For detailed instructions refer to:
Only the predictive mining functions (Classification and Regression) have a test phase in IM Modeling. You use predefined stored procedures to test the model, compute the test result, and write it into a database table.
Testing a model means that the model is applied to data which already contains the target field values that the model can predict. The test compares the predicted and the actual target field values and uses this comparison to create a test result, which contains various model quality numbers and a lift or gains chart. The gains chart shows graphically how well the model's predictions, when sorted by descending predicted values, reproduce the order of the test data records when sorted by descending actual target field values.
Figure 3 illustrates how the model-testing phase works.
For detailed instructions refer to Testing Classification or Regression models.
When you analyze the quality of a model you extract quality information from a test result or model. Some of the functions that are available in IM Modeling provide this information in tables that you can further process with other programs. You can:
For more information refer to Quality concepts.
At the end of the model-building process you must:
The following list shows where you can deploy the model and how you can prepare the model content for the corresponding application phase. You can deploy the model in:
To prepare your model for scoring, you can retrieve information from the model, for example the signature of a model and the importance of its field.
This chapter introduces you to the different data mining functions that are supported by IM Modeling. These data mining functions are grouped into different PMML model types and mining algorithms (an overview is provided in Table 3). Each model type includes different algorithms to deal with the individual data mining functions.
The following sections introduce you to the Associations mining function.
The goal of the Associations mining function is to find items that are consistently associated with each other in a meaningful way. For example, you can analyze purchase transactions to discover combinations of goods that are often purchased together. The Associations mining function answers the question: If certain items are present in a transaction, what other item or items are likely to be present in the same transaction?
The relationships discovered by the Associations mining function are expressed as association rules. In a typical commercial application, the mining function finds associations and also assigns probabilities. For example, it can find that, if customers buy paint, there is a 20% chance that they will also buy a paintbrush. It also finds multiple associations, for example, if a customer buys paint and paintbrushes, there is a 40% chance they will also buy paint thinner.
You can use IM Visualization to analyze the association rules in mining models created for example by IM Modeling. When analyzing association rules, you must read the rules and decide if they are:
Association rules discovery is used in market basket analysis, item placement planning, and promotional sales planning, among many other applications.
You use this mining function to find association rules among items that are present in a set of groups. A typical association rule finds the following:
The combination 'x and y and z' occurs in n% of all the groups that were considered.
Thus, the mining function finds associations between items, and also calculates some statistics about the rule, as in the percentage values m and n above.
When the algorithm runs, it can potentially create too many or too few association rules to suit your purposes. For example, it is usually not possible to calculate all the possible rules for a large set of groups: there would simply be too many. The converse can also occur. The default settings or the settings you chose might have returned only a few rules. In this case, you might need to increase the number of rules.
For instructions on rule reduction, see Controlling the number of association rules.
You specify items and groups in the model-building process when you define mining settings.
Items are the units among which associations are made. For example, a typical item is an individual article bought by a customer during a visit to a supermarket.
A group is a meaningful unit that contains items. Typically, it contains the result of a single business transaction where several items are involved. For example, a typical group is the set of articles bought by a customer during a visit to a supermarket.
The Association kernel can read the groups of items out of tables with different table layouts as described in Defining the layout of the input table.
The principal parts of an association rule are the rule body (also referred to as antecedent) and the rule head (also referred to as consequent).
For example, where [x][y]->[z] is an association rule:
The rule body contains the item or items for which the Associations mining function has found an associated item. The rule head contains the item found.
You can set a limit to the number of items found in an association rule. To do this, specify the maximum rule length. For details, see Rule length and item constraints.
The support of an association rule is the percentage of groups that contain all of the items listed in that association rule. The percentage value is calculated from among all the groups that were considered. This percentage value shows how often the joined rule body and rule head occur among all of the groups that were considered.
Thus, the support of a rule is the percentage equivalent of a/b, where the values are:
You can specify that only rules that achieve a certain minimum level of support are included in your mining model. This ensures a highly meaningful result. It is also one of the ways in which you can control the number of rules that are created.
You set the minimum support when defining mining settings. For instructions, see Defining minimum support.
The confidence of an association rule is a percentage value that shows how frequently the rule head occurs among all the groups containing the rule body. The confidence value indicates how reliable this rule is. The higher the value, the more often this set of items is associated together.
Thus, the confidence of a rule is the percentage equivalent of m/n, where the values are:
As in the case of the support factor, you can specify that only rules that achieve a certain minimum level of confidence are included in your mining model. This ensures a definitive result, and it is, again, one of the ways in which you can control the number of rules that are created.
You set minimum confidence as part of defining mining settings. For instructions, see Defining minimum confidence.
The lift value of an association rule is the ratio of the confidence of the rule and the expected confidence of the rule. The expected confidence of a rule is defined as the product of the support values of the rule body and the rule head divided by the support of the rule body.
The lift of a rule is defined as: lift = confidence / expected_confidence = confidence / ( s(body) * s(head) / s(body) ) = confidence / s(head), where:
The expected confidence is identical to the support of the rule head. It is assumed in the definition of the expected confidence that there is no statistic relation between the rule body and the rule head. This means that the occurrence of the rule body does not influence the probability for the occurrence of the rule head and vice versa. The lift is a measure for the deviation of the rule from the model of statistic independency of the rule body and rule head. The lift is a value between 0 and infinity:
You can see the lift value of an association rule in IM Visualization or extract it from a rule model using the DM_getRules table function. For more information refer to DM_getRules.
The field values in your source data might be hard to read or might not be intuitively meaningful, for example, where they contain bar codes. In these cases, you can replace cryptic values with easily readable ones by using name mappings. The field value in your source data might be simply a number (for example, '138') that represents an item (for example, 'cheese'). In this case, the name mapping would map '138' to the name 'cheese'.
When you assign a name mapping to a field, you map the field value in the physical data to a different value. The mapped name is written together with the field value into the mining model. You can then see the readable mapped name later during the visualization of the mining model.
For instructions on how to apply name mappings, see Defining name mappings and Name mapping and taxonomy.
You can make the associations found among items more meaningful if you group the items in categories. You can group these categories again into other categories, and so on. What you get is a hierarchy of categories with the items on the lowest level. This is called a taxonomy.
The following example illustrates a taxonomy with three hierarchy levels:
Level 0 Level 1 Level 2 Orange Juice | | Beverages | Beer | | | | Food | Tomato | | | | Cabbage | Vegetables | | Carrot |
If you apply a taxonomy during an Associations mining run, the groups are expanded for the calculation of the rules. If an item of a group is a member of a category, this category is added to the group. If the added category is a member of another category, this other category is also added to the group, and so on. During the calculation of the rules, the categories in the expanded groups are handled in the same way as the items. Therefore, the rules refer not only to the items but to the categories as well. In the preceding example, a rule
might be accompanied by the rules
This means that a taxonomy enables different items (or categories) to be considered as equivalent under a new category name. Note that an item or category might be a member of one or more categories, or of none.
In IM Modeling, you have to define a taxonomy by one or more category maps. A category map is a table that has two columns, the child column and the parent column. Each record of the table describes one relation between an item and a category or between a category and another category. The member of a category is stored in the child column and the category itself in the parent column.
There are two types of category maps:
An Example: The hierarchy given in Figure 4 can be represented by two non-recursive category maps, as follows:
| Child | Parent |
|---|---|
| Orange Juice | Beverages |
| Beer | Beverages |
| Tomato | Vegetables |
| Cabbage | Vegetables |
| Carrot | Vegetables |
| Child | Parent |
|---|---|
| Beverages | Food |
| Vegetables | Food |
The same hierarchy can also be represented by one recursive category map, as follows:
| Child | Parent |
|---|---|
| Orange Juice | Beverages |
| Beer | Beverages |
| Tomato | Vegetables |
| Cabbage | Vegetables |
| Carrot | Vegetables |
| Beverages | Food |
| Vegetables | Food |
For more information refer to Adding and removing category maps.
IM Modeling distinguishes between two types of hierarchies. If a hierarchy contains only relations that start and end on two consecutive levels, the hierarchy is balanced. If a hierarchy contains relations that do not start and end on two consecutive levels, the hierarchy is unbalanced. In an unbalanced hierarchy, the relation passes across a hierarchy level.
For an example of a balanced hierarchy, see Figure 4. The following is an example of an unbalanced hierarchy:
Level 0 Level 1 Level 2 Orange Juice | | Beverages | Beer | | | | Food | Fish | | Cheese |
If your hierarchy is unbalanced, you have to make sure that a relation that crosses hierarchy levels is in the same subset as all other relations that end or start at the crossed hierarchy levels.
Usually, a taxonomy is defined by a number of recursive and non-recursive categories. You have to:
Consider the following when you break up the set of relations into subsets:
The following set of examples provides a guide to the best combination of category maps in various situations.
The simplest choice is one recursive category map holding all the relations. If it suits your purposes better, you can define several non-recursive category maps, one for each relation between two consecutive hierarchy levels.
The simplest choice is one recursive category map holding all the relations.
You must use non-recursive category maps.
You must separate the unbalanced parts of the taxonomy from the balanced parts. Describe the unbalanced parts by recursive category maps and the balanced parts by non-recursive category maps.
You can define name mappings for your taxonomy. This is particularly helpful if your taxonomy uses identical item and category names on different levels. You must define a name mapping for each category map individually. The name mapping acts on all categories of the category map except for the items and categories at the lowest hierarchy level of the category map. You must not define a name mapping for the lowest level of a category map because the name mapping of the preceding category map acts on the lowest level. The first category map that contains all relations starting from hierarchy level 0 does not have a preceding category map. In this case, the name mapping for the lowest level is defined by the name mapping of the item field.
You define taxonomies when defining the logical data specification. For instructions, see Defining taxonomies.
You can control the number of rules found by the Associations mining function by various means. These include changing the values for minimum support, for minimum confidence, or for both. You can also use the following ways to control results:
Example: [Swimsuit][Beach towel] -> [Sunglasses]
Item constraints also work with categories of an applied taxonomy. If you decide to include the specified categories, only rules containing at least one of the specified categories or at least one of their direct or indirect members are generated. If you decide to exclude the specified categories, rules containing any of the specified categories or any of their direct or indirect members are discarded from the result.
You specify the maximum rule length and item constraints as part of defining mining settings. For instructions, see Specifying maximum rule length and Setting item constraints.
You can split your input fields between active and inactive fields.
When using the Associations mining function you need not set fields as active or inactive. This task is done by the Associations mining function together with the routine for autonomic variable selection. If this routine determines a field not to be useful for the mining process, you can overrule it by setting this field to active.
For more information refer to Defining fields as active or inactive and DM_setFldUsageType.
IM Modeling enables you to create Classification models and to validate or test these models, such as:
You can use the Classification mining function to do the following, for example:
Other suitable applications are target marketing, medical diagnosis, medical treatment effectiveness, inventory replenishment, and store location planning.
Use IM Visualization to view and analyze the Classification models, or use IM Scoring to score new data records against a model.
For example, an insurance company has data about customers who allowed their insurance to lapse and those who did not. How can the company best use this information to identify such customers in the future?
The insurance customers already belong to a certain class: they are 'classified' as having allowed their insurance to lapse. The company can use the Classification mining function to create a risk group profile in the form of a data mining model. This profile, or model, contains the common attributes of the lapsed customers, compared to the other customers. The insurance company can then apply this profile to new customers (as yet 'unclassified') to ascertain if they belong to the risk group. The procedure is as follows:
Use the Classification mining function to gain a deeper understanding of your database structure or to structure unclassified databases.
Classification is the process of automatically creating a model of classes from a set of records that contain class labels. The classification technique analyzes records that are already known to belong to a certain class, and creates a profile for a member of that class from the common characteristics of the records. You can then use a data mining scoring tool to apply this Classification model to new records, that is, records that have not yet been classified. This enables you to predict if the new records belong to that particular class.
The Classification mining function is widely used in CRM. Commercial applications of this mining function include credit card scoring, ranking of customers for directed mailing, the prediction of credit risk in new customers, and attrition prediction.
IM Modeling uses the Decision tree for Classification models. An overview of the models and algorithms is provided in Table 3.
IM Modeling supports a decision tree implementation of classification. A Tree Classification algorithm is used to compute a decision tree. Decision trees are easy to understand and modify, and the model developed can be expressed as a set of decision rules. This algorithm scales well, even where there are varying numbers of training examples and considerable numbers of attributes in large databases.
Decision Tree Classification generates the output as a binary tree-like structure, which gives fairly easy interpretation to the marketing people and easy identification of significant variables for the churn management. A Decision Tree model contains rules to predict the target variable. The Tree Classification algorithm provides an easy-to-understand description of the underlying distribution of the data.
The intuition is that, by classifying larger datasets, you will be able to improve the accuracy of the Classification model. In Classification, the given situation is a set of example records, called a training set, where each record consists of several fields or attributes. Attributes are either numerical (coming from an ordered domain), or categorical (coming from an unordered domain). One of the attributes, called the class label field (target field), indicates the class to which each example belongs. The objective of Classification is to build a model of the class label based on the other attributes. After a model is built, it can be used to determine the class label of unclassified records. Applications of Classification arise in diverse fields, such as retail target marketing, customer retention, fraud detection, and medical diagnosis.
Among these models, decision trees are particularly suited for data mining. Decision trees can be constructed relatively quickly, compared to other methods. Another advantage is that decision tree models are simple and easy to understand. A decision tree is a class discriminator that recursively partitions the training set until each partition consists entirely or dominantly of examples from one class. Each non-leaf node of the tree contains a split point that is a test on one or more attributes and determines how the data is partitioned. The tree is built by recursively partitioning the data. Partitioning continues until each partition is either 'pure' (all members belong to the same class) or sufficiently small (a parameter set by the user). The initial lists created from the training set are associated with the root of the decision tree. As the tree is grown and nodes are split to create new children, the attribute lists for each node are partitioned and associated with the children.
A decision tree classifier is built in two phases:
After the initial tree has been built (the 'growth phase'), a sub-tree is built with the least estimated error rate (the 'prune phase'). The process of pruning the initial tree consists of removing small, deep nodes of the tree resulting from 'noise' contained in the training data, thus reducing the risk of 'overfitting', and resulting in a more accurate classification of unknown data. While the decision tree is being built, the goal at each node is to determine the split attribute and the split point that best divides the training records belonging to that leaf. The value of a split point depends on how well it separates the classes. Several splitting indices have been proposed in the past to evaluate the quality of the split. IM Modeling uses the gini index.
To predict a classification, you must specify the input fields to be classified and the class label field, which is also referred to as target field. The class label field contains the class labels of the classes to which the records in the source data were attributed during the historical classification.
| Input fields | Class label field |
|---|---|
| Town districts | Risk class |
| Country | |
| Profession |
For instructions on defining the class label, see Specifying the class label field.
You can customize the binary decision tree by specifying the maximum purity per internal node. This value is a limit to stop further splitting of a node that has reached the specified purity value when the initial decision tree is being built. The maximum purity is specified as a percentage value.
For instructions on using this feature, see Specifying maximum purity.
You can customize the binary decision tree by specifying the tree depth. The tree depth is an INTEGER value. Maximum tree depth is a limit to stop further splitting of nodes when the specified tree depth has been reached during the building of the initial decision tree.
For instructions on using this feature, see Specifying maximum tree depth.
You can customize the binary decision tree by specifying the minimum number of records per internal node. The minimum number of records is an INTEGER value. This sets a limit value. It prevents further splitting of a node that has reached the specified minimal size when the initial decision tree is being built.
For instructions on using this feature, see Specifying the minimum number of records per internal node.
You can specify the percentage of incorrect predictions that you will tolerate on validation data in a Classification model. You do this by setting the cost rate value for a training run in a DM_ClasSettings value. The Tree Classification algorithm does not stop if this percentage is reached. This method is provided for compatibility with the SQL/MM standard. It does not have an effect on the model being generated.
For instructions on using this feature, see Specifying the tolerated level of incorrect predictions.
By default:
This section describes how to adjust the cost matrix manually.
A cost matrix is useful when specific classification errors are more severe than others (for example, with 'skewed data'). The Classification mining function tries to avoid classification errors with a high error weight. The trade-off of avoiding 'expensive' classification errors is the possibility of an increased number of 'cheap' ones. Thus, the number of errors increases while the cost of the errors decreases in comparison with the same classification without a cost matrix. Weights specified must be greater than or equal to zero; the default weight is 1. The cost matrix diagonal must be all zero.
You assign error weights to misclassifications by specifying a cost matrix. A cost matrix is a table of the following format, where the assumption is that the class labels are 'High risk', 'Low risk', and 'Safe':
| Actual predicted weight | |
|---|---|
| 'High risk' 'Safe' | 7.0 |
| 'Low risk' 'Safe' | 3.0 |
Your input data might contain information about customers, of whom 99% are satisfied and 1% are not satisfied. You might try to build a model that predicts whether a customer is satisfied, and you might use only a small training set of data. In this case, you might obtain a degenerated pruned tree. This tree might consist only of one node that predicts that all of the customers are satisfied. In terms of prediction power, this model is of high quality because the error rate is very low (1%). However, to understand which attribute values describe a customer who is not satisfied, a different behavior is required.
For instructions on how to implement this feature, see Defining a cost matrix.
You can split your input fields between active and inactive fields.
When using the Classification mining function you need not set fields as active or inactive. This task is done by the Classification mining function together with the routine for autonomic variable selection. If this routine determines a field not to be useful for the mining process, you can overrule it by setting this field to active.
For more information refer to Autonomic variable selection, Defining fields as active or inactive, and DM_setFldUsageType.
The following sections introduce the Clustering mining function.
The Clustering mining function consists of a range of algorithms that group data records on the basis of how similar they are. A data record may, for example, consist of information about a customer. In this case, Clustering would group similar customers together, while at the same time maximizing the differences between the different customer groups formed in this way.
The groups that are found are known as clusters. Each cluster tells a specific story about customer identity or behavior, for example, about their demographic background, or about their preferred products or product combinations. In this way, customers that are similar are grouped together in homogeneous groups that are then available for marketing or for other business processes.
Each algorithm within the Clustering mining function has its own approach to discovering clusters in data. The algorithm used in IM Modeling is Distribution-based Clustering. A possible scenario for its use is as follows:
The bank can use Distribution-based Clustering to first create a data mining model of all its customers. This model will contain one or more clusters of customers who use account X, each cluster having a specific demographic profile. The bank can then selectively target the customers of other clusters who have similar demographic profiles to those with account X but who do not have this type of account.
The Clustering mining function is used largely in CRM. The business insights provided by the use of this mining function enable firms to offer specific, personalized services and products to their customers. In the commercial environment, Clustering is used in the following areas:
The Clustering mining function searches the input data for characteristics that most frequently occur in common. The mining function segments the input data into subsets, the clusters, with the members of each cluster having similar properties, and it groups the related records accordingly. There are no preconceived notions of what patterns exist within the data; it is a discovery process.
The resulting model created by the Clustering mining function contains the number of clusters that were detected and the characteristics that make up each cluster. The results also show how these characteristics are distributed within the clusters. To determine the composition of each cluster, you can inspect the results of the Clustering process by means of visualization tools.
IM Modeling supports the demographic implementation of Clustering. Distribution-based Clustering provides fast and natural clustering of very large databases. It automatically determines the number of clusters to be generated.
Distribution-based Clustering works with demographic data, which (typically) consists of large amounts of categorical (that is, non-numerical) variables. For this reason, the mining function works best with datasets consisting of this type of variable. When working with numerical variables, the algorithm treats them almost like categorical variables by categorizing their values into buckets.
Distribution-based Clustering is an iterative process over the input data. Each input record is read in succession. The similarity of each record with each of the currently existing clusters is calculated. Initially, no clusters exist. If the biggest calculated similarity is above a given threshold, the record is added to the relevant cluster. This cluster's characteristics change accordingly. If the calculated similarity is not above the threshold, or if there is no cluster, a new cluster is created, containing the record alone. You can specify the maximum number of clusters, as well as the similarity threshold.
Distribution-based Clustering uses the statistical Condorcet criteria to manage the calculation of the similarity between records and other records, between records and clusters, and between clusters and other clusters. The Condorcet criteria evaluates how homogeneous each discovered cluster is (in that the records it contains are similar) and how heterogeneous the discovered clusters are among each other. The iterative process of discovering clusters stops after one or more passes over the input data if there is no time remaining to do another pass or if the improvement of the clusters according to the Condorcet criteria would not justify a new pass.
Similarities between records are determined by comparing their field values. The similarity between a record and a cluster is calculated by summing the similarities between that record and all the records of the cluster.
Take a situation where you want to identify similar characteristics in records of customer information. Similarity between two customers is calculated by comparing each customer attribute variable and giving a score for how closely the variables match. The scores are then summed and divided by the number of variables you compared.
If all the variables are categorical, then this is easy to understand. Take gender, for example. If you compare two customers who are both male, the gender attribute variables are identical, and they contribute to a score of 1.0. If they are different (male and female), they contribute to a score of 0.0. So take a situation where a customer is described by 10 categorical variables and you compare two customers. If any five variables are the same and the other five are different, then the two customers are 50% similar and could be grouped together, if the similarity threshold is smaller than or equal to 0.5.
For numerical variables, the concept of being the same is slightly different. If the values are identical, they contribute a score of 1.0. If the values differ, they get a score based on the degree of difference. A typical situation is where the difference is expressed in terms of the number of standard deviation of the variable for all customers. The score is then calculated so that if the two values are 0.5 standard deviation apart, the score is 0.5. Although 0.5 standard deviation is used by default, an absolute value, called similarity scale, can be defined for each field instead.
For more information refer to Similarity scale and Specifying similarity scale.
You can control the number of clusters to be created during a Clustering training run by specifying a value for the maximum number of clusters. Limiting the number of clusters prevents the production of many small clusters, and thus saves run time. By default, the Distribution-based Clustering algorithm will not create an unlimited number of clusters but will itself set a limit.
If the mining function cannot continue to create clusters because the cluster limit is reached, this may prevent further improvement in the accuracy of the model.
Increasing the number of clusters improves the likelihood of finding market niches.
For instructions on using this feature, see Specifying the maximum number of clusters.
The similarity threshold is a lower limit for the similarity of two records belonging to the same cluster. For example, if you set the similarity threshold to 0.25, records with field values that are 25% similar are likely to be assigned to the same cluster.
If you specify a similarity threshold of 1.0, you are insisting that, for customers to appear in the same group, their characteristics must be identical. You might have a large number of customer characteristic variables, or the variables might take a wide range of values. In this case, you would probably end up with each customer in a separate segment. At the other extreme is what happens if you set the similarity threshold to zero. In that case, you would end up with one large cluster containing all of your customers, because all of them become candidates. The right setting is somewhere in between, but where? You have to preserve a balance between the number of clusters that is acceptable and the degree of similarity.
There is another important factor that the Distribution-based Clustering algorithm has to consider. Even if a customer has an acceptable similarity to an existing group of customers, this does not automatically mean that they will go into the same cluster. There may be other customer groups where the match is better. The Distribution-based Clustering algorithm finds the optimum combination of customers that maximizes the similarity of all the customers within each cluster. At the same time, it maximizes the dissimilarity between the clusters it produces. To decide that, it tries to maximize the value of a statistic that it calculates, the Condorcet value.
A situation might occur where you try to give the Distribution-based Clustering algorithm a similarity threshold, and you do not limit the number of clusters that it can produce. In this case, it will keep trying to find the minimum number of clusters that satisfy the similarity threshold, because this also maximizes the Condorcet value. In a different situation, you might have limited the number of clusters with the result that, after all the possible clusters are created, a record does not have a similarity above the threshold with any of them. In this case, the record will be assigned to the cluster with the best similarity, even if the similarity threshold is not reached.
For instructions on using this feature, see Defining the similarity threshold.
You can split your input fields between active and supplementary fields.
Supplementary fields are not used to calculate the similarity between records. This means that they do not participate in the creation of the clusters. However, each cluster collects statistics on both the active and supplementary fields of the records it contains. This information can be visualized in the resulting Clustering model.
If you do not set the usage type for a field, the Clustering algorithm does it for you. The algorithm detects fields that are not useful for a Clustering training run, and automatically sets them to supplementary. Refer to Autonomic variable selection for more information about fields that are not considered useful for mining. The other fields are considered active and used for the Clustering run.
For information refer to Defining fields as active and supplementary and DM_setFldUsageType.
Field weighting gives more or less weight to certain input fields during a Clustering training run.
Table 9 shows lowered field weights for the Number of purchases and the Total purchase amount fields.
| Active fields | Field weighting | Value weighting | Compensate |
|---|---|---|---|
| Number of purchases | 0.5 | None | No |
| Day of purchase | 1.0 | None | No |
| Customer age | 1.0 | None | No |
| Senior discount | 1.0 | None | No |
| Total purchase amount | 0.5 | None | No |
For instructions on using this feature, see Specifying field weighting.
Value weighting deals with the fact that particular values in a field might be more common than other values in that field. The coincidence of rare values in a field adds more to the overall similarity than the coincidence of frequent values.
You can use one of the following types of value weighting:
Probability weighting uses a factor of one divided by the square root of p, where p is the probability of a value.
Logarithmic weighting assigns a value of the square root of (-log(p)) to both the agreement information content value and the disagreement information content value. The number p is the probability of a value.
Each type of value weighting looks at a problem from a different angle. Depending on the value distribution, using one type or the other might lead to very different results.
Value weighting has the additional effect of emphasizing fields with many values because their values are less frequent than those of fields with fewer possible values. By default, the mining function does not compensate for this additional effect.
You can select whether you want to compensate for the value weighting applied to each field. If you compensate for value weighting, the overall importance of the weighted field is equal to that of an unweighted field. This is so regardless of the number of possible values. Compensated weighting affects only the relative importance of coincidences within the set of possible values.
An example of the use of value weighting is given in Table 10.
| Active fields | Field weighting | Value weighting | Compensate |
|---|---|---|---|
| Number of purchases | 0.5 | None | No |
| Day of purchase | 1.0 | None | No |
| Customer age | 1.0 | None | No |
| Senior discount | 1.0 | Probabilistic | Yes |
| Total purchase amount | 0.5 | None | No |
For instructions on setting value weighting, see Specifying value weighting.
For a general description refer to Similarity.
The similarity between two records sums the similarities between each pair of values of these records. For a categorical field, the similarity is 0 if both values are different, and 1 if they are equal. For a numerical field, the similarity depends on the difference between the two values compared with the similarity scale of the field. If the two values are equal, the similarity is 1. If the two values are distant from the similarity scale, the similarity is 0.5. Other values of the similarity are calculated using a Gaussian curve passing through these two reference points.
You can choose to specify a similarity scale or not. You specify the similarity scale as an absolute number. The specification is considered only for active numerical fields. If you do not specify a similarity scale, the default value (half of the standard deviation) is used.
For instructions on specifying similarity scale values, see Specifying similarity scale.
For a general description refer to Similarity.
For each categorical field, you can define a similarity matrix that contains user-defined similarities between two field values. A similarity matrix is represented as a reference to a database table containing three columns. Two columns contain the field values to be compared, and the third column contains the similarity (between 0 and 1) for these field values.
You can specify the similarity for each pair of possible values. A pair of possible values can be used only once. The similarity of the inverse pair is the same.
For instructions on using this feature, see Specifying a similarity matrix.
The Clustering mining function detects outliers in numerical fields. Outliers are values that lie beyond the scope of a field's value range. You can define the field's value range by specifying the lower and upper bounds for this field. If bounds are not defined, no outliers will exist for numerical fields with a small number of values. However, a numerical field may contain too many values for them to be considered independently; for example, a total purchase amount might contain almost as many values as the number of records. In this case, the Clustering algorithm will statistically calculate a lower and upper bound and will group the values in buckets between these bounds. The outliers are the values outside these buckets.
You can determine how outliers are treated by specifying one of the following options:
You can specify an outlier treatment for each numerical field in the logical data specification.
For instructions on using outliers, see Treating outliers.
You can determine, to an approximate extent, the maximum amount of time that you are willing to wait before having a result. You do this by defining your preferred execution time. This time (in certain circumstances) is approximately respected by the Clustering mining function; if the time cannot be respected, an error message will appear. If you do not set this parameter, the execution time is unlimited, but the Distribution-based Clustering algorithm will try to keep it as short as possible.
For instructions on using this feature, see Setting the desired execution time.
If you set a desired execution time, you can also set the minimum percentage of data to be processed by the Clustering mining function. This parameter is active only if the desired execution time is set. The Clustering mining function is then allowed to work on this minimum sample of data in order to keep the execution time within the set limit. If the function is not able to create a usable model from the minimum percentage of data during this time, an error message is returned. If an error is returned, either increase the desired execution time or decrease the minimum percentage of data.
For instructions on using this feature, see Specifying the minimum percentage of data that is processed.
The following sections introduce you to the Regression mining function.
Assuming that you want to start a mailing campaign to maximize your business volume. You want to address 30% of your customers.
To predict the business volume when mailing 30% of your customers, you can start a Regression mining run on your customer data. Every record in the data table represents one customer. You might want to specify BUSINESS VOLUME as the target field.
You can also start a Regression mining run if you want to know how many of your customers to address if you want to reach a business volume of, for example, 50 000$.
You can use IM Visualization to view the curve of the model in a gains chart. A random curve, for example, means that the quality of the model is basically good. The higher the model curve starts at the beginning, the better is the model for predicting the business volume because you want to address only 30% of your customers.
A Regression model predicts the value of a numerical data field, which is the target field, in a given data record from the known values of other data fields of the same record. These latter data fields are called input data fields or explanatory data fields. They can be numerical or categorical. The predicted value might not be identical with any value contained in the data used to build the model. An example application is shown in Business context.
IM Modeling supports Transform Regression, a combination of step-wise linear regression and nonlinear field transformations. The algorithm has been patented by IBM Research.
Regression can be used to create Regression models and to test these models.
A regression model is constructed, or trained, based on known datasets of data records whose target field values are known. The model can then be applied to either known or unknown data. In unknown data, the values of the input fields are known, but not the value of the target field.
The application of the model to known data is often called test mode. The main purpose of a test mode mining run is to verify the quality and predictive power of the model by comparing its predictions to the known actual target field values of the test data. In particular, if working with a once created mining model for a long time, it is recommended that you regularly perform test runs to verify that the model is still useful. It might not be valid anymore because of systematic changes in the data as a function of time.
Regression automatically performs some sort of model testing while constructing the model. For that purpose, a part of the training data (or an extra dataset specified by the user) is held out and not used for the training process itself. Rather, this data is used to validate the current model by measuring its ability to correctly predict the target fields of records which have not been used for training before. This held-out data is called validation data, the validation step is called validation mode.
The difference between validation mode and test mode is that validation steps are performed during model construction and have an impact on the created model, whereas test mode runs are performed after model construction and leave the model unchanged. The application of models to data with unknown target field values is called application mode. This is the most frequently used mode to apply a model: it exploits the knowledge which is stored in the constructed model and uses it to generate concrete predictions for unknown target field values.
For a description of the application mode, see Intelligent Miner Scoring: Administration and Programming for DB2.
To predict the value of a data field using a Regression model, the following types of data fields must be declared:
The target field contains the historical values of the field to be predicted. When you start the training process of a Regression model, you must specify the target field. The input fields need not be specified explicitly. By default, the training algorithm considers all fields that are available in the training data (except the target field) as input fields.
For more information refer to Specifying the target field.
Use DM_setRegRSquared to specify the maximum tolerated squared Pearson correlation coefficient r2. This coefficient can be tolerated in the regression model for the error on verification data. If the training algorithms find that it is impossible to construct a model with r2 below that threshold, a warning is issued, but a valid model is constructed. Note: r2 (with 0 <= r2 <= 1) measures the correlation between the prediction error on verification data and the actual target values. r2=0 means that the prediction error and the target field values are uncorrelated, r2=1 means that the two values are perfectly (positively or negatively) correlated.
Therefore, setting an upper threshold for r2 means setting an upper limit for the acceptable systematic error of the model.
For more information refer to Specifying the maximum tolerated systematic error (RSquared) or DM_setRegRSquared.
You can determine, to an approximate extent, the maximum amount of time that you are willing to wait before having a result. You do this by defining your preferred execution time. This time (in certain circumstances) is approximately respected by the Regression mining function; if the time cannot be respected, an error message will appear. If you do not set this parameter, the execution time is unlimited, but the Regression algorithm will try to keep it as short as possible.
For instructions on using this feature, see Setting the desired execution time.
You can split your input fields between active and inactive fields.
When using the Regression mining function you need not set fields as active or inactive. This task is done by the Regression mining function together with the routine for autonomic variable selection. If this routine determines that a field is not useful for the mining process, you can overrule it by setting this field to active.
This chapter introduces you to the database objects provided by IM Modeling. These largely reflect the current standard for data mining in the context of SQL. The code sample of how you might build a data mining model is available at SQL code examples for data mining.
The SQL/MM API is a standardized open SQL API, it:
The following list of data types familiarizes you with the SQL API terminology:
User-defined types (UDTs) provided by IM Modeling consist of:
Use user-defined methods to create or change the value of structured types, or to get information about the content of a type value.
You create values of distinct types and access information about them by using the user-defined stored procedures and functions supplied with IM Modeling.
The source data type of the distinct type is BLOB. A data mining training run encodes the model in PMML, but transforms it into a binary, compressed format in the code set UTF16BE. The resulting data mining model type is not provided in readable PMML format. A binary format for the models offers the following:
You can also distinguish UDTs as follows:
The user-defined types for the mining data and the logical data specification describe the input data for training runs. This information is not specific to any mining function. Use these types to define the metadata needed for later mining functions.
This metadata consists of:
Use the user-defined types that are specific to mining functions for the actual mining processes.
For each mining function, there may be one type in each of the following categories. The test task type and the mining test result type are only available for the Classification and Regression mining functions.
This section describes the process of model-building and model-testing. The information here expands on the overview given in Building and storing mining models.
Figure 6 adds to that by showing the user-defined types that define all the information needed for a training run. The mining function used in the example is Classification. The goal is to define a mining task of type DM_ClasBldTask that contains all the information actually needed to do the building of a Classification model. You can start from either the data side or the settings side.
The simplest, and the recommended, way to start the model-building process is by defining a DM_MiningData value. You can then simply derive the logical data specification from this mining data value. When you begin this way, the alias names in the mining data value are the same as the original column names. This simplifies things, and ensures that the field names in the eventual model are the same as those in the data source. It also avoids the complication of having to redefine alias names. You can then create mining settings containing the logical data specification that has been derived in this way.
However, in special cases, you might choose to begin by defining the mining settings, for example, if you want to create generic mining settings that can be mapped to different mining data values describing source tables of similar content but different column names. You do this by using a set of fields, the existing logical data specification. You then use the logical data specification to define a mining settings value. Finally, you connect the settings value (containing the logical data specification) to the representation of the physical data (the DM_MiningData value). Note that only a matching DM_MiningData value can be connected, that is, where the mining field names are the same as the alias names. Making this connection completes the definition of the Classification task object, the DM_ClasBldTask value.
You must have a task object in order to start a training run by calling a stored procedure. The output of the training run is a model, in the case of this example, a Classification model. In Figure 6, the output of the training run is named simply Model.
For an overview of the user-defined types involved in the training run illustrated here, see User-defined data types in a Classification training and test run.
This section describes the process of model-testing. Figure 3 shows the Classification model test phase in broad overview. Figure 7 adds to that by showing the user-defined types that define all the information needed for a test run. In this case, the example shows how the types interact in the test phase of the Classification mining function. Starting from the physical data side, the goal is to define a test task containing all the information actually needed to test a Classification model. Finally, you put two items together into the Classification test task object:
You can use a Classification test task object to start a test run. The output of the test run is a Classification test result. In Figure 7, the output of the test run is named simply 'Test Result'.
It is also possible to start a test run by using directly a DM_MiningData object and the location of the Classification model to test without creating a test task before. This is described in User-defined data types in a Classification training and test run. For a graphical representation of this approach, see Figure 8.
For an overview of the user-defined types involved in the Classification test run illustrated here, see User-defined data types in a Classification training and test run.
Figure 8 provides an overview of the user-defined data types involved in the Classification training and test runs illustrated in the previous sections. Compare this figure with Figure 6 and Figure 7 to see which parts relate to which data types.
The user-defined types shown in Figure 6 and Figure 7 enable you to store the definitions used for data mining and to combine them flexibly. The user-defined types shown here hold the results of either a training run or a test run. The training run creates a data mining model from a mining task. This model incorporates a logical data specification. Objects of the DM_MiningData type must match this specification in order to be usable for a subsequent test of the model.
You can do a test run in two different ways:
Use user-defined methods to create, modify, or query the values of structured user-defined types. You can call the methods that are defined for each type as follows:
IDMMX.DM_defMiningData(IDMMX.DM_MiningData(),source_table_name)
IDMMX.DM_defMiningData(IDMMX.DM_MiningData(),source_table_name)
The user-defined methods are described in Methods reference.
Use user-defined functions to work with mining models, test results, and analyze the model quality. User-defined functions work with distinct user-defined types.
The invocation syntax is as described in Function syntax.
The user-defined functions are described in Functions reference.
Use stored procedures to:
Call a stored procedure by using the CALL statement from a DB2 client application program or DB2 command line. For an example, see Code example.
The stored procedures are described in Stored procedures reference. The Easy Mining procedures are also implemented as stored procedures. They are described in DB2 Intelligent Miner Scoring and DB2 Intelligent Miner Modeling: Data Mining with Easy Mining procedures.
This database objects provided by IM Modeling largely reflect the current standard for data mining in the context of SQL. This chapter provides an example of how you can build a data mining model in a data warehouse environment. The example given here uses the Clustering mining function.
The following is the sample scenario:
The first steps are to define the values of the user-defined types needed to store the information for the training run, that is, to create the DM_ClusBldTask value. Due to requirement 3, you must store the DM_ClusBldTask value, so that you can later repeat the training run. For this purpose, you use the table IDMMX.ClusTasks for mining tasks. The table contains the columns ID (of type VARCHAR) and TASK (of type DM_ClusBldTask).
You define the DM_ClusBldTask value as follows:
You can express all of the steps outlined in Model-building procedure by using a single SQL statement, as in the following code example:
INSERT INTO IDMMX.ClusTasks (ID,TASK)
WITH MyData(MyDataCol) AS (
VALUES(IDMMX.DM_MiningData()..DM_defMiningData('CT'))
)
SELECT 'MyTask',
IDMMX.DM_ClusBldTask()..DM_defClusBldTask(MyDataCol,
IDMMX.DM_ClusSettings()..DM_useClusDataSpec(MyDataCol..DM_genDataSpec())
..DM_setMaxNumClus(5))
FROM MyData ;
This generates the DM_ClusBldTask value, and stores it in the table IDMMX.ClusTasks under the ID MyTask.
You can now start the Clustering training run. Use the stored procedure DM_buildClusModelCmd to compute the Clustering model. This stored procedure can be called from the DB2 command line. It reads the DM_ClusBldTask value from the table IDMMX.ClusTasks, and stores the computed model in the table IDMMX.ClusterModels with the name MyClusModel. This table contains the columns MODELNAME (of type VARCHAR) and MODEL (of type DM_ClusteringModel).
Use the following CALL statement:
CALL IDMMX.DM_buildClusModelCmd( 'IDMMX.CLUSTASKS', 'TASK', 'ID', 'MyTask', 'IDMMX.CLUSTERMODELS', 'MODEL', 'MODELNAME', 'MyClusModel' )
PMML is a standard format for data mining models. Based on XML, the PMML format provides a standard that enables data mining models to be shared between the applications of different vendors. The intention is to provide a vendor-independent method for defining models. In this way, proprietary issues and incompatibilities are no longer a barrier to the exchange of models between applications.
For more information on PMML support refer to Appendix D. IM Modeling conformance to PMML.
The aim of this chapter is to get you up and running quickly in using the IM Modeling samples. It provides information on the tasks that you need to complete to get started.
To install IM Modeling, insert the CD into the machine and change to the appropriate subdirectory. The CD contains subdirectories for each platform that is supported.
After you have installed IM Modeling, you need to configure your DB2 instance and the databases that you want to use with IM Modeling.
Refer to DB2 Intelligent Miner Modeling, DB2 Intelligent Miner Scoring, DB2 Intelligent Miner Visualization: Installing the Intelligent Miner products for a detailed description on how to install and configure IM Modeling.
The IM Modeling package provides a set of sample SQL applications that you can use as practice exercises in building and testing mining models. You find instructions on using these samples and the content of the corresponding data and scripts. Both, the data and the scripts of samples are contained in the samples directory in the IM Modeling package. For more information refer to DB2 Intelligent Miner Modeling, DB2 Intelligent Miner Scoring, DB2 Intelligent Miner Visualization: Installing the Intelligent Miner products.
The following list shows how to run the samples that are provided with IM Modeling:
DB2 CREATE DATABASE dbnameEnable the database for the use of IM Modeling:
idmenabledb dbname fenced dbcfg
For more information refer to:
db2 connect to dbnameThe sample applications for the Clustering mining function show how to work with the various functions to complete a Clustering task. The samples describe customer segmentation.
In this exercise, you create the sample table BANKCUSTOMERS and import the banking data. This table is used for the Clustering training run.
To create a table and import the sample data from file bankingScoring.data, run the sample script bankingImport.db2. Use the following command to run the sample script bankingImport.db2:
db2 -stf bankingImport.db2
In the first part of the script bankingImport.db2, the DB2 table BANKCUSTOMERS is created, its columns are specified, and data types are defined for each column.
UPDATE COMMAND OPTIONS USING C off; CREATE TABLE "BANKCUSTOMERS" ( "CLIENT_ID" CHAR(9) NOT NULL PRIMARY KEY, "AGE" REAL, "GENDER" CHAR(2), "MARITAL_STATUS" CHAR(12), "PROFESSION" CHAR(24), "NBR_YEARS_CLI" REAL, "SAVINGS_ACCOUNT" CHAR(3), "HAS_LIFE_INSURANCE" CHAR(3), "INT_CREDITCARD" CHAR(3), "ONLINE_ACCESS" CHAR(3), "JOINED_ACCOUNTS" CHAR(3), "BANKCARD" CHAR(3), "AVERAGE_BALANCE" DECIMAL(10,2), "NO_CRED_TRANS" REAL, "NO_DEBIT_TRANS" REAL ) NOT LOGGED INITIALLY;
In the second part of the script the flat file bankingScoring.data is imported and inserted into the new table.
IMPORT FROM bankcustomers.data OF DEL INSERT INTO "BANKCUSTOMERS" ( "CLIENT_ID", "AGE", "GENDER", "MARITAL_STATUS", "PROFESSION", "NBR_YEARS_CLI", "SAVINGS_ACCOUNT", "HAS_LIFE_INSURANCE", "INT_CREDITCARD", "ONLINE_ACCESS", "JOINED_ACCOUNTS", "BANKCARD", "AVERAGE_BALANCE", "NO_CRED_TRANS", "NO_DEBIT_TRANS");
In this exercise, the sample script bankingClusTrain.db2 shows how to define a task and start a training run for a Clustering model.
Use the following command to run the sample script bankingClusTrain.db2 to create a DM_ClusBldTask value and run the Clustering training:
db2 -stf bankingClusTrain.db2
The first part of the sample script shows how to define a task. It contains the INSERT statement to create a DM_ClusBldTask value to segment customers in table 'BANKCUSTOMERS'. The task is inserted into table IDMMX.CLUSTASKS with ID 'BankingSimpleTask':
INSERT INTO IDMMX."CLUSTASKS" ( "ID", "TASK")
WITH "MYDATA" ( "MYDATACOL" ) AS
(VALUES(IDMMX.DM_MiningData()..DM_defMiningData('BANKCUSTOMERS')))
SELECT 'BankingSimpleTask',
IDMMX.DM_ClusBldTask()..DM_defClusBldTask("MYDATACOL",
IDMMX.DM_ClusSettings()..
DM_useClusDataSpec("MYDATACOL"..DM_genDataSpec()))
FROM "MYDATA";
The second part contains a CALL statement to call a stored procedure for Clustering training that uses the DM_ClusBldTask value to build a Clustering model:
CALL IDMMX.DM_buildClusModelCmd('IDMMX.CLUSTASKS', 'TASK', 'ID',
'BankingSimpleTask',
'IDMMX.CLUSTERMODELS', 'MODEL',
'MODELNAME',
'BankCustomerSegments' );
In this exercise, the sample script bankingClusTrainResult.db2 extracts information from a Clustering model.
Use the following command to run the sample script bankingClusTrainResult.db2 to extract information from the Clustering model:
db2 -stf bankingClusTrainResult.db2
The first part of the sample script defines the SELECT statement to extract the following information from a Clustering model:
SELECT
SUBSTR(IDMMX.DM_getClusMdlName("MODEL"),1,20) AS "MODELNAME",
IDMMX.DM_getNumClusters("MODEL") as "NUMBER_CLUSTERS",
IDMMX.DM_getClusMdlSpec("MODEL")..DM_getNumFields()
AS "NUMBER_FIELDS",
CAST (IDMMX.DM_getMdlQuality("MODEL") AS DEC(5,2))
AS "MODEL_QUALITY"
FROM IDMMX."CLUSTERMODELS" WHERE "MODELNAME"='BankCustomerSegments';
The next part of the sample script shows the field importance in a Clustering model. The returned field names and types can also be used to determine the model signature for applying the model in IM Scoring.
SELECT
CAST ("FIELDNAME" AS CHAR(20)) AS "FIELDNAME",
CAST ("IMPORTANCE" AS DEC(5,2)) AS "IMPORTANCE",
CASE "MININGTYPE"
WHEN 0 THEN 'CATEGORICAL'
WHEN 1 THEN 'NUMERICAL'
END AS "MINING_FIELD_TYPE"
FROM TABLE (IDMMX.DM_getFields((
SELECT "MODEL" FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankCustomerSegments'))) AS "FIELDS"
ORDER BY "IMPORTANCE" DESC;
The following part shows the field correlations in the Clustering model:
SELECT
CAST ("FIELDNAME1" AS CHAR(20)) AS "FIELDNAME1",
CAST ("FIELDNAME2" AS CHAR(20)) AS "FIELDNAME2",
CAST ("CORRELATION" AS DEC(5,2)) AS "CORRELATION"
FROM TABLE (IDMMX.DM_getCorrelations((
SELECT "MODEL" FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankCustomerSegments'))) AS "FIELDS"
WHERE ABS(CORRELATION)> 0.1
ORDER BY ABS(CORRELATION) DESC;
The last part of the sample script shows the clusters in the Clustering model:
SELECT
"ID" AS "CLUSTERID",
CAST ("NAME" AS CHAR(20)) AS "CLUSTERNAME",
"SIZE",
CAST ("HOMOGENEITY" AS DEC(5,2)) AS "HOMOGENEITY"
FROM TABLE (IDMMX.DM_getClusters((
SELECT "MODEL" FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankCustomerSegments'))) AS "CLUSTERS"
ORDER BY SIZE DESC;
This sample application supports the following advanced examples for creating a task and building a model:
In this example, there is a strong correlation between the data, the settings, and the model.
In this example, the settings and the model contain no indication of what data was used.
This example enables you to create generic settings that you can use with different mining data.
In this exercise, the sample script defines the mining data. You can rename columns and define aliases.
Use the following command to run the sample script bankingCreateMiningData.db2 to create the DM_MiningData values and to insert them into the table IDMMX.MiningData:
db2 -stf bankingCreateMiningData.db2
The first part of the sample script bankingCreateMiningData.db2 creates a DM_MiningData value and inserts it into the table IDMMX.MiningData. The column name and type information is extracted from DB2 catalog tables:
INSERT INTO IDMMX."MININGDATA" VALUES (
'AliasEqualToColumn',
IDMMX.DM_MiningData()..DM_defMiningData('BANKCUSTOMERS'));
The next part of the sample script defines column aliases that differ from the column names in the input data source using method DM_setFldAlias.
INSERT INTO IDMMX."MININGDATA" VALUES (
'AliasDifferentToColumn',
IDMMX.DM_MiningData()..DM_defMiningData('BANKCUSTOMERS')
..DM_setFldAlias('CLIENT_ID','CUSTNO')
..DM_setFldAlias('PROFESSION','JOB')
..DM_setFldAlias('NBR_YEARS_CLI','LOYALTY'));
The next statement creates a view to use only a sample of customers as input data. This example defines a repeatable random sample of 10 percent. The sample must be repeatable to support multiple passes during model training:
CREATE VIEW "CUSTSAMPLE"
AS SELECT * FROM "BANKCUSTOMERS" TABLESAMPLE SYSTEM(10)
REPEATABLE(3);
INSERT INTO IDMMX."MININGDATA" VALUES (
'CustomerSample',
IDMMX.DM_MiningData()..DM_defMiningData('CUSTSAMPLE'));
The following statement uses a predicate (WHERE clause) to specify the list of input records:
INSERT INTO IDMMX."MININGDATA" VALUES (
'MarriedCustomers',
IDMMX.DM_MiningData()..DM_defMiningData('CUSTSAMPLE')
..DM_setWhereClause('MARITAL_STATUS=''married'''));
In this exercise, you create values of type DM_ClusSettings that include a value of type DM_LogicalDataSpec, and you insert them into the table IDMMX.ClusSettings.
The sample script contains INSERT statements to build a DM_ClusSettings value that consists of the following:
The field names in the DM_LogicalDataSpec values are different in each statement. The DM_LogicalDataSpec value is also constructed in different ways.
Use the following command to run the sample script bankingCreateSettings.db2 to create DM_ClusSettings values and insert them into the table IDMMX.ClusSettings:
db2 -stf bankingCreateSettings.db2
The sample script bankingCreateSettings.db2 contains the following INSERT statement to construct the DM_LogicalDataSpec value from the DM_MiningData value contained in the IDMMX.MININGDATA table. The field names in the DM_LogicalDataSpec value are the same as the column names in the BANKCUSTOMERS table. The field 'GENDER' is removed from the generated DM_LogicalDataSpec.
INSERT INTO IDMMX."CLUSSETTINGS"
SELECT
'BankingClusSettings',
IDMMX.DM_ClusSettings()..
DM_useClusDataSpec("MININGDATA"..DM_genDataSpec()..
DM_remDataSpecFld( 'GENDER' ) )..
DM_setMaxNumClus(9)..
DM_setFldUsageType( 'NO_DEBIT_TRANS', 2 )
FROM IDMMX."MININGDATA" where "ID"='AliasEqualToColumn';
The following INSERT statement constructs the DM_LogicalDataSpec value from the DM_MiningData value contained in the IDMMX.MININGDATA table. Some field names in the DM_LogicalDataSpec value are different from the column names in the BANKCUSTOMERS table.
The DM_LogicalDataSpec value contains as field names the alias names that were specified in the DM_MiningData value that was used. The use of alias names that are different from the column names amounts to a renaming of the columns, because the settings contain only the alias names. The model later contains both names, but it is possible to extract only alias names using the methods that are available.
INSERT INTO IDMMX."CLUSSETTINGS" SELECT
'BankingClusAliasSettings',
IDMMX.DM_ClusSettings()..
DM_useClusDataSpec("MININGDATA".. DM_genDataSpec()..
DM_remDataSpecFld( 'CUSTNO' ) )..
DM_setMaxNumClus(9)..
DM_setFldUsageType( 'JOB', 2 )
FROM IDMMX."MININGDATA" where "ID"='AliasDifferentToColumn';
The following INSERT statement constructs the DM_LogicalDataSpec value using the method DM_addDataSpecFld. Use this approach to build generic settings which can be combined with different DM_MiningData values when task values are constructed:
INSERT INTO IDMMX."CLUSSETTINGS" VALUES (
'BankingClusGenericSettings',
IDMMX.DM_ClusSettings()..
DM_useClusDataSpec( IDMMX.DM_LogicalDataSpec()..
DM_addDataSpecFld('AGEYEARS')..
DM_addDataSpecFld('MARITALSTATUS')..
DM_addDataSpecFld('LOYALTY')..
DM_addDataSpecFld('SAVINGSACCOUNT')..
DM_addDataSpecFld('AVERAGEBALANCE')..
DM_addDataSpecFld('JOB')..
DM_setFldType('AGEYEARS', 1 )..
DM_setFldType('MARITALSTATUS', 0 )..
DM_setFldType('LOYALTY', 1 )..
DM_setFldType('SAVINGSACCOUNT', 0 )..
DM_setFldType('AVERAGEBALANCE', 1 )..
DM_setFldType('JOB',0)
)..
DM_setMaxNumClus(9)..
DM_setFldUsageType( 'JOB', 2 ));
In this exercise, you create values of type DM_ClusBldTask and insert them into the table IDMMX.CLUSTASKS.
Use the following command to run the sample script bankingCreateTask.db2 to create DM_ClusBldTask values and to insert them into the table IDMMX.CLUSTASKS:
db2 -stf bankingCreateTask.db2
The following INSERT statements construct a DM_ClusBldTask value from a DM_MiningData value and a DM_ClusSettings value.
In the first part of the sample script bankingCreateTask.db2, the INSERT statement uses a DM_MiningData value that contains matching alias names and column names:
INSERT INTO IDMMX."CLUSTASKS" SELECT
'BankingClusTask',
IDMMX.DM_ClusBldTask()..
DM_defClusBldTask( D."MININGDATA", S."SETTINGS" )
FROM IDMMX."MININGDATA" D, IDMMX."CLUSSETTINGS" S
WHERE D."ID"='AliasEqualToColumn' AND
S."ID"='BankingClusSettings';
In the next part of the sample script, the INSERT statement uses a DM_MiningData value that contains different alias names and column names:
INSERT INTO IDMMX."CLUSTASKS" SELECT
'BankingClusAliasTask',
IDMMX.DM_ClusBldTask()..
DM_defClusBldTask( D."MININGDATA", S."SETTINGS" )
FROM IDMMX."MININGDATA" D, IDMMX."CLUSSETTINGS" S
WHERE D."ID"='AliasDifferentToColumn' AND
S."ID"='BankingClusAliasSettings';
In the following part of the sample script, the INSERT statement uses a DM_MiningData value that contains matching alias names and column names. The alias names are adapted to the field names contained in the DM_ClusSettings value using the method DM_setFldAlias.
This sample statement also specifies the usage of an error table and a progress table. Depending on the field names in the DM_ClusSettings value, different DM_MiningData values must be used to construct a DM_ClusBldTask value:
INSERT INTO IDMMX."CLUSTASKS" SELECT
'BankingClusGenericTask',
IDMMX.DM_ClusBldTask()..
DM_defClusBldTask( D."MININGDATA"..
DM_setFldAlias('AGE','AGEYEARS')..
DM_setFldAlias('MARITAL_STATUS','MARITALSTATUS')..
DM_setFldAlias('NBR_YEARS_CLI','LOYALTY')..
DM_setFldAlias('SAVINGS_ACCOUNT','SAVINGSACCOUNT')..
DM_setFldAlias('AVERAGE_BALANCE','AVERAGEBALANCE')..
DM_setFldAlias('PROFESSION','JOB'),
S."SETTINGS" )..
DM_setErrorTab('IDMMX.ERRORTABLE')..
DM_setProgTab('IDMMX.PROGRESSTABLE')
FROM IDMMX."MININGDATA" D, IDMMX."CLUSSETTINGS" S
WHERE D."ID"='AliasEqualToColumn' AND
S."ID"='BankingClusGenericSettings';
This exercise shows how to call stored procedures to run the Clustering mining training.
Use the following command to run the sample script bankingRunTask.db2 to start Clustering mining training runs:
db2 -stf bankingRunTask.db2
The sample script bankingRunTask.db2 calls the stored procedure DM_buildClusModelCmd to execute the Clustering training run and writes the model into the IDMMX.CLUSTERMODELS table. In this sample script the name of the model is 'BankingClusAliasModel'. The model that is produced contains field names that are different from the column names in the BANKCUSTOMERS table:
CALL IDMMX.DM_buildClusModelCmd('IDMMX.CLUSTASKS', 'TASK', 'ID',
'BankingClusAliasTask',
'IDMMX.CLUSTERMODELS', 'MODEL', 'MODELNAME',
'BankingClusAliasModel' );
SELECT
CAST ("FIELDNAME" AS CHAR(20)) AS "FIELDNAME",
CASE "MININGTYPE"
WHEN 0 THEN 'CATEGORICAL'
WHEN 1 THEN 'NUMERICAL'
END AS "MINING_FIELD_TYPE"
FROM TABLE (IDMMX.DM_getFields((
SELECT "MODEL" FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankingClusAliasModel'))) AS "FIELDS";In the following part of the sample script the stored procedure call of DM_buildClusModelCmd executes a clustering training run and writes the model into the table IDMMX.CLUSTERMODELS. The name of the model is BankingClusGenericModel. The model that is produced contains field names that are different from the column names in the BANKCUSTOMERS table.
CALL IDMMX.DM_buildClusModelCmd('IDMMX.CLUSTASKS', 'TASK', 'ID',
'BankingClusGenericTask',
'IDMMX.CLUSTERMODELS', 'MODEL', 'MODELNAME',
'BankingClusGenericModel' );
SELECT
CAST ("FIELDNAME" AS CHAR(20)) AS "FIELDNAME",
CASE "MININGTYPE"
WHEN 0 THEN 'CATEGORICAL'
WHEN 1 THEN 'NUMERICAL'
END AS "MINING_FIELD_TYPE"
FROM TABLE (IDMMX.DM_getFields((
SELECT "MODEL" FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankingClusGenericModel'))) AS "FIELDS";
In this exercise, you delete entries from the sample tables that were created when running the samples. This is required if you want to run the Clustering samples again.
Use the following command to run the sample script bankingDelete.db2 to delete the entries that were inserted in the tables:
db2 -tf bankingDelete.db2
The following sections describe the sample application for using the Classification mining function. The sample is a life sciences example predicting a patient's heart disease based on other information about the patient. The patient information is stored in table HEART and the predicted column's name is DISEASED.
In this exercise, you create the sample table HEART, which contains the sample data.
Use the following command to run the sample script heartImport.db2 to create the sample table HEART:
db2 -stf heartImport.db2
The following part of the sample script heartImport.db2 creates the sample table HEART, which contains the sample data.
CREATE TABLE "HEART" (
"AGE" DOUBLE,
"SEX" VARCHAR(3),
"PAIN_TYPE" VARCHAR(3),
"BLOOD_PRESSURE" DOUBLE,
"CHOLESTEROL" DOUBLE,
"SUGAR" VARCHAR(3),
"ECG" VARCHAR(3),
"HEART_RATE" DOUBLE,
"ANGINA" VARCHAR(3),
"OLD_PEAK" DOUBLE,
"SLOPE" VARCHAR(3),
"NUM_VESSELS" VARCHAR(3),
"THAL" VARCHAR(3),
"DISEASED" CHAR(1)
);
The next part of the sample script imports data from heart disease cases contained in the sample file heart.data into the HEART table.
IMPORT FROM heart.data OF DEL INSERT INTO "HEART" (
"AGE" ,
"SEX" ,
"PAIN_TYPE" ,
"BLOOD_PRESSURE" ,
"CHOLESTEROL" ,
"SUGAR" ,
"ECG" ,
"HEART_RATE" ,
"ANGINA" ,
"OLD_PEAK" ,
"SLOPE" ,
"NUM_VESSELS" ,
"THAL" ,
"DISEASED"
);
In this exercise, you create a value of type DM_ClasBldTask, and 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' );
In this exercise, you can extract information from a Classification model.
Use the following command to run the sample script heartClasTrainResult.db2 to extract information from the Classification model:
db2 -stf heartClasTrainResult.db2
The first part of the sample script heartClasTrainResult.db2 contains definitions to show the field correlations in a Classification model:
SELECT
CAST ("FIELDNAME1" AS CHAR(20)) AS "FIELDNAME1",
CAST ("FIELDNAME2" AS CHAR(20)) AS "FIELDNAME2",
CAST ("CORRELATION" AS DEC(5,2)) AS "CORRELATION"
FROM TABLE (IDMMX.DM_getCorrelations((
SELECT "MODEL" FROM IDMMX."CLASSIFMODELS"
WHERE "MODELNAME"='HeartClasModel'))) AS "FIELDS"
ORDER BY ABS(CORRELATION) DESC;
The next part of the sample script contains definitions to show the field importance in a Classification model:
SELECT
CAST ("FIELDNAME" AS CHAR(20)) AS "FIELDNAME",
CAST ("IMPORTANCE" AS DEC(5,2)) AS "IMPORTANCE",
CASE "MININGTYPE"
WHEN 0 THEN 'CATEGORICAL'
WHEN 1 THEN 'NUMERICAL'
END AS "MINING_FIELD_TYPE"
FROM TABLE (IDMMX.DM_getFields((
SELECT "MODEL" FROM IDMMX."CLASSIFMODELS"
WHERE "MODELNAME"='HeartClasModel'))) AS "FIELDS"
ORDER BY "IMPORTANCE" DESC;
The last part of the sample script contains definitions to show the tree decision rules in a Classification model for target field DISEASED:
SELECT
CAST ("CLASS" AS CHAR(5)) AS "PREDICT",
'IF' AS "IF",
CAST ("CONDITION" AS CHAR(50)) AS "CONDITION",
CAST ("SIZE" AS SMALLINT) AS "SIZE",
CAST ("CONFIDENCE" AS DEC(5,2)) AS "CONF"
FROM TABLE (IDMMX.DM_getTreeRules((
SELECT "MODEL" FROM IDMMX."CLASSIFMODELS"
WHERE "MODELNAME"='HeartClasModel'))) AS "RULES"
WHERE "ISLEAF" = 1
ORDER BY "CONDITION" DESC;
Here is the sample output for the DM_getTreeRules statement. The rules are shown in the Classification model for the target field 'DISEASED'.
PREDICT IF CONDITION SIZE CONF ------- -- -------------------------------------------------- ------ ------- 1 IF THAL = 3 AND NUM_VESSELS = 0 91 0.91 2 IF THAL = 3 AND NUM_VESSELS <> 0 AND PAIN_TYPE = 4 18 0.83 1 IF THAL = 3 AND NUM_VESSELS <> 0 AND PAIN_TYPE <> 4 25 0.84 2 IF THAL <> 3 AND NUM_VESSELS = 0 AND ANGINA = 1 23 0.78 1 IF THAL <> 3 AND NUM_VESSELS = 0 AND ANGINA <> 1 26 0.73 2 IF THAL <> 3 AND NUM_VESSELS <> 0 57 0.89 6 record(s) selected.
In this exercise, you create a value of type DM_ClasTestTask and start a Classification test run.
Use the following command to run the sample script heartClasTest.db2 to create a DM_ClasTestTask value and start a classification test run:
db2 -stf heartClasTest.db2
The first part of the sample script heartClasTest.db2 builds a value of DM_CLASTESTTASK and inserts it into the table IDMMX.CLASTESTTASKS with ID HeartClasTestTask.
INSERT INTO IDMMX."CLASTESTTASKS" ("ID", "TASK")
WITH "MYDATA" ("MYDATACOL") AS
(VALUES(IDMMX.DM_MiningData()..DM_defMiningData('HEART')))
SELECT 'HeartClasTestTask',
IDMMX.DM_ClasTestTask()..DM_defClasTestTask(
"MYDATACOL", 'IDMMX.CLASSIFMODELS', 'MODEL', 'MODELNAME',
'HeartClasModel' )
FROM "MYDATA";
The next part of the sample script calls the Classification test stored procedure DM_testClasModelCmdT that uses the DM_CLASTESTTASK value to test a Classification model.
CALL IDMMX.DM_testClasModelCmdT('IDMMX.CLASTESTTASKS', 'TASK', 'ID',
'HeartClasTestTask',
'IDMMX.CLASTESTRESULTS', 'RESULT', 'ID',
'HeartClasTestResult' );
In this exercise, you extract information from the created Classification test result.
Use the following command to run the sample script heartClasTestResult.db2 to extract information from the created Classification test result:
db2 -stf heartClasTestResult.db2
The first part of the sample script heartClasTestResult.db2 contains a SELECT statement that reads the Classification error and model quality indicators from the result of a Classification test run:
SELECT
CAST (IDMMX.DM_getClasError("RESULT") AS DEC(5,2))
AS "CLASSIFICATION_ERROR",'%' AS "%",
CAST (IDMMX.DM_getMdlQuality("RESULT") AS DEC(5,2))
AS "MODEL_QUALITY",
CAST (IDMMX.DM_getReliability("RESULT") AS DEC(5,2))
AS "RELIABILITY",
CAST (IDMMX.DM_getRankQuality("RESULT",'2') AS DEC(5,2))
AS "RANK_QUALITY",
CAST (IDMMX.DM_getPredAccuracy("RESULT",'2') AS DEC(5,2))
AS "PRED_ACCURACY"
FROM IDMMX."CLASTESTRESULTS"
WHERE "ID"='HeartClasTestResult';The next part of the sample script contains a SELECT statement that reads the confusion matrix from the result of a Classification test run. Classifications are divided into actual and predicted values.
SELECT CAST ("ACTUAL" AS CHAR(15)) AS "ACTUAL_VALUE",
CAST ("PREDICTED" AS CHAR(15)) AS "PREDICTED_VALUE",
"COUNT" AS "NUM_CASES",
"COST" AS "COST_OF_WRONG_PREDICTION"
FROM TABLE (IDMMX.DM_getConfMatrix(
(SELECT "RESULT" FROM IDMMX."CLASTESTRESULTS"
WHERE ID='HeartClasTestResult'))
) AS "MATRIX"
ORDER BY "ACTUAL", "PREDICTED";
The following part of the sample script contains a SELECT statement that reads the gains chart information from the result of a Classification test run:
SELECT CAST ("ROWCOUNT" AS SMALLINT) AS "NUMROWS_IN_SUBSET",
CAST ("SUMACTUAL" AS SMALLINT) AS "NUMROWS_DISEASED_IS_2",
CAST ("THRESHOLD" AS DEC(5,2))
AS "SMALLEST_CONFIDENCE_IN_SUBSET"
FROM TABLE (IDMMX.DM_getGainsChart(
(SELECT "RESULT" FROM IDMMX."CLASTESTRESULTS"
WHERE ID='HeartClasTestResult'),'2')
) AS "MATRIX"
ORDER BY "NUMROWS_IN_SUBSET";
In this exercise, you delete entries from the sample tables that were created when running the samples. This is required if you want to run the Classification samples again.
Use the following command to run the sample script heartDelete.db2 to delete the entries that were inserted in the tables:
db2 -tf heartDelete.db2
The following sections describe the sample application for using the Regression mining function. The samples describe how to predict the number of claims of insurance customers based on those customer's characteristics. The customer records are stored in table INSURANCE and the column to be predicted is NUM_CLAIMS.
In this exercise, you create the sample table INSURANCE, which contains the sample data.
Use the following command to run the sample script insurImport.db2 to create the sample table INSURANCE:
db2 -stf insurImport.db2
The following part of the sample script insurImport.db2 creates the sample table INSURANCE, which contains the sample data.
CREATE TABLE "INSURANCE" ( "SALARY" FLOAT, "RENEWAL_MONTH" VARCHAR(3), "SEX" CHAR(1), "MARITAL_STATUS" CHAR(1), "NUM_DEPENDENTS" INTEGER, "YEAR_1ST_POLICY" INTEGER, "NUM_CLAIMS" INTEGER, "CYCLES" INTEGER, "AGE" FLOAT, "COMMUTE_DIST" FLOAT, "RECORDID" INTEGER NOT NULL PRIMARY KEY );
The next part of the sample script imports data from insurance claims contained in the sample file insurance.data into the INSURANCE table.
IMPORT FROM insurance.data OF DEL INSERT INTO "INSURANCE" ( "SALARY", "RENEWAL_MONTH", "SEX", "MARITAL_STATUS", "NUM_DEPENDENTS", "YEAR_1ST_POLICY", "NUM_CLAIMS", "CYCLES", "AGE", "COMMUTE_DIST", "RECORDID" );
In this exercise, you create a value of type DM_REGBLDTASK, and insert it into the table IDMMX.REGTASKS.
Use the following command to run the sample script insurRegTrain.db2 to create a DM_REGBLDTASK value and start a Regression training run:
db2 -stf insurRegTrain.db2
The following part of the sample script insurRegTrain.db2 contains an INSERT statement that builds a DM_REGBLDTASK to predict the numeric column NUM_CLAIMS in table INSURANCE. The task is inserted into table IDMMX.REGTASKS with ID InsuranceTask:
INSERT INTO IDMMX."REGTASKS" ("ID", "TASK")
WITH "MYDATA" ("MYDATACOL") AS
(VALUES(IDMMX.DM_MiningData()..DM_defMiningData('INSURANCE')))
SELECT 'InsuranceTask',
IDMMX.DM_RegBldTask()..DM_defRegBldTask(
"MYDATACOL", cast( NULL as IDMMX.DM_MiningData),
IDMMX.DM_RegSettings()..DM_useRegDataSpec("MYDATACOL"
..DM_genDataSpec())
..DM_setRegTarget('NUM_CLAIMS'))
FROM "MYDATA";
The next part of the sample script calls the Regression training stored procedure DM_buildRegModelCmd that uses the DM_REGBLDTASK value to build a Regression model:
CALL IDMMX.DM_buildRegModelCmd('IDMMX.REGTASKS', 'TASK', 'ID',
'InsuranceTask',
'IDMMX.REGRESSIONMODELS', 'MODEL', 'MODELNAME',
'InsuranceModel' );
In this exercise, you can extract information from a Regression model.
Use the following command to run the sample script insurRegTrainResult.db2 to extract information from the Regression model:
db2 -stf insurRegTrainResult.db2
The first part of the sample script insurRegTrainResult.db2 contains definitions to show field correlations in a Regression model:
SELECT
CAST ("FIELDNAME1" AS CHAR(20)) AS "FIELDNAME1",
CAST ("FIELDNAME2" AS CHAR(20)) AS "FIELDNAME2",
CAST ("CORRELATION" AS DEC(5,2)) AS "CORRELATION"
FROM TABLE (IDMMX.DM_getCorrelations((
SELECT "MODEL" FROM IDMMX."REGRESSIONMODELS"
WHERE "MODELNAME"='InsuranceModel')))
AS "FIELDS"
ORDER BY ABS("CORRELATION") DESC;
The next part of the sample script contains definitions to show field importance in a Regression model:
SELECT
CAST ("FIELDNAME" AS CHAR(20)) AS "FIELDNAME",
CAST ("IMPORTANCE" AS DEC(5,2)) AS "IMPORTANCE",
CASE "MININGTYPE"
WHEN 0 THEN 'CATEGORICAL'
WHEN 1 THEN 'NUMERICAL'
END AS "MINING_FIELD_TYPE"
FROM TABLE (IDMMX.DM_getFields((
SELECT "MODEL" FROM IDMMX."REGRESSIONMODELS"
WHERE "MODELNAME"='InsuranceModel')))
AS "FIELDS"
ORDER BY "IMPORTANCE" DESC;
In this exercise, you create a value of type DM_RegTestTask and start a Regression test run.
Use the following command to run the sample script insurRegTest.db2 to create a DM_RegTestTask value and start a Regression test run:
db2 -stf insurRegTest.db2
The first part of the sample script insurRegTest.db2 contains an INSERT statement to build a value of DM_REGTESTTASK and to insert it into the IDMMX.REGTESTTASKS table with ID 'InsuranceTestTask'.
INSERT INTO IDMMX."REGTESTTASKS" ("ID", "TASK")
WITH "MYDATA" ("MYDATACOL") AS
(VALUES(IDMMX.DM_MiningData()..DM_defMiningData('INSURANCE')))
SELECT 'InsuranceTestTask',
IDMMX.DM_RegTestTask()..DM_defRegTestTask(
"MYDATACOL",'IDMMX.REGRESSIONMODELS','MODEL','MODELNAME',
'InsuranceModel')
FROM "MYDATA";
The next part of the sample script calls the Regression test stored procedure DM_testRegModelCmdT that uses the DM_REGTESTTASK value to test a Regression model:
CALL IDMMX.DM_testRegModelCmdT('IDMMX.REGTESTTASKS', 'TASK', 'ID',
'InsuranceTestTask',
'IDMMX.REGTESTRESULTS', 'RESULT', 'ID',
'InsuranceTestResult' );
In this exercise, you extract information from the created Regression test result.
Use the following command to run the sample script insurRegTestResult.db2 to extract information from the created Regression test result:
db2 -stf insurRegTestResult.db2
The first part of the sample script defines a SELECT statement that reads the root mean squared error and model quality indicators from the result of a Regression test run:
SELECT CAST (IDMMX.DM_getRMSE("RESULT") AS DEC(5,2))
AS "ROOT_MEAN_SQUARE_ERROR",
CAST (IDMMX.DM_getMdlQuality("RESULT")
AS DEC(5,2)) AS "MODEL_QUALITY",
CAST (IDMMX.DM_getReliability("RESULT")
AS DEC(5,2)) AS "RELIABILITY",
CAST (IDMMX.DM_getRankQuality("RESULT")
AS DEC(5,2)) AS "RANK_QUALITY",
CAST (IDMMX.DM_getPredAccuracy("RESULT")
AS DEC(5,2)) AS "PRED_ACCURACY"
FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult';
The next part of the sample script defines a SELECT statement that reads the gains chart information from the result of a Regression test run:
SELECT CAST ("ROWCOUNT" AS SMALLINT) AS "NUMROWS_IN_SUBSET",
CAST ("SUMACTUAL" AS SMALLINT)
AS "SUM_OF_ACTUAL_TARGET_VALUES",
CAST ("THRESHOLD" AS DEC(5,2))
AS "SMALLEST_PRED_VALUE_IN_SUBSET"
FROM TABLE (IDMMX.DM_getGainsChart(
(SELECT "RESULT" FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult'))
) AS "MATRIX"
ORDER BY "NUMROWS_IN_SUBSET";
In this exercise, you delete entries from the sample tables that were created when running the samples. This is required if you want to run the regression samples again.
Use the following command to run the sample script insurDelete.db2 to delete the entries that were inserted in the sample tables:
db2 -tf insurDelete.db2
The following sections describe the sample application for using the Associations mining function. The samples show how to analyze market baskets in retail. A market basket is the list of items that a customer bought in one transaction. The sample finds rules that explain which products are bought together. The table RETAIL contains lists of transactions and table RETAIL_NAMES maps item numbers to human readable names.
In this exercise, you create the sample tables RETAIL and RETAIL_NAMES, which contain the sample data.
Use the following command to run the sample script retailImport.db2 to create the sample tables RETAIL and RETAIL_NAMES:
db2 -stf retailImport.db2
The following part of the sample script retailImport.db2 creates the sample table RETAIL, which contains the sample data.
CREATE TABLE "RETAIL" ( "CUSTOMER_ID" CHAR(7), "TRANSDATE" CHAR(6), "ITEMID" CHAR(3), "STOREID" CHAR(3), "TRANSID" CHAR(5) );
The next part of the sample script imports retail data contained in the sample file retail.data into the RETAIL table.
IMPORT FROM retail.data OF DEL INSERT INTO
"RETAIL"( "CUSTOMER_ID",
"TRANSDATE",
"ITEMID",
"STOREID",
"TRANSID");
The following part of the sample script creates the sample table RETAIL_NAMES, which contains the sample data.
CREATE TABLE "RETAIL_NAMES" ( "ITEMID" CHAR(3), "DESCRIPTION" CHAR(18) );
The next part of the sample script imports the data of retail names contained in the sample file retail_names.data into the RETAIL_NAMES table.
IMPORT FROM retail_names.data OF DEL INSERT INTO
"RETAIL_NAMES"( "ITEMID",
"DESCRIPTION");
This exercise shows how to find articles in market baskets:
Use the following command to run the sample script retailRuleTrain.db2 to create a DM_RuleBldTask value and start an Associations training run:
db2 -stf retailRuleTrain.db2
The first part of the sample script retailRuleTrain.db2 contains an INSERT statement that builds a value of DM_RULEBLDTASK and inserts it into the IDMMX.RULETASKS table with ID RetailRuleTask.
INSERT INTO IDMMX."RULETASKS" ("ID", "TASK")
WITH "MYDATA" ("MYMININGDATA") AS (
VALUES(IDMMX.DM_MiningData()
..DM_defMiningData('RETAIL')
))
SELECT 'RetailRuleTask',
IDMMX.DM_RuleBldTask()..
DM_defRuleBldTask(
"MYMININGDATA",
IDMMX.DM_RuleSettings()
..DM_useRuleDataSpec(MyMiningData..DM_genDataSpec()
..DM_addNmp('DescriptionForITEMID','RETAIL_NAMES',
'ITEMID','DESCRIPTION')
..DM_setFldNmp('ITEMID','DescriptionForITEMID'))
-- ..DM_setItemFormat(1)
..DM_setItemFld('ITEMID')
..DM_setGroup('TRANSID')
..DM_setMinSupport(2.7)
-- ..DM_setMaxLen(2)
-- ..DM_setMinConf(50.0)
-- ..DM_setConType(0)
-- ..DM_addConItem('Crackers')
)
FROM "MYDATA";
The next statement in the sample script calls the Associations training stored procedure DM_buildRuleModelCmd that uses the DM_RULEBLDTASK value to build an Associations model; the model is inserted into the IDMMX.RULEMODELS table with MODELNAME RetailRuleModel:
CALL IDMMX.DM_buildRuleModelCmd('IDMMX.RULETASKS', 'TASK', 'ID',
'RetailRuleTask',
'IDMMX.RULEMODELS', 'MODEL',
'MODELNAME',
'RetailRuleModel' );
In this exercise, you can extract information from an Associations model.
Use the following command to run the sample script retailRuleTrainResult.db2 to extract rules from the Associations model:
db2 -stf retailRuleTrainResult.db2
The first part of the sample script retailRuleTrainResult.db2 contains definitions to show the number of rules and number of transactions in a model:
SELECT SUBSTR(IDMMX.DM_getRuleMdlName("MODEL"),1,30) AS "MODELNAME",
IDMMX.DM_getNumRules("MODEL") AS "NUMRULES",
IDMMX.DM_getNumTransacts("MODEL") as "NUMTRANSACTIONS"
FROM IDMMX."RULEMODELS" WHERE "MODELNAME"='RetailRuleModel';
The next part of the sample script lists the Associations rules in a model:
SELECT SUBSTR("BODYTEXT",1,38) AS "BODY", '==>' AS "==>",
SUBSTR("HEADNAME",1,18) AS "HEAD",
CAST ("SUPPORT" AS DEC(5,2)) AS "SUPPORT",
CAST ("CONFIDENCE" AS DEC(5,2)) AS "CONF"
FROM TABLE (IDMMX.DM_getRules((SELECT "MODEL" FROM IDMMX."RULEMODELS"
where "MODELNAME"='RetailRuleModel'))) AS "T1"
ORDER BY "SUPPORT" DESC, "CONF" DESC
;
The following part of the sample script copies rules from the model into the tables RETAILRULES and RETAILRULEBODIES to allow for real-time cross-selling recommendations in the queries below:
CREATE TABLE "RETAILRULES" ( "ID" INTEGER,
"HEADNAME" VARCHAR(1024),
"HEAD" VARCHAR(1024),
"BODYID" INTEGER,
"LENGTH" SMALLINT,
"BODYTEXT" LONG VARCHAR,
"SUPPORT" REAL,
"CONFIDENCE" REAL,
"LIFT" REAL ) NOT LOGGED INITIALLY;
ALTER TABLE "RETAILRULES" ACTIVATE NOT LOGGED INITIALLY;
INSERT INTO "RETAILRULES" ( "ID","HEADNAME","HEAD","BODYID","LENGTH",
"BODYTEXT","SUPPORT","CONFIDENCE","LIFT")
SELECT "ID","HEADNAME","HEAD","BODYID","LENGTH","BODYTEXT",
"SUPPORT","CONFIDENCE","LIFT"
FROM TABLE (IDMMX.DM_getRules((SELECT "MODEL" FROM IDMMX."RULEMODELS"
where "MODELNAME"='RetailRuleModel'))) AS "T1";
CREATE TABLE "RETAILRULEBODIES" ( "BODYID" INTEGER,
"ITEMNAME" VARCHAR(1024),
"ITEM" VARCHAR(1024)) NOT LOGGED INITIALLY;
ALTER TABLE "RETAILRULEBODIES" ACTIVATE NOT LOGGED INITIALLY;
INSERT INTO "RETAILRULEBODIES" ("BODYID", "ITEMNAME", "ITEM")
SELECT "BODYID", "ITEMNAME", "ITEM"
FROM TABLE (IDMMX.DM_getRuleBodies((SELECT "MODEL" FROM IDMMX."RULEMODELS"
where "MODELNAME"='RetailRuleModel'))) AS "T1";The next statement contains the definitions for the query: "Which items might promote the sale of 'Crackers'?" It finds all items in rule bodies with rule head="Crackers":
SELECT DISTINCT SUBSTR("ITEMNAME",1,18) AS "ITEMNAME"
FROM "RETAILRULES" T1, "RETAILRULEBODIES" T2
WHERE T1."BODYID"=T2."BODYID" and "HEADNAME"='Crackers';
The following statement contains the definitions for the query: "For which items should we increase the stock when 'Crackers' goes on sale?" It finds all head items of rules with 'Crackers' in their bodies:
SELECT DISTINCT SUBSTR("HEADNAME",1,18) AS "HEADNAME"
FROM "RETAILRULES" T1, "RETAILRULEBODIES" T2
WHERE T1."BODYID"=T2."BODYID" and "ITEMNAME"='Crackers';
In this exercise, you delete entries from the sample tables that were created when running the samples. This is required if you want to run the regression samples again.
Use the following command to run the sample script retailDelete.db2 to delete the entries that were inserted in the sample tables:
db2 -tf retailDelete.db2
The following sections describe the sample application for creating additional error and progress tables.
IM Modeling can write run-time errors and warnings to an error table. It creates the default error table IDMMX.ERRORTABLE.
To specify the error table that must be used during a mining run, use the method TASK..DM_setErrorTab, which is described in DM_setErrorTab.
To create an additional error table, change the table name, add a schema qualifier if required, or both in the sample script createErrorTable.db2. Additional columns can also be appended if required:
UPDATE COMMAND OPTIONS USING s OFF;
DROP TABLE "ERRORTABLE";
CREATE TABLE "ERRORTABLE" (
"CALLID" CHAR(19) FOR BIT DATA,
"RC" CHAR(1),
"SQLSTATE" CHAR(5),
"EXCID" INTEGER,
"PROCNAME" VARCHAR(100),
"COMPNAME" VARCHAR(100),
"TIMESTMP" TIMESTAMP,
"MESSAGE" VARCHAR(1000)
);
CREATE INDEX "ERRORTABLEINDEX" ON "ERRORTABLE" ("CALLID");
Use the following command to run the sample script createErrorTable.db2 to create an additional error table:
db2 -tf createErrorTable.db2
IM Modeling can write progress information to a progress table. It creates the default progress table IDMMX.PROGRESSTABLE.
To specify the progress table that must be used during a mining run, use the method TASK..DM_setProgTab, which is described in DM_setProgTab.
To create an additional progress table, change the table name, add a schema qualifier if required, or both in the sample script createProgressTable.db2. Additional columns can also be appended if required:
UPDATE COMMAND OPTIONS USING s OFF;
DROP TABLE "PROGRESSTABLE";
CREATE TABLE "PROGRESSTABLE"(
"CALLID" CHAR(19) FOR BIT DATA,
"PROCNAME" VARCHAR(100),
"KERNELPHASEID" INTEGER,
"KERNELPHASE" VARCHAR(500),
"KERNELINFO" CLOB(32K),
"ITERATIONNO" INTEGER,
"PROGRESS" REAL,
"QUALITYID" INTEGER,
"QUALITYMEASURE" VARCHAR(500),
"QUALITYVALUE" REAL,
"TIMESTMP" TIMESTAMP,
"MESSAGEID" INTEGER,
"MESSAGE" VARCHAR(1000),
"CANCELREQUEST" INTEGER
);
CREATE INDEX "PROGTABLEINDEX" ON "PROGRESSTABLE" ("CALLID",
"CANCELREQUEST");
Use the following command to run the sample script createProgressTable.db2 to create an additional progress table:
db2 -stf createProgressTable.db2
IM Modeling provides a set of UDTs, UDFs, UDMs, and stored procedures. Before you can use them from SQL statements, you must create them as database objects in the databases that you want to use with IM Modeling. For more information refer to Introducing database objects and data mining in SQL.
You can create the database objects by calling the idmenabledb command. You can also disable or check databases by calling the idmdisabledb command or the idmcheckdb command. These commands are located in the bin directory of your IM Modeling installation.
If you have IM Modeling and IM Scoring installed on a client machine, you can use the command idmcheckdb to check cataloged databases on remote servers.
To create the database objects that are necessary, you must enable the database for the use of IM Modeling. To enable the database, use the following IM Modeling command:
idmenabledb mydb
Where mydbpr is the name of the database that you want to enable.
The idmenabledb command gets the database name as input parameter. It connects to the database, and creates the UDTs, UDFs, and UDMs in the database in the schema IDMMX. To execute idmenabledb, you must have SYSADM or DBADM authority.
You must call the idmenabledb command for each database that you want to use with IM Modeling.
The idmenabledb command is shared between IM Modeling and IM Scoring. This means that you have to call it only once for each database if you have both products installed. The command detects automatically which products are installed. It also detects which UDTs, UDFs, and UDMs already exist in the database and which ones must be created.
If you call idmenabledb and the only parameter that you specify is the database name, then all the UDFs and UDMs are created in fenced mode. This means that they run in a process separate to the DB2 server process. All model UDTs are created for a maximum size of 10 MB. Additional options allow you to change these default values.
If you submit the unfenced option as a second argument to idmenabledb, all UDFs and UDMs are created as unfenced, and all model UDTs are generated for a maximum size of 50 MB. If you submit the dbcfg option as an additional argument, the database configuration is changed as recommended for Intelligent Miner.
For more information refer to The idmenabledb command.
The IM Modeling command idmdisabledb drops from the database all the IM Modeling UDTs, UDMs, UDFs, and stored procedures that were created. The command idmdisabledb is also in the bin directory of the IM Modeling installation. Call this command if you want to discontinue using a database with IM Modeling, or before you uninstall IM Modeling.
The idmdisabledb command gets the database name as its input parameter. It connects to the database and drops all the UDTs, UDFs, and UDMs that were created when the database and the schema IDMMX were enabled. To execute idmdisabledb, you must have SYSADM or DBADM authority.
You can only drop database objects if they do not depend on other database objects. For example, you might have created tables using IM Modeling UDTs as column types or you might have created triggers using some IM Modeling UDFs or UDMs. In this case, you must drop these database objects first before you call idmdisabledb. It might be the case that the only dependent database objects that you have are the tables created using idmenabledb. These tables are dropped if you call idmdisabledb with the tables option.
The idmdisabledb command is shared between IM Modeling and IM Scoring. This means that, if you have both products installed, you have to call the command only once for each database. If both products are installed, it is not possible to disable a database only for the use of one product. To disable the database at least one product must be installed.
For complete reference information about the idmdisabledb command, see The idmdisabledb command.
The IM Modeling command idmcheckdb enables you to check whether a database is enabled. The command idmcheckdb is located in the bin directory of the IM Modeling installation.
The idmcheckdb command gets the database name as input. It connects to the database and returns a message saying whether the database is already enabled for IM Modeling, IM Scoring, or both.
idmcheckdb mydb The database "mydb" is enabled for IM Modeling Version 8.2 and IM Scoring Version 8.2 in fenced mode.
To check a cataloged database on a remote system, use the idmcheckdb command and additionally specify the user ID and the password for the database on the remote system.
To display a list of the database objects that are available in the specified database, you can use the optional parameter Show detail.
For complete reference information about the idmcheckdb command, see The idmcheckdb command.
This chapter describes how to select and define the source data that provides the input that you use in building or testing your mining model. Your definition of input data holds the information that the training run needs. This includes the name of the source table, and information about the columns in the table.
Specifying mining data is the first step in the model-building process:
In this step you:
The data type DM_MiningData stores the metadata to access the physical data in source tables. These source tables can be either base tables or views. The metadata consists of the fully-qualified name of the source table, the column names, and the SQL data types of the source data.
In addition, DM_MiningData stores any other information necessary to make the physical data accessible for a subsequent training or test run. This other information might include alias names or, optionally, a WHERE clause to filter the data. The alias name maps a field name in the physical data to a field name in a logical data specification. An alias name and its corresponding field name in the logical data specification must be the same. The default arrangement is that the alias names are the same as the names in the physical data. Use alias names that are different from the names in the physical data only if a logical data specification with different names already exists.
To define source data, you define a DM_MiningData value. Call the user-defined method DM_defMiningData. This identifies the source table; you specify the fully-qualified name of the source table as input, such as:
IDMMX.DM_MiningData()..DM_defMiningData('MYSCHEMA.MYTABLE')
The column information is automatically retrieved. If the source table exists, information about all columns of the table is also stored in the mining data object. For more information refer to DM_defMiningData.
Use the table function DM_getFields to obtain a list of all fields defined in the DM_MiningData value, such as:
select t.* from table (IDMMX.DM_getFields(IDMMX.DM_MiningData()..
DM_defMiningData('MYSCHEMA.TABLE'))) t
If you want to filter the source data for your training run, you need to store a WHERE clause in your DM_MiningData value.
This chapter describes how to specify the logical definitions for the data that will be part of your training run. Each field in your physical data (defined at the beginning) must have a logical definition that enables it to be used in the training run. This logical definition is contained in the logical data specification. The logical data specification contains only some generic settings for the fields to be used. The specification does not hold any data from your source tables, and the specification is also largely independent of the data mining function that you are using.
Defining the logical data specification is the next step in the model-building process:
In this step, you create values of the data type DM_LogicalDataSpec, perform operations on them, or both.
For more information refer to Introducing database objects and data mining in SQL.
For a full list of the methods that you can use in connection with DM_LogicalDataSpec, see Logical data specification methods.
The easiest way to define the logical data specification is to let IM Modeling do it for you from the input data definition that you created at the beginning. However, you can also create or modify the logical data specification manually if you want. You might do this in order to create generic data mining settings. Generic field definitions and settings are independent of physical data. This means that you can use them without change for different source tables with different layouts but with similar content. An example of this is where different sources might be suitable for doing customer segmentation using the Clustering mining function.
The DM_LogicalDataSpec data type defines the input fields used by training runs. An input field is defined by a name and a type. The type defines how a mining algorithm handles that field. Possible types are DM_Categorical or DM_Numerical, which map by default to certain DB2 source data types (for details, see Mining field types). Optionally, you can specify further field-related information in a logical data specification as follows:
For more information refer to:
The recommended way to define a logical data specification is to derive it from a mining data value.
Define an initial logical data specification by calling the method DM_genDataSpec acting on a DM_MiningData value. This provides you with a completely defined logical data specification. The specification contains the required definitions, such as field name and field type. The field type is automatically derived from the corresponding column type in the DM_MiningData value.
IDMMX.DM_MiningData()..DM_defMiningData('MYSCHEMA.MYTABLE')
..DM_genDataSpec()
You can also construct an initial DM_LogicalDataSpec value by using the methods DM_addDataSpecFld and DM_setFldType. Construct the value this way if you want a generic logical data specification that is independent from a physical source table or if you want to define certain field types manually as numerical or categorical. If you do this, you have to ensure that the alias names in the DM_MiningData value that will be associated with this logical data specification match the field names in the DM_LogicalDataSpec value. If you do not call the method DM_setFldType for a given field, the type of this field defaults to DM_Categorical.
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_setFldType('COL1',1)..DM_addDataSpecFld('COL2')
..DM_setFldType('COL2',1)
You can set optional field-related information for each field individually in the logical data specification. A field is identified by its name. If you want, you can iterate over all of the fields to specify field-related information. To do this, use the position of the fields.
Use the method DM_getNumFields to get the number of fields. Use the DM_getFldName method to get the name of the field name at a given position. Field positions range from 1 to the number of fields in the logical data specification. For details on specifying optional field-related information, see Dealing with issues specific to mining functions.
This section provides instructions on how to perform the tasks associated with name mappings. A name mapping maps a field value in the physical data to another name. For an introductory description, see Name mappings.
Use the method DM_addNmp to define a name mapping. The parameters are the name of the name mapping, the name of a table, and the names of two columns. One column contains the field values, and the other contains the corresponding mapped names. The SQL data type of the column containing the field values must be the same as that of the corresponding column in your mining data table. The SQL data type of the column containing the mapped names must be categorical.
You can define more than one name mapping.
IDMMX.DM_LogicalDataSpec()..DM_addNmp('MyNmp',
'MYSCHEMA.MYNMPTABLE', 'VALUECOL', MAPPEDVALUECOL')
After you have defined a name mapping, it will not be active until you link it to a mining field in the logical data specification. Use the method DM_setFldNmp to make a name mapping active. Only categorical fields can be linked to name mappings. If you want to define a name mapping for a field having numerical values, you must explicitly force the type of this field to categorical.
The method DM_getFldNmp enables you to check what name mapping is linked to a mining field.
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_addNmp('MyNmp', 'MYSCHEMA.MYNMPTABLE', 'VALUECOL',
'MAPPEDVALUECOL')..DM_setFldNmp('COL1', 'MyNmp')
Use the method DM_getNumNmp to retrieve the number of name mappings that are defined in a DM_LogicalDataSpec value.
Use the method DM_getNmpName to retrieve the name of a name mapping. This method requires a number that ranges from 1 to the total number of name mappings.
To obtain the table name, the column name of the field values, and the column name of the mapped names, use the methods DM_getNmpTabName, DM_getNmpValCol, and DM_getNmpMapValCol respectively. These methods take the name of the name mapping as parameter.
Use the method DM_remNmp to remove a name mapping, which takes the name of the name mapping as its parameter.
A taxonomy is a set of relationships between items and categories. For a full introduction to taxonomies, see Taxonomies.
An introduction is provided in Taxonomies.
Use the method DM_addTax. This method takes the following parameters:
The first category map must contain the relations between the items and the categories on hierarchy level 1. Note that the name mapping specified with the category map only acts on the categories. You must specify the name mapping for the items with the item field; for details, see Defining name mappings.
You can define more than one taxonomy in a logical data specification.
IDMMX.DM_LogicalDataSpec()..DM_addTax('MyTax', 'MYSCHEMA.MYTAXTABLE',
'ITEMCOL', 'CATMAPCOL_1', cast(NULL as VARCHAR), 0)IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')..DM_addNmp
('ItemNmp','MYSCHEMA.MYNMPTABLE', 'ITEMCOL','MAPPEDITEMCOL')
..DM_addNmp('CatMapNmp','MYSCHEMA.MYNMPTABLE','VALUECOL',
'MAPPEDVALUECOL')..DM_setFldNmp('COL1', 'ItemNmp')..DM_addTax
('MyTax', 'MYSCHEMA.MYTAXTABLE', 'ITEMCOL', 'CATMAPCOL_1',
'CatMapNmp', 0)An introduction is provided in Category maps.
To add a category map use the method DM_addTaxMap, which takes the same parameters as the method DM_addTax. The order of the added category maps determines the order in which the category maps are put together in building up the hierarchy. The first category map contains the relations starting from the lowest hierarchy level, that is, the level defined by the items.
Use the method DM_remTaxMap to remove a category map.
An introduction is provided in Taxonomies.
You must link the taxonomy to the mining field that will be used as the item field. To do this, use the method DM_setFldTax. The method DM_getFldTax enables you to check what taxonomy is active for a mining field. Only categorical fields can be linked to a taxonomy. If you remove a taxonomy by using the method DM_remTax, you also remove the link from the taxonomy to the mining field.
Examples:
Assume that you have the following tables:
This table contains items (in the column ITEMCOL) and categories (in the column CATMAPCOL_1)
This table contains:
The contents of the tables are as follows:
| ITEMCOL | CATMAPCOL_1 |
|---|---|
| 138 | 160 |
| 139 | 160 |
| 140 | 161 |
| 141 | 161 |
| ITEMCOL | MAPPEDITEMCOL | VALUECOL | MAPPEDVALUECOL |
|---|---|---|---|
| 138 | Beer | 160 | Alcoholic drink |
| 139 | Wine | 161 | Non-alcoholic drink |
| 140 | Mineral water | ||
| 141 | Coke |
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_addTax('MyTax', 'MYSCHEMA.MYTAXTABLE', 'ITEMCOL',
'CATMAPCOL_1', cast(NULL as VARCHAR), 0)
..DM_setFldTax('COL1','MyTax')
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_addNmp('ItemNmp', 'MYSCHEMA.MYNMPTABLE', 'ITEMCOL',
'MAPPEDITEMCOL')..DM_addNmp('CatMapNmp',
'MYSCHEMA.MYNMPTABLE', 'VALUECOL','MAPPEDVALUECOL')
..DM_setFldNmp('COL1', 'ItemNmp')..DM_addTax('MyTax',
'MYSCHEMA.MYTAXTABLE', 'ITEMCOL', 'CATMAPCOL_1',
'CatMapNmp', 0)..DM_setFldTax('COL1','MyTax')
An introduction is provided in Taxonomies.
Use the method DM_getNumTax to retrieve the number of taxonomies that have been defined.
Use the method DM_getTaxName to retrieve the name of a taxonomy. This method requires a number that ranges from 1 to the total number of taxonomies that have been defined. After you know the name of a taxonomy, you can retrieve information about the different category maps in the taxonomy.
To retrieve information about category maps:
Each method gets the taxonomy name and the position of the category map as input, and returns the appropriate output value. The position of a category map ranges from 1 to the total number of category maps that are defined in the taxonomy.
To remove a taxonomy use the method DM_remTax, which takes the name of the taxonomy as its parameter.
If you remove a taxonomy by using the method DM_remTax, you also remove the link from the mining field to the taxonomy.
There are a number of issues related to the logical data specification that are specific to the different data mining functions.
The Associations algorithm enables you to specify optional field-related information in a logical data specification, as follows:
The name mapping and the taxonomy of a field defined as a group field are not considered during the training run.
By default, the fields defined in the logical data specification are considered to be independent fields. An exception is the field defined by means of DM_setClasTarget, a method of the DM_ClasSettings type. The field defined in this way is considered to be the dependent field; this field must be of the categorical mining type.
The Tree Classification algorithm enables you to specify optional field-related information in a logical data specification, as follows:
Specify a name mapping for a categorical field by using DM_setFldNmp.
The Tree Classification algorithm does not support certain optional field-related information that can be specified in a logical data specification. It is possible to specify this information in a logical data specification contained in a Classification settings object. However, this has no impact on the Classification model being generated. The unsupported specifications are as follows:
The Distribution-based Clustering algorithm enables you to specify optional field-related information in a logical data specification, as follows:
The Distribution-based Clustering algorithm does not support the following:
Specifying a taxonomy for a categorical field by using DM_setFldTax
The Transform Regression algorithm enables you to specify optional field-related information in a logical data specification. Specify a name mapping for a categorical field by using DM_setFldNmp and DM_addNmp.
The Transform Regression algorithm does not support the following:
This chapter describes how to define the mining settings that your training run will need. These settings contain the specific instructions necessary for the mining function that you want to use. The logical data specification, which you have created already, becomes part of the mining settings.
Defining mining settings in the model-building process:
In this step, you create the following data types, perform operations on them, or both:
For a full discussion of the data types used with IM Modeling, see Introducing database objects and data mining in SQL.
For a full list of the methods that you can use in connection with settings data types, see Mining settings methods.
The DM_RuleSettings, DM_ClasSettings, DM_ClusSettings, and DM_RegSettings data types store the settings for an Associations, Classification, Clustering, and Regression training run. These settings are sets of control parameters. There are two types of settings, as follows:
The definitions and roles of the fields also belong to the settings specification. This means that the logical data specification is part of the settings definition.
To add the logical data specification to a settings value:
IDMMX.DM_ClusSettings()..DM_useClusDataSpec(IDMMX.DM_LogicalDataSpec() ..DM_addDataSpecFld( COL1 ) ..DM_setFldType( COL1 ,1) ..DM_addDataSpecFld( COL2 )..DM_setFldType( COL2 ,1))
Settings that are specific to mining functions include parameters that are shared by various mining algorithms of that mining function. Settings that are specific to mining algorithms include parameters that are only respected by a specific implementation of a mining function, for example, by Distribution-based Clustering.
Fields for which you create definitions as part of the settings specification must have a matching field name in the logical data specification. Note that you must include a logical data specification as the first step in creating settings. Some field definitions in the settings specification are required, for example, the target field for a Classification setting. Other field definitions are optional, for example, the definition of a field as active or supplementary in a Clustering settings specification. For the optional field definitions, default values are assumed.
IM Modeling provides a device for autonomic variable selection for the following algorithms:
For example, obvious key fields, degenerated fields (only a single value) or unusable fields (all records have missing values for it) should be dropped. If several fields are strongly correlated, only one of the correlated fields should be used.
The autonomic variable selection can be controlled by the usage type specified for a field. It is automatically enabled if one or more of the fields in the input table do not have a usage type. All fields with no usage type are checked towards their value for the mining process.
In Associations, Tree Classification, and Transform Regression, all fields with no usage type, which are not of any value for the mining process, are removed before the model is built. In Distribution-based Clustering, fields with no value for the mining process are not completely removed from the model. They are marked as supplementary. This means, their values are not needed to find out the clusters, but the clustering model contains statistics about their value distributions in the whole training data and in each cluster.
The following list shows the features of autonomic variable selection:
If you want to force certain fields to be contained in the model, you must call DM_setFldUsageType() on this field and specify the type accordingly:
To ease this process for large tables, DM_setFldUsageType can set all fields to a certain usage type at once.
A field is not considered during the mining run if it does not have a usage type and if it matches at least one of the following criteria:
The criteria are based on the following:
For categorical fields, chi2 based contingency tables are used.
In both cases, either the field with more different values or with better properties in terms of distribution and missing values is kept.
If you have performed a mining run with input fields that do not have a usage type, you can see in the final model which of these fields are actually used and which are sorted out. For a more in-depth analysis, it is recommended that you read the respective messages for the mining run, which provide more details on which fields were omitted and why.
To change this memory limit, use the power option '-buf' described in:
If this limit is exceeded, calculation of as many correlations as necessary to meet this limit are discarded. This may result in slightly worse results, however, the mining process is run successfully.
You are notified if the memory limit is too low. Repeating the mining run with a higher limit ensures the optimum result. Another factor is the number of different values that are tracked for each field. By default, 100 different values are distinguished and taken into account for correlation calculation. This usually ensures good results. However, you can change this value using the power option -IDM_MAX_DISCR_COUNT.
You can use DM_setPowerOptions to set the following power options and apply them to DM_RuleSettings, DM_ClasSettings, or DM_ClusSettings.
For example, to increase the memory limit to 1024 MB, specify:
DM_setPowerOptions('-buf 1024')
DM_setPowerOptions('-IDM_MAX_DISCR_COUNT 150')
The following provides information on settings definitions that are specific to the Associations mining function.
The table layout that you want to use for your mining run is defined in the structured type DM_RuleSettings. Use the following methods for the value of type DM_RuleSettings to define the table layout of your choice:
If your table layout requires a group ID, refer to DM_setGroup to define it.
A general introduction is provided in Items and groups in tables.
The Association kernel can read the groups of items out of tables with different table layouts. The following examples show the table layouts that are supported and how those table layouts are defined in your settings.
In general a group table consists of one or more item fields and optionally of a group ID field.
This section describes a scenario in a bank. The items are the different products that the bank offers to its customers. The list of products a customer uses yields a group of items. For simplicity the following groups are chosen:
In the first example in Table 13 there is a group ID field and one item field. Each record corresponds to one item in a group, that is, each group is represented by as many records as there are items in the group. The group ID is mandatory in this example because it is needed to identify the items that belong to the same group. Table 13 shows the most flexible table layout because neither the maximum transaction length nor the number of different items per group are limited after the table format has been defined.
| Group ID | Item |
|---|---|
| Smith | checking account |
| Smith | saving account |
| Smith | credit card |
| Jackson | checking account |
| Jackson | credit card |
| Jackson | loan |
| Jackson | custody account |
| Douglas | checking account |
| Douglas | custody account |
In the next examples in Table 14 and Table 15 each group is represented by exactly one record. The group ID is not needed to find the items that belong to the same group. Therefore the group ID is optional for those table layouts.
In example 2 shown in Table 14 each item field contains the item at a given position in the group, or NULL if there is no such item in this group. The field value identifies the item, whereas the field name is not relevant. The table layout of Table 14 limits the maximum transaction length to the number of item fields once the table has been created.
| Group ID | Item1 | Item2 | Item3 | Item4 |
|---|---|---|---|---|
| Smith | checking account | saving account | credit card | - |
| Jackson | checking account | credit card | loan | custody account |
| Douglas | checking account | custody account | - | - |
In example 3 in Table 15 each item field corresponds to exactly one item, that is, if your table contains N different items, there are N item fields. The field identifies the item and the field value states if the item is part of the group or not. In this example "Y" indicates that the item is a member of the group and NULL or empty string or blank string indicates that it is not a member of the group. You may choose your own string as 'Yes'-indicator. Each string that is not NULL, empty or blank is considered as 'Yes'-indicator.
| Group ID | checking account | saving account | credit card | loan | custody account |
|---|---|---|---|---|---|
| Smith | Y | Y | Y | - | - |
| Jackson | Y | - | Y | Y | Y |
| Douglas | Y | - | - | - | Y |
Example 4 in Table 16 shows the table layout of Table 15 in a more sophisticated way. The field values provide additional information about the items, such as the balance of the checking and saving account, the number of credit cards, the type of the loan and a rating of the usage of the custody account.
| Group ID | checking account | saving account | credit card | loan | custody account |
|---|---|---|---|---|---|
| Smith | 122.76 | 25,183.15 | 1 | - | - |
| Jackson | -3,000 | - | 5 | long term | high activity |
| Douglas | 11,877.43 | - | - | - | low activity |
For Table 13 and Table 14 the content of the item fields define the unique item names (such as saving account) needed to distinguish the items. For Table 15 and Table 16, however, it is different:
displays the resultant item names for the examples described before.
| Example | Item name | Origin of item name |
|---|---|---|
| 1 | [checking account] | [field value] |
| 2 | [checking account] | [field value] |
| 3 | [checking account] | [field name] |
| 4 | [checking account = 122.76] | [field name = field value] |
As you can see from the examples above, the table layout is determined by the way you define the item name from the field name and field value.
In a real scenario there are many different balances in the fields "checking account" and "saving account" in example 4 (Table 16). The probability that two customers have the same balance is rather low. Therefore an Associations mining run with those numeric fields might be useless because the balance is part of the item name and almost each customer generates his own items.
To circumvent this principal problem of numeric fields, the Intelligent Miner provides a discretization mechanism for numeric fields. If a numeric field contains more than 20 different values, the value range is divided in buckets. The number of buckets and the boundaries of the buckets are automatically determined by the association kernel. If a discretization of a numeric field occurs, the resultant item names are as follows:
For example, if there are more customer entries in Table 16 of example 4 with more than 20 different balances in the field 'checking account', the items resulting from the field 'checking account' might be:
[checking acccount: < -5000] [checking account: >= -5000 AND < 0] [checking account: >= 0 AND < 5000] [checking account: >= 5000 AND < 10000] [checking account: >= 10000 AND < 15000] [checking account: >= 15000 AND < 20000] [checking account: >= 20000 AND < 25000] [checking account: >= 25000 AND < 30000] [checking account: >= 30000 AND < 35000] [checking account: >= 35000 AND < 40000] [checking account: >= 40000]
If the automatically chosen buckets do not suit your needs, you can set the most left and the most right boundary value by the method DM_setFldOutlLim in the logical data specification. Ten equally broad buckets will be created between these boundary values.
As described in the previous sections, the table layout that you want to use for your mining run is defined by the item format. The item format is defined in the structured type DM_RuleSettings. Use the method DM_setItemFormat for the value of type DM_RuleSettings to define the item format of your choice. For more information refer to DM_setItemFormat.
The chosen item format can be retrieved by the method DM_getItemFormat.
If your table layout requires a group ID, refer to DM_setGroup to define it.
If your table contains fields you do not want to use in your mining run, you can deactivate a field using the method DM_setFldUsageType.
Here you find the settings for the examples provided in previous sections:
IDMMX.DM_RuleSettings()..DM_useRuleDataSpec(...)
..DM_setMinSupport(58.0)
..DM_setMinConf(95)
..DM_setItemFormat(1)
..DM_setFldUsageType('Item', 1)
..DM_setGroup('Group ID')IDMMX.DM_RuleSettings()..DM_useRuleDataSpec(...)
..DM_setMinSupport(58.0)
..DM_setMinConf(95)
..DM_setItemFormat(1)
..DM_setFldUsageType(1)
..DM_setFldUsageType('Group ID', 2)IDMMX.DM_RuleSettings()..DM_useRuleDataSpec(...)
..DM_setMinSupport(58.0)
..DM_setMinConf(95)
..DM_setItemFormat(2)
..DM_setFldUsageType('Group ID', 2)IDMMX.DM_RuleSettings()..DM_useRuleDataSpec(...)
..DM_setMinSupport(58.0)
..DM_setMinConf(95)
..DM_setItemFomat(0)
..DM_setFldUsageType('Group ID', 2)
For the examples shown in Table 14, Table 15, and Table 16 there is no restriction to one record per group.
Table 18, for example, shows the table layout of example 2 (Table 14) with two instead of four item fields.
| Group ID | Item1 | Item2 |
|---|---|---|
| Smith | checking account | saving account |
| Smith | credit card | - |
| Jackson | checking account | credit card |
| Jackson | loan | custody account |
| Douglas | checking account | custody account |
IDMMX.DM_RuleSettings()..DM_useRuleDataSpec(...)
..DM_setMinSupport(58.0)
..DM_setMinConf(95)
..DM_setItemFormat(1)
..DM_setFldUsageType(1)
..DM_setGroup('Group ID')If you join two different tables for your input table, some entries might be duplicated in the resulting view. The duplicated items do not cause any problem because the kernel ignores duplicated items in a group.
For example, if you join Table 19 with the table shown in Table 15, the table shown in Table 20 is created.
| Group ID | Customer access |
|---|---|
| Smith | Internet |
| Smith | ATM/Desk |
| Jackson | Internet |
| Douglas | Internet |
| Group ID | Item1 | Item2 | Item3 | Item4 | Customer access |
|---|---|---|---|---|---|
| Smith | checking account | saving account | credit card | - | Internet |
| Smith | checking account | saving account | credit card | - | ATM/Desk |
| Jackson | checking account | credit card | loan | custody account | Internet |
| Douglas | checking account | custody account | - | - | Internet |
There are several ways of controlling the number of rules that are created.
For a general description refer to Support in an association rule.
To define the minimum support that a rule must exceed to be calculated, use the DM_setMinSupport method to set the minimum support in the DM_RuleSettings value such as:
IDMMX.DM_RuleSettings()..DM_setMinSupport(25)
If you do not set the minimum support, the algorithm estimates a useful level for it.
To retrieve the value set for minimum support, use the method DM_getMinSupport.
For a general description refer to Confidence in an association rule.
To define the minimum confidence that a rule must exceed to be calculated, use the DM_setMinConf method to set the minimum confidence, as a percentage value, in the DM_RuleSettings value.
If you do not set the minimum confidence, the default value of 25 applies.
To retrieve the value set for minimum confidence, use the method DM_getMinConf.
A general introduction is provided in Rule body and rule head and Rule length and item constraints.
To control the number of rules you can define an upper limit for the length of the rules including both, the rule head and the rule body, that is, the maximum number of items in a rule.
To specify maximum rule length set the maximum rule length in the DM_RuleSettings value by using the method DM_setMaxLen. Retrieve this value by using DM_getMaxLen.
For a general description refer to Name mappings and Taxonomies.
Name mapping and taxonomy are defined in the logical data specification of your mining task. For more information refer to Defining a name mapping in the logical data specification.
Consider the following for an association mining run:
For example, assume the field 'account type' contains the value 'C1'. You choose the item format such that the item name is 'account type = C1'. Now you want to apply a name mapping to replace the abbreviation 'C1' by the more meaningful term 'checking basic'. To do this, your name mapping must contain the entry 'C1' ==> 'checking basic', that is, the field value and the mapped field value without the field name. The same applies to the definition of a taxonomy.
You have seen that you can control the number of rules by specifying settings for minimum support, minimum confidence, and maximum rule length. However, a further (and very effective) way exists: you can apply an item constraint.
A general introduction is provided in Rule length and item constraints.
To set item constraints define the constraint type in the DM_RuleSettings value by using the method DM_setConType(type), and retrieve it by using DM_getConType. Set up the list of items and categories in the DM_RuleSettings value by repeatedly calling the method DM_addConItem(item). To remove an item, use the method DM_remConItem(item). The method DM_getNumConItem returns the total number of items in the constraint list, and DM_getConItem returns an item from this list. These latter methods take a parameter whose value ranges from 1 to the total number of items.
For example, a field 'Account Type' contains the field value 'C1'. You define the item name as field name = field value. A name mapping exists for this field that maps 'C1' to 'Checking Basic'. The resulting item name for the definition of the item constraints is 'Account Type = Checking Basic'.
For example, if you replace all NULL values in Table 15 by "N" to indicate that the customer has not used the product, you get rules of the type [saving account = N] ==> [credit card = N], because the field value "N" is neither NULL, an empty String, nor a blank string. You can suppress these rules when you apply an excluding item constraint [* = N]. All rules that have items of the type [... = N] are excluded from the result.
A general introduction is provided in Active or inactive fields.
When using the Association mining function you should explicitly set the usage type of a field to active if you want to use it as an item field. Set the usage type to inactive if you do not want to use it as an item field. If you are undecided about a field, do not set the usage type of this field.
The Association mining function decides about the usage type together with the routine for autonomic variable selection. If this routine determines the field not to be useful for the mining process, the field is considered inactive during the generation of the mining model.
For more information refer to DM_setFldUsageType and Autonomic variable selection.
The following are a number of issues to do with settings definitions that are specific to the Classification mining function.
For a description of the class label field, see Class label field.
Use DM_setClasTarget to specify the target (class label) field for a DM_ClasSettings value. The mining data type of this field must be categorical. The specification of this field is mandatory.
Example:
In this example, the
logical data specification is created manually.
IDMMX.DM_ClasSettings()..DM_useClasDataSpec(IDMMX.DM_LogicalDataSpec()..
DM_addDataSpecFld('NAME')..DM_addDataSpecFld('SEX')..DM_addDataSpecFld
('DISEASED'))..DM_setClasTarget('DISEASED')
For a general description, see Maximum purity per internal node.
Use DM_setTreeClasPar('MaxPur','purity value') to set the value for maximum purity in the DM_ClasSettings value.
For a general description, see Maximum tree depth.
Use DM_setTreeClasPar('MaxDth','maxTreeDepth value') to set the maximum tree depth in the DM_ClasSettings value.
For a general description, see Minimum number of records per internal node.
Use DM_setTreeClasPar('MinRec','MinRecords value') to set the minimum number of records per internal node in the DM_ClasSettings value.
For a general description refer to Tolerated levels of incorrect predictions.
Use DM_setClasCostRate(percentage) to specify the percentage of incorrect predictions that can be tolerated on validation data in a Classification model.
For a general description refer to Cost matrix.
You can assign more or less weight to certain misclassifications by defining asymmetric error weighting. To define asymmetric error weighting, you specify a cost matrix.
Use DM_setCostMat(tableName, colNameActualValue, colNamePredValue, colNameWeight) to specify a cost matrix for a DM_ClasSettings value.
For a general description refer to Active or inactive fields.
When using the Classification mining function you need not set fields as active or inactive. This task is done by the Classification mining function together with the routine for autonomic variable selection. If this routine determines a field not to be useful for the mining process, you can overrule it by setting this field to active.
The following are a number of issues to do with settings definitions that are specific to the Clustering mining function.
For each field in a logical data specification, you can create optional definitions in a DM_ClusSettings value that are specific to the Distribution-based Clustering algorithm. You can also set some control parameters, for example, the maximum number of clusters or the desired execution time.
For more information refer to Active or supplementary fields, Autonomic variable selection, and DM_setFldUsageType.
You can personalize the fields that must be used to train the Clustering model by specifying active fields and supplementary fields.
You can set the usage type of a field to active or supplementary on a DM_ClusSettings value.
For a general description refer to Field weighting.
Use the method DM_setFldWeight(fieldName, weight) on a DM_ClusSettings value to assign a field weight for a field in the logical data specification.
For a general description refer to Value weighting.
Use the method DM_setDClusFldPar(fieldname, 'ValueWeighting', value) on a DM_ClusSettings value to specify a value weighting for a field in the logical data specification.
For a full description of the parameters to use for value weighting, including weighting with compensation, see DM_setDClusFldPar.
For a general description refer to Similarity scale.
You can set the scale of similarity that the mining function uses when it compares two values of a numerical field. Use the method DM_setFldSimScale(fieldName, absoluteSimilarity) on a DM_ClusSettings value to specify a similarity scale for a numerical field in the logical data specification.
For a general description refer to Outlier treatment.
You can specify how the mining function treats values that lie outside the scope of a field's value range.
Use the method DM_setFldOutlTreat(fieldName, outlierTreatment) on a DM_ClusSettings value to set the outlier treatment.
For a general description refer to Similarity matrices.
To define a similarity matrix call the method DM_addSimMat(matrixName, tableName, fldValCol1, fldValCol2, simCol) on a DM_ClusSettings value. You can later attribute this similarity matrix to one or several fields of the logical data specification. To do this, use the method DM_setFldSimMat(fieldName, matrixName) on the same DM_ClusSettings value.
For a general description refer to Maximum number of clusters.
To specify the maximum number of clusters use the method DM_setMaxNumClus(maxNOClus) on a DM_ClusSettings value.
For a general description refer to Similarity threshold.
Use the method DM_setDClusPar('SimThr', value) on a DM_ClusSettings value to set the similarity threshold.
For a general description refer to Desired execution time.
Use the method DM_setExecTime(time) on a DM_ClusSettings value.
For a general description refer to Minimum percentage of data.
Use the method DM_setMinData(minData) on a DM_ClusSettings value to specify the minimum percentage of data that is processed.
The following are a number of issues to do with settings definitions that are specific to the Regression mining function.
For each field in a logical data specification, you can create optional definitions in a DM_RegSettings value that are specific to the Regression algorithm.
For a general description refer to Target field.
You must use DM_setRegTarget to specify the field name of a target field of a DM_RegSettings object. The mining data type of this field must be numerical. Its name must coincide with one of the field names defined in the logical data specifications.
For more information refer to DM_setRegTarget.
For a general description refer to Maximum tolerated systematic error (RSquared).
Use DM_setRegRSquared to set an upper threshold for r2 to set an upper limit for the acceptable systematic error of the model. For more information refer to DM_setRegRSquared.
For a general description refer to Desired execution time.
You set the desired execution time to specify the maximum threshold for the total run time of subsequent Regression mining runs. Use the method DM_setExecTime(time) on a DM_RegSettings value.
For more information refer to DM_setExecTime.
For a general description refer to Active or inactive fields.
You can personalize the fields that must be used to train the Regression model by specifying active fields and inactive fields. Such a field does not take part in the calculation of a Regression model.
If you do not set the usage type for a field, the Regression algorithm does it for you. The algorithm detects fields that are not useful for a Regression training run, and automatically sets them to inactive. Refer to Autonomic variable selection for more information about fields that are not considered useful for mining. The other fields are considered active and are used for the Regression run.
For more information refer to DM_setFldUsageType.
This chapter describes how to create the mining task. A mining task brings together all the information actually needed to start a training run and to compute the mining model. This information consists of the mining settings you created in the previous step, and the input data definition that you created at the beginning.
You can also define tasks for test runs. These tasks bring together all the information actually needed to start a test run. This information consists of the mining data used to test a mining model and a location of the mining model to be tested.
For more information on defining mining tasks in the model-building and model-testing process refer to:
The tasks you perform in this step are:
In this step, you create the following data types, perform operations on them, or both:
For a full discussion of the data types used with IM Modeling, see Introducing database objects and data mining in SQL.
For a full list of the methods that you can use in connection with those data types, see Mining tasks methods.
A DM_RuleBldTask, DM_ClasBldTask, DM_ClusBldTask, or DM_RegBldTask type provides all the information actually needed to start a training run and to compute a data mining model. In a task, a settings definition is combined with a physical data specification of type DM_MiningData. This combination is valid if an alias name is defined in the physical data specification for each field name in the logical data specification of the settings values.
To combine a settings definition with a physical data specification and to construct a task, call the following methods:
The training runs are executed in stored procedures named DM_buildRuleModel for association, DM_buildClasModel for classification, DM_buildClusModel for clustering, and DM_buildRegModel for regression.
For Classification or Regression the DM_defClasBldTask method or the DM_defRegBldTask method gets a second DM_MiningData value as input. The source table defined in that DM_MiningData value is used to validate the data mining model produced during the execution of a Classification or Regression training run. If this second DM_MiningData value is NULL, no validation takes place.
It is also possible to define a task that contains all the information needed for a Classification or Regression test run. Use the type DM_ClasTestTask and DM_RegTestTask for this purpose. In a test task, you must define a physical data specification of type DM_MiningData and the location of the Classification model that you want to test. To define a complete test task, use the method DM_defClasTestTask and DM_defRegTestTask. The alias names in the physical data specification must match the field names contained in the model, including the target field.
The stored procedures for the test run are named DM_testClasModel and DM_testRegModel.
You can specify additional control parameters for all the task types. These control parameters consist of the name of an error table or the name of the progress table. For more information about the error and progress table, see:
Call the DM_setErrorTab method to define the name of the EMT for the task values:
As you enabled the database, an EMT was created with the name IDMMX.ErrorTable. You can read the EMT name from the task values by calling the DM_getErrorTab method. If you do not define an EMT, error information is written to the file only.
The association between error messages written to the error table and the corresponding mining run is established by a call ID. This is a binary character value that can be specified as an input parameter to the stored procedure doing the training or test run. You can generate the call ID by using the DB2 built-in function GENERATE_UNIQUE(). The call ID is written into each row of the error table to identify the error messages. If you specify no call ID, you are recommended to do one of the following:
Call the DM_setProgTab method to define the PIT name for the task values:
A progress table is created with the name IDMMX.ProgressTab. To retrieve the PIT name from the task values, call DM_getProgTab. If you do not define a PIT, progress information is not written.
This chapter describes how to build the mining model. For this task, IM Modeling provides predefined procedures that build the mining models and store them in database tables. To build a model, you specify the mining task that you built in the previous step, as well as a database location for the model.
For more information on building and storing mining models in the model-building process refer to:
The principal task you perform in this step is to call the appropriate stored procedure to execute the training run.
In this step, you create the following data types:
For a full discussion of the data types used with IM Modeling, see Introducing database objects and data mining in SQL.
For a full list of the stored procedures that you can use in connection with these data types, see Stored procedures for building mining models.
To execute training runs, use the following stored procedures:
Each of the procedures exists twice. They take the task as input, either as a CLOB value or as a database location. To get CLOB values from the task types (for example, DM_ClasBldTask), use export methods like DM_expClasTask. When you call the stored procedure, the appropriate data mining model is computed, using all the parameters specified in the task value.
Optionally, you can specify a call ID as an input parameter to the stored procedure. The call ID is a binary character string; it can be generated by means of the DB2 built-in function GENERATE_UNIQUE(). It identifies the entries in the error table and in the progress table as entries written by this specific mining run. If you use a call ID, one error table or progress table can be used by different mining runs. If you do not want to specify a call ID, you must specify NULL for this parameter. (For information about the error and progress table, see Getting error information, and Getting progress information.)
IM Modeling does not provide the data mining model as the return value of the stored procedure. Instead, the model is saved in a database table. The table name, column, and additionally an ID and an ID column are specified as input parameters to the stored procedure. The reason for storing the model directly in a table has to do with its size. The stored procedure must be called in a client application program by means of a CALL statement. If the model were returned by the stored procedure, the client application would have to provide the storage for the model. Because the storage requirements for the model types DM_RuleModel, DM_ClasModel, DM_RegressionModel, or DM_ClusteringModel are very large, this might lead to problems in the client application.
Other versions of the stored procedures take the task as input in the form of a database location. These versions are as follows:
These stored procedures do not have the parameter call ID.
A code example for executing a training run on the mining model is provided here. It is assumed that you use the sample tables provided with IM Modeling to store the following:
The parameters are as follows:
The stored procedure call to execute the training run of the model is as follows:
CALL IDMMX.DM_buildClusModelCmd('IDMMX.CLUSTASKS', 'TASK', 'ID',
'MyClusGenericTask', 'IDMMX.CLUSTERMODELS', 'MODEL', 'MODELNAME',
'MyClusGenericModel' );
You can test a model (Classification or Regression models) by running a test task, and you can also analyze its quality by extracting quality information from the test result or model.
For a general introduction refer to Testing a model and analyzing its quality.
You can test a Classification or Regression model. Testing the model includes checking and analyzing the quality of the prediction that IM Modeling makes for the classification or regression of the records used in the test. For a general description refer to Testing Classification or Regression models.
You test a Classification or Regression model by using stored procedures. You can run a test on the:
For more information refer to Stored procedures for testing mining models.
When you do a Classification or Regression test run on the mining model using new data, you specify only the model and the relevant physical data specification.
Use one of the following stored procedures to test the:
The DM_testClasModelCmdD or DM_testRegModelCmdD procedure can be called from the DB2 command line. These procedures take the Classification or Regression model as input. Passing the complete model as input would mean passing many megabytes into the stored procedure. Therefore, you pass only a database location to the model into the stored procedure. This database location consists of the table name, the model column name, the ID, and the ID column name.
Another input parameter specifies the source table to be used to test the model. The DM_testClasModelD or DM_testRegModelD procedure gets a CLOB value that was exported from a value of type DM_MiningData by means of the method DM_expMiningData. The DM_testClasModelCmdD or DM_testRegModelCmdD procedure takes a database location that points to a value of type DM_MiningData. The database location consists of:
This source table must contain the fields in the model and the target field, which contains the actual classification or regression of the rows. The columns contained in the DM_MiningData value must be mapped to the fields contained in the model using the alias name. To query the fields in the model, use the following functions on the model:
The DM_getFields table function returns a table containing the list of all fields except the target field. The target field is returned by the function DM_getClasTarget or DM_getRegTarget.
You can also specify a call ID, which identifies this particular test run in progress and error information. To generate the call ID, use the DB2 built-in function GENERATE_UNIQUE().
The stored procedure saves the test result as a value of type DM_ClasTestResult or DM_RegTestResult in a database table. You specify the database location consisting of the table name, column, and additionally an ID and an ID column as input parameters to the stored procedure.
CALL IDMMX.DM_testClasModelCmdD( 'IDMMX.MININGDATA', 'MININGDATA', 'ID', 'MyMiningData', 'IDMMX.CLASSIFMODELS', 'MODEL', 'MODELNAME', 'MyClassifModel', 'IDMMX.CLASTESTRESULTS', 'RESULT', 'ID', 'MyTestResult' )
For more information refer to:
When you do a Classification or Regression test run on the test task, you specify the test task, and also some additional control parameters if you wish.
To test the Classification or Regression model, use the stored procedure DM_testClasModelT or DM_testRegModelT, and provide the test task as input. The test task is provided either as a CLOB value that was exported from a value of type DM_ClasTestTask or DM_RegTestTask by means of the method DM_expClasTestTask or DM_expRegTestTask, or as a database location. A database location consists of a table name, a column containing the DM_ClasTestTask or DM_RegTestTask value, a column containing an ID, and the ID itself.
If you wish, you can also specify a call ID, which identifies this particular test run in progress and error information. To generate the call ID, use the DB2 built-in function GENERATE_UNIQUE().
You can also use another stored procedure, which can be called from the DB2 command line. This is DM_testClasModelCmdT or DM_testRegModelCmdT, which takes the task as a database location. You cannot specify a call ID as a parameter of the procedure DM_testClasModelCmdT or DM_testRegModelCmdT.
The stored procedures save the test result as a value of type DM_ClasTestResult or DM_RegTestTask in a database table. You specify the database location consisting of the table name, column, and additionally an ID and an ID column as input parameters to the stored procedure.
Here is a code example for executing a Classification Test run on the test task. It is assumed that you use the samples tables provided with IM Modeling to store the following:
The parameters are as follows:
The stored procedure call to test the model is as follows:
CALL IDMMX.DM_testClasModelCmdT( 'IDMMX.CLASTESTTASKS', 'ID', 'TASK', 'MyClasTestTask', 'IDMMX.CLASTESTRESULTS', 'RESULT', 'ID', 'MyTestResult' )
For more information refer to:
When you analyze the quality of a model you extract quality information from a test result or model. This information is provided in tables that you can further process with other programs, as described in Working with mining models and test results.
With known data, the purpose of applying the model is to detect and verify correlations between the target field's value and the values of the other data fields. Each Regression model, for example, represents a set of assumptions on those causal relations. By comparing the model output with the actual values of the target field in the known data, one can estimate the degree of validity of the model's inherent rules and assumptions. The Regression models, for example, generated by Regression quantify this vague notion of 'degree of validity' by providing two levels of quality information.
The following sections introduce you to the quality measurements and algorithm specifications provided by IM Modeling.
This measure indicates the information gain that you get from using the model compared to a random prediction. It provides an overall analysis of the quality.
Each model contains an overall quality measure expressed by the following number:
The overall quality Q of a model or test result can be retrieved using function DM_getMdlQuality. For more information refer to DM_getMdlQuality.
Compares the order of the validation data records when sorted by the predicted values with the order of the same data records when sorted by the actual values of the target fields. The exact formula for R is:
R = area(model) / area(optimum)
Here, area(model) is the area between the gains chart curve for the model and the straight line corresponding to random ordering of the data records. Area(optimum) is the same measure which arises if the data records are ranked by decreasing actual target values on the x-axis (whereas area(model) ranks by decreasing predicted target values on the x-axis). This quality measure is adequate for use cases in which one is interested in identifying, for example, the top 10% of the data with respect to the predicted value. A typical scenario is the planning of a target mailing campaign in which those 10% of the customers are to be mailed for which the action results in the highest additional income.
Keep in mind that the ranking quality only measures the model's ability to predict the correct relative order of the target field values. A model with high ranking quality can still have large systematic errors in its prediction. The ranking quality R of a Classification or Regression model or test result can be retrieved using function DM_getRankQuality. For more information refer to DM_getRankQuality. The quality is indicated by a number between 0 and 1 as described in Overall quality Q.
Describes whether the predicted values match the actual values of the target field within the incertitude due to statistical fluctuations and noise in the input data values. This is a stronger criterion than R since it requires that not only the relative ordering of the target field values but also their absolute size is correctly modeled. A typical use scenario in which this quality measure is important is again a direct marketing campaign. This time, the aim of the campaign is to generate a given amount X of additional income. The task is to select a sufficient number of the most promising customers so that the planned income will (probably) be reached. Here, it is inevitable that the model predicts not only the ordering of the predicted fields but also their absolute values.
The predictive accuracy A of a Regression model can be retrieved using function DM_getPredAccuracy. For more information refer to DM_getPredAccuracy. The quality is indicated by a number between 0 and 1 as described in Overall quality Q.
This quantity describes the estimated ability of the model to predict unknown data. A value of G=1 means that you can expect the model to provide as accurate predictions on new test or application data as on the training data. A value of G=0 means that the model is considered useless for new data.
The reliability G of a Regression or Classification model can be retrieved using function DM_getReliability. For more information refer to DM_getReliability. The quality is indicated by a number between 0 and 1 as described in Overall quality Q.
The following functions are provided to work with algorithm specifications:
You can check the confusion and cost matrix of a Classification model.
Define the DM_getConfMatrix function to receive a table that holds the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel.
If the value is of type DM_ClasModel, the confusion and cost matrix are returned from the validation result.
If no validation result is contained in the model, nothing is returned if you have not specified explicitly that the confusion and cost matrix of the Classification model should be returned.
The following example shows how to define the confusion matrix:
SELECT CAST ("ACTUAL" AS CHAR(15)) AS "ACTUAL_VALUE",
CAST ("PREDICTED" AS CHAR(15)) AS "PREDICTED_VALUE",
"COUNT" AS "NUM_CASES",
"COST" AS "COST_OF_WRONG_PREDICTION"
FROM TABLE (IDMMX.DM_getConfMatrix(
(SELECT "RESULT" FROM IDMMX."CLASTESTRESULTS"
WHERE ID='HeartClasTestResult'))
) AS "MATRIX"
ORDER BY "ACTUAL", "PREDICTED";
For more information refer to DM_getConfMatrix.
Use the DM_getMdlQuality function to check the overall quality of a model as it has been determined in a preceding validation or test step.
It can be specified for the following value types:
The following example shows how to extract information about the quality of a model:
SELECT
IDMMX.DM_getMdlQuality("MODEL") AS "MODEL_QUALITY"
FROM IDMMX."CLUSTERMODELS"
WHERE "MODELNAME"='BankCustomerSegments';
The following example shows how to extract information about the quality of a test result:
SELECT IDMMX.DM_getMdlQuality("RESULT") AS "MODEL_QUALITY"
FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult';
For more information refer to DM_getMdlQuality.
Use the DM_getGainsChart function to check gains chart information from a Classification or Regression model.
It can be specified for the following value types:
The following example defines that the gains chart information is read from the result of a Regression test run:
SELECT CAST ("ROWCOUNT" AS SMALLINT) AS "NUMROWS_IN_SUBSET",
CAST ("SUMACTUAL" AS SMALLINT)
AS "SUM_OF_ACTUAL_TARGET_VALUES",
CAST ("THRESHOLD" AS DEC(5,2))
AS "SMALLEST_PRED_VALUE_IN_SUBSET"
FROM TABLE (IDMMX.DM_getGainsChart(
(SELECT "RESULT" FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult'))
) AS "MATRIX"
ORDER BY "NUMROWS_IN_SUBSET";
For more information refer to DM_getGainsChart.
Use the DM_getPredAccuracy function for a Regression or Classification model to check if:
It can be specified for the following value types:
The following example shows how to predict test results from a Regression test run:
SELECT IDMMX.DM_getPredAccuracy("RESULT")
AS "PRED_ACCURACY"
FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult';
For more information refer to DM_getPredAccuracy and Quality concepts.
Use the DM_getRankQuality function for a Regression or Classification model to compare the order of the:
It can be specified for the following value types:
The following example shows a definition for training data records:
SELECT IDMMX.DM_getRankQuality("RESULT",'2') AS "RANK_QUALITY"
FROM IDMMX."CLASTESTRESULTS"
WHERE "ID"='HeartClasTestResult';
For more information refer to DM_getRankQuality and Quality concepts.
Use the DM_getRegRSquared function to retrieve the squared Pearson correlation coefficient contained in a value of type DM_RegressionModel.
For more information refer to DM_getRegRSquared and Quality concepts.
Use the DM_getReliability function to check if the application of the model produces reliable results if the application data is similar to the validation or test data used.
It can be specified for the following value types:
The following example shows a definition to extract the information from a test result:
SELECT IDMMX.DM_getReliability("RESULT") AS "RELIABILITY"
FROM IDMMX."CLASTESTRESULTS"
WHERE "ID"='HeartClasTestResult';
For more information refer to DM_getReliability and Quality concepts.
Use the DM_getRMSE function to check the error between actual and predicted target field values.
It can be specified for the following value types:
The following example shows a definition to extract the information from a test result:
SELECT IDMMX.DM_getRMSE("RESULT") AS "ROOT_MEAN_SQUARE_ERROR"
FROM IDMMX."REGTESTRESULTS"
WHERE "ID"='InsuranceTestResult';
For more information refer to DM_getRMSE and Quality concepts.
This chapter describes where you can deploy the model or test result, and how you can prepare the model content for the corresponding application phase.
You use user-defined functions to:
For a general description refer to Working with mining models and test results.
You retrieve information for the following data types:
For details refer to Functions for working with model type DM_RuleModel.
For details refer to Functions for working with model type DM_ClasModel.
For details refer to Functions for working with model type DM_ClusteringModel.
For details refer to Functions for working with model type DM_RegressionModel.
For details refer to Functions for working with test results.
For details refer to Functions for working with test results.
For a full discussion of the data types used with IM Modeling, see Introducing database objects and data mining in SQL.
This section describes how to work on data mining models.
When the model building process is finished you can work on field importance and field-field correlation. Classification, Clustering, and Regression store detailed field importance and field-field correlation information in the created model.
For example, the primary purpose for constructing Regression models is to predict numerical values for the target field. However, as a second (and sometimes even more important) purpose, you might be interested in gaining insight into the relations between the explanatory fields and the target field.
DM_getFields returns a table that contains the signature of a model and the importance of its field.
DM_getCorrelations returns a table that contains the correlations between fields with respect to a data mining model.
Together with the field importance information, the field-field correlations can optimize the data mining process for computation time, the amount of data storage, and the cost of data acquisition.
Based on the common attributes of these customers and on the results of similar mailing campaigns in the past, Regression creates a model which predicts the company's additional profit from the mailing campaign for each customer - also for those customers who have never before been involved in a similar mailing campaign:
You can use the table function DM_getFields to identify fields in the logical data specification that are used for a test or application run. This function returns a table that contains the signature of a model. The signature of a model is the set of all input data fields which appear in the model's internal equations and whose values are therefore needed to apply the model. The importance of its fields can also be identified in the table.
For more information refer to DM_getFields and Introducing field importance and field-field correlation.
Use the following function to extract the name of a model:
To identify the mining task that was used to build a model, you can use the following functions:
Depending on the mining model, you can retrieve different types of information:
IM Modeling also provides export functions that return the model in PMML format as a character large object type, as outlined in Table 21.
| Export function | Model type converted to a CLOB value |
|---|---|
| DM_expRuleModel | DM_RuleModel |
| DM_expClasModel | DM_ClasModel |
| DM_expClusModel | DM_ClusteringModel |
| DM_expRegModel | DM_RegressionModel |
It is assumed that a Tree Classification model with MODELNAME='TreClaModel1' was built and exists in the table IDMMX.CLASSIFMODELS. Specify the following command to export it into a plain PMML file:
db2 "EXPORT TO TreClaModel1.del OF del
LOBS to C:\mymodels
LOBFILE TreClaModel1
MODIFIED BY LOBSINFILE
SELECT 'MODELNAME', IDMMX.DM_expClasModel('MODEL')
FROM IDMMX.CLASSIFMODELS WHERE MODELNAME='TreClaModel1'"
This command exports the model into the plain PMML file TreClaModel1.001 in directory C:\mymodels. The model name and a reference to the model in file TreClaModel1.001 is written into the file C:\mymodels\TreClaModel1.del using the comma-separated-values format.
This section describes how to work with test results.
The mining test result type DM_ClasTestResult or DM_RegTestResult hold the results information from a test run computed for a Classification or Regression model.
The table function DM_getConfMatrix holds the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel. If the value is of type DM_ClasModel, the confusion and cost matrix are returned from the validation result.
IM Modeling provides functions to enable you to work with test results. For example, the function:
To export the test result, type:
This returns the test result in XML format as a character large object value. It reuses the syntax and elements of PMML models.
This chapter provides reference lists of all the database objects supplied with IM Modeling, together with a short description of each.
These database objects reside in the schema IDMMX.
Each short description in this chapter includes a reference to where you can find the full description.
Where relevant, each description here also has an indication of whether the database object is part of the SQL/MM standard. For information about this standard, see Standards conformance.
For more information refer to Introducing database objects and data mining in SQL and Naming conventions and parameter sizes.
The user-defined data types of IM Modeling are introduced in User-defined data types. They store the following values:
Structured types are introduced in User-defined data types.
| Type name | Attribute's source data type | Comment | SQL/MM data type |
|---|---|---|---|
| DM_ClasBldTask | CLOB | Contains all the information that constitutes a Classification task, in particular the input data and the parameter settings | Y |
| DM_ClasSettings | CLOB | Contains the settings that are used to generate a Classification model | Y |
| DM_ClasTestTask | CLOB | Contains all the information that constitutes a Classification test task, in particular the input data, the logical data specification, and a location for a Classification model | Y |
| DM_ClusBldTask | CLOB | Contains all the information that constitutes a Clustering task, in particular the input data and the parameter settings | Y |
| DM_ClusSettings | CLOB | Contains the settings that are used to generate a Clustering model | Y |
| DM_LogicalDataSpec | CLOB | Contains the field name and field type definitions of the mining fields that are part of the input data used to build models and test models | Y |
| DM_MiningData | CLOB | Contains the definition of the input data used to build models and test models | Y |
| DM_RegBldTask | CLOB | Contains all information that constitutes a Regression task, in particular the input data and the parameter settings | Y |
| DM_RegSettings | CLOB | Contains the settings that are used to generate a Regression model | Y |
| DM_RegTestTask | CLOB | Contains all information that constitutes a Regression test task, in particular the input data, logical data specification and a location of a Regression model | Y |
| DM_RuleBldTask | CLOB | Contains all the information about a search for association rules, in particular the input data and the parameter settings | Y |
| DM_RuleSettings | CLOB | Contains the settings that are used to generate an Associations model | Y |
Distinct types are introduced in User-defined data types.
| Type name | Source data type | Comment | SQL/MM data type |
|---|---|---|---|
| DM_ClasModel | BLOB | Represents a Classification model | Y |
| DM_ClusteringModel | BLOB | Represents a Clustering model | Y |
| DM_RuleModel | BLOB | Represents an Associations model | Y |
| DM_RegressionModel | BLOB | Represents a Regression model | Y |
| DM_ClasTestResult | BLOB | Contains the result of a test run of a Classification model | Y |
| DM_RegTestResult | BLOB | Contains the result of a test run of a Regression model | Y |
The DM_LogicalDataSpec data type defines the input fields used by training runs. An input field is defined by a name and a type. The type defines how a mining algorithm handles that field. Possible types are DM_Categorical or DM_Numerical, and these types map by default to the DB2 source data types listed here.
| Mining data field type name | Mining field type value | Source data type |
|---|---|---|
| DM_Categorical | 0 | CHAR, VARCHAR, LONG VARCHAR |
| DM_Numerical | 1 | SMALLINT, INTEGER, DOUBLE, FLOAT, DECIMAL, BIGINT, REAL, TIME, DATE, TIMESTAMP |
For example, time 18:00:00 (or 06:00:00PM) is converted to 64800 = 18 times 60 minutes of 60 seconds.
For example, date 2002-03-21 (March, 21st 2002) is converted to 730929 = 2001 times 365 days, plus 500 times 1 day (a leap year every 4 years), minus 20 times 1 day (a non-leap year every 100 years), plus 5 times 1 day (a leap year every 400(R) years), plus 31 days (in January), plus 28 days (in February in a non-leap year), plus 21 days (in March), minus 1.
For example, timestamp 2002-03-21T18:00:00.000000 (or March, 21st 2002 at 06:00:00PM) is converted to 730929.75 = 730929 days, plus 64800 seconds divided by 86400 seconds (86400 is the number of seconds in one day).
These methods act on a value of type DM_MiningData. The value holds information about the source data for which you want to build a mining model. With these methods, you can create a value, specify the names of columns in the source data, and generate a logical data specification. You can also do other modifications to the DM_MiningData value and retrieve information about it.
For a general introduction refer to Defining mining settings.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defMiningData | Defines a DM_MiningData value from a given source table name | Y | DM_defMiningData |
| DM_expMiningData | Exports the DM_MiningData value as a CLOB value | N | DM_expMiningData |
| DM_genDataSpec | Generates a value of type DM_LogicalDataSpec from a DM_MiningData value | Y | DM_genDataSpec |
| DM_getColumnName | Returns the column name at a specified position.
Note:
This method is deprecated. Use the table function DM_getFields instead, as described in DM_getFields(miningData). |
N | DM_getColumnName |
| DM_getFields(miningData) | Returns a table of the fields contained in a value of
type DM_MiningData.
Note:
DM_getFields(miningData) is a table function. |
N | DM_getFields(miningData) |
| DM_getFldAlias | Returns the alias name that corresponds to the specified
column name.
Note:
This method is deprecated. Use the
table function DM_getFields instead, as described in DM_getFields(miningData). |
N | DM_getFldAlias |
| DM_getNumColumns | Returns the number of columns specified in the DM_MiningData value.
Note:
This method is deprecated. Use the table function DM_getFields instead, as described in DM_getFields(miningData). |
N | DM_getNumColumns |
| DM_getTableName | Returns the name of the base table or view, or the nickname specified in a value of type DM_MiningData | N | DM_getTableName |
| DM_getWhereClause | Returns a specified WHERE clause | N | DM_getWhereClause |
| DM_impMiningData | Imports a previously exported DM_MiningData value | N | DM_impMiningData |
| DM_setColumns | Specifies the names of the columns in a source table
by means of an XML string.
Note:
This method is no longer
required, because DM_defMiningData automatically sets column information. |
N | DM_setColumns |
| DM_setFldAlias | Defines an alias name for a field contained in a DM_MiningData value | Y | DM_setFldAlias |
| DM_setWhereClause | Sets a WHERE clause to filter the data | N | DM_setWhereClause |
These methods act on a value of type DM_LogicalDataSpec. Use these methods to modify and to query the logical data specification value.
You can create a value of type DM_LogicalDataSpec from a value of type DM_MiningData by using the data mining method DM_genDataSpec. This sets the logical data specification to default values. You can use the methods described here to modify this logical data specification.
You can also use these methods to create a logical data specification from scratch, to specify taxonomies, and to do other specification tasks.
A general introduction is provided in Defining logical data specifications
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_addDataSpecFld | Adds a field with a specified name to a value of type DM_LogicalDataSpec | Y | DM_addDataSpecFld |
| DM_expDataSpec | Exports a DM_LogicalDataSpec value as a CLOB value | N | DM_expDataSpec |
| DM_getFldName | Returns the name of a field at a specified position in a value of type DM_LogicalDataSpec | Y | DM_getFldName |
| DM_getFldType | Returns the mining field type of a specified field contained in a value of type DM_LogicalDataSpec | Y | DM_getFldType |
| DM_getNumFields | Returns the number of fields contained in a value of type DM_LogicalDataSpec | Y | DM_getNumFields |
| DM_impDataSpec | Imports a previously exported DM_LogicalDataSpec value | N | DM_impDataSpec |
| DM_isCompatible | Checks whether the field entry specifications in the first argument are a subset of the specifications in the second argument | Y | DM_isCompatible |
| DM_remDataSpecFld | Removes a field with a specified name from a value of type DM_LogicalDataSpec | Y | DM_remDataSpecFld |
| DM_setFldType | Sets the data mining field type for a specified field in a value of type DM_LogicalDataSpec | Y | DM_setFldType |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getFldNmp | Gets the name mapping specified for a field | N | DM_getFldNmp |
| DM_getFldTax | Gets the taxonomy specified for a field | N | DM_getFldTax |
| DM_setFldNmp | Sets a name mapping for a specified field | N | DM_setFldNmp |
| DM_setFldTax | Sets a taxonomy for a specified field | N | DM_setFldTax |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_addNmp | Adds a specification of a name mapping consisting of the name, table name, and column names for the original value and the mapped name | N | DM_addNmp |
| DM_getNmpMapValCol | Returns the name of the column containing the mapped name in a name mapping | N | DM_getNmpMapValCol |
| DM_getNmpName | Returns the name of the name mapping at a specified position | N | DM_getNmpName |
| DM_getNmpTabName | Returns the name of the table containing the name mapping | N | DM_getNmpTabName |
| DM_getNmpValCol | Returns the name of the column containing the value that is to be mapped by means of a name mapping | N | DM_getNmpValCol |
| DM_getNumNmp | Returns the number of name mapping specifications in the logical data specification | N | DM_getNumNmp |
| DM_remNmp | Removes a name mapping from the logical data specification | N | DM_remNmp |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_addTax | Adds a taxonomy specification, consisting of a name and a first category map, to the logical data specification | N | DM_addTax |
| DM_addTaxMap | Adds a category map to the existing taxonomy specified by its name. A category map consists of a table name and column names for the child and parent columns. It can optionally contain a name mapping for the parent column, and a type value that specifies whether the category map is recursive or non-recursive. | N | DM_addTaxMap |
| DM_getNumTax | Returns the number of taxonomies specified in the logical data specification | N | DM_getNumTax |
| DM_getNumTaxMap | Returns the number of category maps that belong to a taxonomy | N | DM_getNumTaxMap |
| DM_getTaxChildCol | Returns the name of the column that contains the child values of a category map | N | DM_getTaxChildCol |
| DM_getTaxMapType | Returns the type (recursive/non-recursive) of the category map | N | DM_getTaxMapType |
| DM_getTaxName | Returns the name of the taxonomy at the specified position | N | DM_getTaxName |
| DM_getTaxParentCol | Returns the name of the column that contains the parent values of a category map | N | DM_getTaxParentCol |
| DM_getTaxParentNmp | Returns the name mapping of the parent column of a category map | N | DM_getTaxParentNmp |
| DM_getTaxTabName | Returns the table name of a specified category map | N | DM_getTaxTabName |
| DM_remTax | Removes a taxonomy from a logical data specification | N | DM_remTax |
| DM_remTaxMap | Removes a category map from a taxonomy | N | DM_remTaxMap |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getFldOutlLimLo | Returns the lower bound value for a field | N | DM_getFldOutlLimLo |
| DM_getFldOutlLimUp | Returns the upper bound value for a field | N | DM_getFldOutlLimUp |
| DM_setFldOutlLim | Sets the lower and upper bound values for a field | N | DM_setFldOutlLim |
The mining settings methods act on values of the settings type. These values hold the settings specific to the various mining functions used in training runs.
Use these methods after you have created the logical data specification, and before you build the mining task for the mining function that you are using.
A general description is provided in Defining mining settings.
These methods act on a value of type DM_RuleSettings. The value holds the settings for an Associations training run.
Use these methods after you have created the logical data specification as a value of type DM_LogicalDataSpec, and before you build the Associations mining task.
With these methods, you can specify general rule settings and item constraints.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_expRuleSettings | Exports the settings as a CLOB value | N | DM_expRuleSettings |
| DM_getFldUsageType | Returns the field usage type of a field | N | DM_getFldUsageType |
| DM_getGroup | Returns the group field that is contained in a value of type DM_RuleSettings | Y | DM_getGroup |
| DM_getItemFld | Returns the specified item field | N | DM_getItemFld |
| DM_getItemFormat | Returns how the item names are built | N | DM_getItemFormat |
| DM_getMaxLen | Returns the specified maximum length of a rule | Y | DM_getMaxLen |
| DM_getMinConf | Returns the specified minimum confidence | Y | DM_getMinConf |
| DM_getMinSupport | Returns the minimum support that was specified in a value of type DM_RuleSettings | Y | DM_getMinSupport |
| DM_getRuleDataSpec | Returns the DM_LogicalDataSpec value defined for a value of DM_RuleSettings | Y | DM_getRuleDataSpec |
| DM_impRuleSettings | Imports previously exported settings | N | DM_impRuleSettings |
| DM_setGroup | Specifies the field used to identify the group | Y | DM_setGroup |
| DM_setItemFld | Specifies the field used to identify the item | N | DM_setItemFld |
| DM_setItemFormat | Defines how the item names are built from the field value and the field name | N | DM_setItemFormat |
| DM_setFldUsageType | Sets the usage type for the specified field or all fields | Y | DM_setFldUsageType |
| DM_setMaxLen | Sets the maximum length of a rule | Y | DM_setMaxLen |
| DM_setMinConf | Sets the minimum confidence | Y | DM_setMinConf |
| DM_setMinSupport | Sets the minimum support for a value of type DM_RuleSettings | Y | DM_setMinSupport |
| DM_useRuleDataSpec | Specifies a DM_LogicalDataSpec value for a DM_RuleSettings value | Y | DM_useRuleDataSpec |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_addConItem | Adds an item to the list of item constraints | N | DM_addConItem |
| DM_getConItem | Gets the item at the specified position | N | DM_getConItem |
| DM_getConType | Gets the item constraint type | N | DM_getConType |
| DM_getNumConItem | Gets the number of items in the list of item constraints | N | DM_getNumConItem |
| DM_remConItem | Removes an item from the list of item constraints | N | DM_remConItem |
| DM_setConType | Sets the item constraint type | N | DM_setConType |
These methods act on a value of type DM_ClasSettings. The value holds the settings for a Classification training run.
Use these methods after you have created the logical data specification as a value of type DM_LogicalDataSpec, and before you build the Classification mining task.
With these methods, you can specify general Classification settings and a cost matrix.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_expClasSettings | Exports the settings as a CLOB value | N | DM_expClasSettings |
| DM_getClasCostRate | Returns the maximum percentage of misclassifications that are tolerated during validation | Y | DM_getClasCostRate |
| DM_getClasCost | Returns the cost of predicting a specific class label value for a specific actual class label value | Y | DM_getClasCost |
| DM_getClasDataSpec | Returns the DM_LogicalDataSpec value defined for a value of DM_ClasSettings | Y | DM_getClasDataSpec |
| DM_getClasTarget | Returns the target field that is contained in a value of type DM_ClasSettings | Y | DM_getClasTarget |
| DM_getFldUsageType | Returns the field usage type of a field | N | DM_getFldUsageType |
| DM_getTreeClasPar | Gets a parameter that is specific to the Tree Classification algorithm | N | DM_getTreeClasPar |
| DM_impClasSettings | Imports previously exported settings | N | DM_impClasSettings |
| DM_setClasCost | Returns a specified value of type DM_ClasSettings | Y | DM_setClasCost |
| DM_setClasCostRate | Sets the maximum percentage of misclassifications that are tolerated during validation | Y | DM_setClasCostRate |
| DM_setClasTarget | Specifies the target field for a value of DM_ClasSettings | Y | DM_setClasTarget |
| DM_setFldUsageType | Sets the usage type for the specified field or all fields | Y | DM_setFldUsageType |
| DM_setTreeClasPar | Sets different settings parameters that are specific to the Tree Classification algorithm | N | DM_setTreeClasPar |
| DM_useClasDataSpec | Specifies a DM_LogicalDataSpec value for a DM_ClasSettings value | Y | DM_useClasDataSpec |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getCostMatAV | Returns the column name containing the actual value of the cost matrix | N | DM_getCostMatAV |
| DM_getCostMatPV | Returns the column name containing the predicted value of the cost matrix | N | DM_getCostMatPV |
| DM_getCostMatTab | Returns the name of the table containing the cost matrix | N | DM_getCostMatTab |
| DM_getCostMatWGT | Returns the column name containing the weight of the cost matrix | N | DM_getCostMatWGT |
| DM_setCostMat | Sets a cost matrix | N | DM_setCostMat |
These methods act on a value of type DM_ClusSettings. This value holds the settings for a Clustering training run.
Use these methods after you have created the logical data specification as a value of type DM_LogicalDataSpec, and before you build the Clustering mining task.
With these methods, you can specify general Clustering settings, similarity matrices, and field-specific settings.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_expClusSettings | Exports the settings as a CLOB value | N | DM_expClusSettings |
| DM_getClusDataSpec | Returns the DM_LogicalDataSpec value defined for a value of DM_ClusSettings | Y | DM_getClusDataSpec |
| DM_getDClusPar | Gets a parameter that is specific to the Distribution-based Clustering algorithm | N | DM_getDClusPar |
| DM_getExecTime | Returns the maximum execution time | N | DM_getExecTime |
| DM_getMaxNumClus | Returns the maximum number of clusters contained in a value of type DM_ClusSettings | Y | DM_getMaxNumClus |
| DM_getMinData | Returns the specified minimum percentage of data | N | DM_getMinData |
| DM_impClusSettings | Imports previously exported settings | N | DM_impClusSettings |
| DM_setDClusPar | Sets different parameters that are specific to the Distribution-based Clustering algorithm | N | DM_setDClusPar |
| DM_setExecTime | Sets the maximum execution time | N | DM_setExecTime |
| DM_setMaxNumClus | Specifies the maximum number of clusters for a value of type DM_ClusSettings | Y | DM_setMaxNumClus |
| DM_setMinData | Sets the minimum percentage of data that must be processed | N | DM_setMinData |
| DM_useClusDataSpec | Specifies a DM_LogicalDataSpec value for a DM_ClusSettings value | Y | DM_useClusDataSpec |
| DM_setFldUsageType | Sets the usage type for the specified field or all fields | Y | DM_setFldUsageType |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_addSimMat | Adds a similarity matrix to the Clustering settings | N | DM_addSimMat |
| DM_getNumSimMat | Returns the number of similarity matrices that are specified | N | DM_getNumSimMat |
| DM_getSimMatName | Returns the name of the similarity matrix at the specified position | N | DM_getSimMatName |
| DM_getSimMatSim | Returns the column containing the similarity value | N | DM_getSimMatSim |
| DM_getSimMatTab | Returns the name of the table containing the similarity matrix | N | DM_getSimMatTab |
| DM_getSimMatVal1 | Returns the column containing the first value in a similarity matrix | N | DM_getSimMatVal1 |
| DM_getSimMatVal2 | Returns the column containing the second value in a similarity matrix | N | DM_getSimMatVal2 |
| DM_remSimMat | Removes a similarity matrix from the Clustering settings | N | DM_remSimMat |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getDClusFldPar | Gets a field parameter that is specific to the Distribution-based Clustering algorithm | N | DM_getDClusFldPar |
| DM_getFldOutlTreat | Returns the kind of outlier treatment for a field | N | DM_getFldOutlTreat |
| DM_getFldSimMat | Returns the similarity matrix of a field | N | DM_getFldSimMat |
| DM_getFldSimScale | Returns the similarity scale of a field | Y | DM_getFldSimScale |
| DM_getFldUsageType | Returns the field usage type of a field | N | DM_getFldUsageType |
| DM_getFldWeight | Returns the field weight of a field | Y | DM_getFldWeight |
| DM_setDClusFldPar | Sets different field parameters that are specific to the Distribution-based Clustering algorithm | N | DM_setDClusFldPar |
| DM_setFldOutlTreat | Sets the kind of outlier treatment for a field | N | DM_setFldOutlTreat |
| DM_setFldSimMat | Sets a similarity matrix for a field | N | DM_setFldSimMat |
| DM_setFldSimScale | Sets the similarity scale for a field | Y | DM_setFldSimScale |
| DM_setFldUsageType | Sets the usage type for the specified field or all fields | N | DM_setFldUsageType |
| DM_setFldWeight | Sets the field weight of a field | Y | DM_setFldWeight |
These methods act on a value of type DM_RegSettings. The value holds the settings for a Regression training run.
Use these methods after you have created the logical data specification as a value of type DM_LogicalDataSpec, and before you build the Regression mining task.
With these values, you can specify general Regression settings, the maximum amount of time to be used for model training, and the maximum tolerated Pearson correlation (r2) between the predicted values and their errors.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_expRegSettings | Exports the current DM_RegSettings object into a CLOB | Y | DM_expRegSettings |
| DM_impRegSettings | Imports a CLOB representing a DM_RegSettings object | Y | DM_impRegSettings |
| DM_useRegDataSpec | Specifies a DM_LogicalDataSpec value for a DM_RegSettings value | Y | DM_useRegDataSpec |
| DM_getRegDataSpec | Returns the DM_LogicalDataSpec value defined for a value of DM_RegSettings | Y | DM_getRegDataSpec |
| DM_setExecTime | Sets the maximum execution time | N | DM_setExecTime |
| DM_getExecTime | Returns the maximum execution time | N | DM_getExecTime |
| DM_setRegRSquared | Sets the maximum tolerated squared Pearson correlation coefficient | Y | DM_setRegRSquared |
| DM_getRegRSquared | Returns the maximum tolerated squared Pearson correlation coefficient | Y | DM_getRegRSquared |
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_setFldUsageType | Sets the usage type for the specified field or all fields | N | DM_setFldUsageType |
| DM_getFldUsageType | Returns the field usage type of a field | N | DM_getFldUsageType |
| DM_setRegTarget | Defines the target field for regression | Y | DM_setRegTarget |
| DM_getRegTarget | Returns the target field of regression | Y | DM_getRegTarget |
These methods act on values of all settings types. Use these methods to set and query power options, and to export and import settings values.
The setting types are as follows:
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getPowerOptions | Returns the specified power options for the appropriate settings definition | N | DM_getPowerOptions |
| DM_setPowerOptions | Sets the power options for the appropriate settings definition | N | DM_setPowerOptions |
Values of the mining task type specify tasks for training runs. Task values combine settings values with a representation of the data source.
Use these methods after you have defined the mining data, and after you have specified the appropriate settings for the mining function that you are using. Use these methods before you build and store a mining model.
A general introduction is provided in Defining mining tasks
These methods create or act on a value of type DM_ClasBldTask. The value specifies a task for a Classification training run. The value holds the settings for the run, and also a representation of the data source.
Before you use these methods, you must do the following:
Use these methods before you build and store a Classification mining model.
With these methods, you can specify the settings and input data representation, and retrieve information about them from a value of type DM_ClasBldTask.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defClasBldTask | Defines a DM_ClasBldTask value from a training DM_MiningData value, a validation DM_MiningData value, and a DM_ClasSettings value | Y | DM_defClasBldTask |
| DM_expClasTask | Exports a task value as a CLOB value | N | DM_expClasTask |
| DM_getClasSettings | Returns a DM_ClasSettings value representing the settings for a Classification task | Y | DM_getClasSettings |
| DM_getClasTrnData | Returns a DM_MiningData value representing the training data | Y | DM_getClasTrnData |
| DM_getClasValData | Returns a DM_MiningData value representing the validation data | Y | DM_getClasValData |
| DM_impClasTask | Imports a previously exported task value | N | DM_impClasTask |
These methods create or act on a value of type DM_ClasTestTask. The value specifies a task for a test run of a Classification model. The value holds the location for the model. Use these methods after you have created a Classification model.
These methods enable you to create the test task, or to retrieve information about the input data or the model to be tested.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defClasTestTask | Defines a DM_ClasTestTask value from a DM_MiningData value and a location of an input model to be tested | N | DM_defClasTestTask |
| DM_expClasTestTask | Exports a task value as a CLOB value | N | DM_expClasTestTask |
| DM_getClasMdlCol | Returns the name of the column containing the input
model.
Note:
SQL/MM instead has one method DM_getClasTestMdl. |
N | DM_getClasMdlCol |
| DM_getClasMdlID | Returns the identifier of the input model.
Note:
SQL/MM instead has one method DM_getClasTestMdl. |
N | DM_getClasMdlID |
| DM_getClasMdlIDCol | Returns the name of the column containing the identifier
of the input model.
Note:
SQL/MM instead has one method DM_getClasTestMdl. |
N | DM_getClasMdlIDCol |
| DM_getClasMdlTab | Returns the source table name containing the input model.
Note:
SQL/MM instead has one method DM_getClasTestMdl. |
N | DM_getClasMdlTab |
| DM_getClasTestData | Returns the DM_MiningData value | N | DM_getClasTestData |
| DM_impClasTestTask | Imports a previously exported task value | N | DM_impClasTestTask |
These methods create or act on a value of type DM_RegTestTask. The value specifies a task for a test run of a Regression model. The value holds the location for the model. Use these methods after you have created a Regression model.
These methods enable you to create the test task, or to retrieve information about the input data or the model to be tested.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defRegTestTask | Defines a DM_RegTestTask value out of a DM_MiningData and a location of a DM_RegressionModel to be tested | Y | DM_defRegTestTask |
| DM_getRegTestData | Returns the DM_MiningData value representing the test data | Y | DM_getRegTestData |
| DM_getRegMdlTab | Returns the source table name containing the input model.
Note:
SQL/MM instead has one method DM_getRegTestMdl. |
N | DM_getRegMdlTab |
| DM_getRegMdlCol | Returns the name of the column containing the input
model.
Note:
SQL/MM instead has one method DM_getRegTestMdl. |
N | DM_getRegMdlCol |
| DM_getRegMdlId | Returns the identifier of the input model.
Note:
SQL/MM instead has one method DM_getRegTestMdl. |
N | DM_getRegMdlID |
| DM_getRegMdlIdCol | Returns the name of the column containing the identifier
of the input model.
Note:
SQL/MM instead has one method DM_getRegTestMdl. |
N | DM_getClasMdlIDCol |
| DM_expRegTestTask | Exports a test task value as a CLOB value | N | DM_expRegTask |
| DM_impRegTestTask | Imports a previously exported task value | N | DM_impRegTestTask |
These methods create or act on a value of type DM_ClusBldTask. The value specifies a task for a Clustering training run. The value holds the settings for the run, and also a representation of the data source.
Before you use these methods, you must do the following:
Use these methods before you build and store a Clustering mining model.
With these methods, you can specify the settings and input data representation for a Clustering mining task. You can also use them to retrieve information from a value of type DM_ClusBldTask.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defClusBldTask | Defines a DM_ClusBldTask value from a DM_MiningData value and a DM_ClusSettings value | Y | DM_defClusBldTask |
| DM_expClusTask | Exports a task value as a CLOB value | N | DM_expClusTask |
| DM_getClusSettings | Returns a DM_ClusSettings value representing the settings definition for a Clustering task | Y | DM_getClusSettings |
| DM_getClusTrnData | Returns a DM_MiningData value representing the training data | Y | DM_getClusTrnData |
| DM_impClusTask | Imports a previously exported task value | N | DM_impClusTask |
These methods create or act on a value of type DM_RuleBldTask. The value specifies a task for an Associations training run. The value holds the settings for the run, and also a representation of the data source.
Before you use these methods, you must do the following:
Use these methods before you build and store an Associations mining model.
With these methods, you can specify the settings and input data representation, and retrieve information about them from a value of type DM_RuleBldTask.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defRuleBldTask | Defines a DM_RuleBldTask value from a DM_MiningData value and a DM_RuleSettings value | Y | DM_defRuleBldTask |
| DM_expRuleTask | Exports a task value as a CLOB value | N | DM_expRuleTask |
| DM_getRuleSettings | Returns a DM_RuleSettings value representing the settings for an Associations task | Y | DM_getRuleSettings |
| DM_getRuleTrnData | Returns a DM_MiningData value representing the training data | Y | DM_getRuleTrnData |
| DM_impRuleTask | Imports a previously exported task value | N | DM_impRuleTask |
These methods create or act on a value of type DM_RegBldTask. The value specifies a task for a Regression training run. The value holds the settings for the run, and also a representation of the data source.
Before you use these methods, you must do the following:
Use these methods before you build and store a Regression mining model.
With these methods, you can specify the settings and input data representation, and retrieve information about them from a value of type DM_RegBldTask.
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_defRegBldTask | Defines a DM_RegBldTask value from a training DM_MiningData value, a validation DM_MiningData value, and a DM_RegSettings value | Y | DM_defRegBldTask |
| DM_expRegTask | Converts a value of type DM_RegBldTask or DM_RegTestTask to a CLOB value and returns it | Y | DM_expRegTask |
| DM_getRegTrnData | Returns a DM_MiningData value representing the training data | Y | DM_getRegTrnData |
| DM_getRegValData | Returns a DM_MiningData value representing the validation data | Y | DM_getRegValData |
| DM_getRegSettings | Returns a DM_RegSettings value representing the settings of a classification task | Y | DM_getRegSettings |
| DM_impRegTask | Converts a CLOB value to a value of type DM_RegBldTask | Y | DM_impRegTask |
These methods act on values of all task types. Use these methods to import or export task information, and to define sources for error and progress information.
The task types are as follows:
| Method | Purpose | SQL/MM method | See: |
|---|---|---|---|
| DM_getErrorTab | Returns the specified error table | N | DM_getErrorTab |
| DM_getProgTab | Returns the specified progress table | N | DM_getProgTab |
| DM_setErrorTab | Sets the error table to be used | N | DM_setErrorTab |
| DM_setProgTab | Sets the progress table to be used | N | DM_setProgTab |
You use stored procedures to build mining models from specified mining tasks and to store the models in specified database tables. Use these procedures after you have specified mining tasks.
For a general description refer to Building and storing mining models.
| Procedure | Purpose | See: |
|---|---|---|
| DM_buildRuleModel
DM_buildRuleModelCmd |
Searches for association rules, and stores a value of type DM_RuleModel in a specified table | DM_buildRuleModel,
DM_buildRuleModelCmd |
| DM_buildClasModel
DM_buildClasModelCmd |
Does a Classification training run, and stores a value of type DM_ClasModel in a specified table | DM_buildClasModel,
DM_buildClasModelCmd |
| DM_buildClusModel
DM_buildClusModelCmd |
Does a Clustering training run, and stores a value of type DM_ClusteringModel in a specified table | DM_buildClusModel,
DM_buildClusModelCmd |
| DM_buildRegModel
DM_buildRegModelCmd |
Does a regression training run and stores a value of type DM_RegressionModel in a specified table | DM_buildRegModel,
DM_buildRegModelCmd |
You use stored procedures to test Classification or Regression models. Use these procedures after you have specified a Classification or Regression test task.
| Procedure | Purpose | See: |
|---|---|---|
| DM_testClasModelD
DM_testClasModelT DM_testClasModelCmdD DM_testClasModelCmdT |
Does a Classification test run | DM_testClasModelT (using a test task), DM_testClasModelCmdT , DM_testClasModelD (using mining data), DM_testClasModelCmdD |
| DM_testRegModelD
DM_testRegModelT DM_testRegModelCmdD DM_testRegModelCmdT |
Does a Regression test run | DM_testRegModelT (using a test task), DM_testRegModelCmdT , DM_testRegModelD (using mining data), DM_testRegModelCmdD |
These functions act on values that contain mining models or test results.
A general introduction is provided in Analyzing the model quality.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getConfMatrix | Returns a table holding the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel | Y | DM_getConfMatrix |
| DM_getGainsChart | Returns a table containing gains chart information from a Classification or Regression model | Y | DM_getGainsChart |
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| DM_getPredAccuracy | Returns a value between 0 and 1 which provides the probability that a prediction of the specified value is correct | N | DM_getPredAccuracy |
| DM_getRankQuality | Returns the ranking precision of the model (a quality measure indicating how good the model is in ordering the test records with respect to the target field value) | N | DM_getRankQuality |
| DM_getReliability | Returns a value between 0 and 1 which describes how good the model performs when applied to test or validation data (which were not used for training before) compared to the model's performance on the training data | N | DM_getReliability |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getGainsChart | Returns a table containing gains chart information from a Classification or Regression model | Y | DM_getGainsChart |
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| DM_getPredAccuracy | Returns a value between 0 and 1 which indicates whether the model produces systematic deviations between predicted values and actual target values. A value of 1 means that the model produces no systematic error, a value of 0 means that the model produces a systematic error as large as that one produced by always predicting the mean target field value. | N | DM_getPredAccuracy |
| DM_getRankQuality | Returns a value between 0 and 1 which corresponds to the ratio between the area under this model's gains chart curve and the area under the best possible gains chart curve (for given test or validation data) | N | DM_getRankQuality |
| DM_getRegRSquared | Returns the squared Pearson correlation coefficient contained in a value of type DM_RegressionModel | Y | DM_getRegRSquared |
| DM_getReliability | Returns a value between 0 and 1 which describes how good the model performs when applied to test or validation data (which were not used for training before) compared to the model's performance on the training data | N | DM_getReliability |
| DM_getRMSE | Returns the root mean squared error (calculated from actual versus predicted target field values of the validation data) | N | DM_getRMSE |
Use these functions after you have done a test run on a Classification or Regression model.
These functions act on a value of type DM_ClasTestResult. The value holds the result of a Classification test run.
Use these functions to access the results of the test run, or to transform the test result to a CLOB value.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getGainsChart | Returns a table containing gains chart information from a Classification or Regression model | Y | DM_getGainsChart |
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| DM_getPredAccuracy | Returns a value between 0 and 1 which provides the probability that a prediction of the specified value is correct | N | DM_getPredAccuracy |
| DM_getRankQuality | Returns the ranking precision of the model (a quality measure indicating how good the model is in ordering the test records with respect to the target field value) | N | DM_getRankQuality |
| DM_getReliability | Returns the reliability (or robustness) of the model (a quality number indicating how well the model performs on non-training data compared to training data) | N | DM_getReliability |
These functions act on a value of type DM_RegTestResult. The value holds the result of a Regression test run.
Use these functions to access the results of the test run, or to transform the test result to a CLOB value.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_getGainsChart | Returns a table containing gains chart information from a Classification or Regression model | Y | DM_getGainsChart |
| DM_getMdlQuality | Returns a value between 0 and 1 which indicates the model's quality as it has been determined in a preceding validation or test step | N | DM_getMdlQuality |
| DM_getPredAccuracy | Returns a value between 0 and 1 which indicates whether the model produces systematic deviations between predicted values and actual target values. A value of 1 means that the model produces no systematic error, a value of 0 means that the model produces a systematic error as large as that one produced by always predicting the mean target field value. | N | DM_getPredAccuracy |
| DM_getRankQuality | Returns the ranking precision of the model (a quality measure indicating how good the model is in ordering the test records with respect to the target field value) | N | DM_getRankQuality |
| DM_getReliability | Returns the reliability (or robustness) of the model (a quality number indicating how well the model performs on non-training data compared to training data) | N | DM_getReliability |
| DM_getRMSE | Returns the root mean squared error (calculated from actual versus predicted target field values of the test data) | Y | DM_getRMSE |
These functions act on values that contain mining models.
Use these functions to access a mining model as a character large object data type for further processing, and to retrieve information about mining models.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expRuleModel | Returns a character large object representation of a value of type DM_RuleModel | Y | DM_expRuleModel |
| DM_getCorrelations | Returns a table containing the correlations between fields with respect to a data mining model | Y | DM_getCorrelations |
| DM_getFields | Returns a table that contains the signature of a model | Y | DM_getFields |
| DM_getNumRules | Returns the number of rules contained in a value of type DM_RuleModel | Y | DM_getNumRules |
| DM_getNumTransacts | Returns the number of transactions contained in the dataset used to build the model of type DM_RuleModel | Y | DM_getNumTransacts |
| DM_getRuleBodies | Returns a table containing the bodies of rules in a value of type DM_RuleModel | Y | DM_getRuleBodies |
| DM_getRuleMdlName | Gets the name of the rule model | N | DM_getRuleMdlName |
| DM_getRules | Returns a table containing the rules in a value of type DM_RuleModel | Y | DM_getRules |
| DM_getRuleTask | Returns the DM_RuleBldTask value used to create the association rules | Y | DM_getRuleTask |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expClasModel | Returns a character large object representation of a value of type DM_ClasModel | Y | DM_expClasModel |
| DM_getClasCostRate | Returns the cost rate contained in a value of type DM_ClasModel | Y | DM_getClasCostRate |
| DM_getClasError | Returns the Classification error value contained in a DM_ClasTestResult value | Y | DM_getClasCostRate |
| DM_getClasMdlName | Gets the name of the Classification model | N | DM_getClasMdlName |
| DM_getClasTarget | Returns the target field contained in a value of type DM_ClasModel | Y | DM_getClasTarget |
| DM_getClasTask | Returns the DM_ClasBldTask value used to create the model | Y | DM_getClasTask |
| DM_getConfMatrix | Returns the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel | Y | DM_getConfMatrix |
| DM_getCorrelations | Returns a table containing the correlations between fields with respect to a data mining model | Y | DM_getCorrelations |
| DM_getFields | Returns a table that contains the signature of a model | Y | DM_getFields |
| DM_getTreeRules | Returns a table that contains one record for each node of a Tree Classification model | Y | DM_getTreeRules |
| DM_isValidated | Indicates if validation data is used during the training phase | Y | DM_isValidated |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expClusModel | Returns a character large object representation of a value of type DM_ClusteringModel | Y | DM_expClusModel |
| DM_getClusMdlName | Gets the name of the Clustering model | N | DM_getClusMdlName |
| DM_getClusTask | Returns the DM_ClusBldTask value used to create the model | Y | DM_getClusTask |
| DM_getClusters | Returns a table that contains the clusters of a Clustering model | Y | DM_getClusters |
| DM_getCorrelations | Returns a table containing the correlations between fields with respect to a data mining model | Y | DM_getCorrelations |
| DM_getFields | Returns a table that contains the signature of a model | Y | DM_getFields |
| DM_getNumClusters | Returns the number of clusters contained in a value of type DM_ClusteringModel | Y | DM_getNumClusters |
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expRegModel | Returns a character large object representation of a value of type DM_RegressionModel | Y | DM_expRegModel |
| DM_getCorrelations | Returns a table containing the correlations between fields with respect to a data mining model | Y | DM_getFields |
| DM_getFields | Returns a table that contains the signature of a model | Y | DM_getFields |
| DM_getRegRSquared | Returns the squared Pearson correlation coefficient of the Regression model computed during the training phase using the validation data specified in the DM_RegBldTask value used to generate the model | Y | DM_getRegRSquared |
| DM_getRegTarget | Returns the name of the target field used when training the Regression model | Y | DM_getRegTarget |
| DM_getRegTask | Returns the DM_RegBldTask value used to create this model | Y | DM_getRegTask |
| DM_getRegMdlName | Gets the name of the regression model. For more information refer to Intelligent Miner Scoring: Administration and Programming for DB2. | N | DM_getRegMdlName |
| DM_isValidated | Indicates if validation data is used during the training phase | Y | DM_isValidated |
Use these functions after you have done a test run on a Classification or Regression model.
These functions act on a value of type DM_ClasTestResult. The value holds the result of a Classification test run.
Use these functions to access the results of the test run, or to transform the test result to a CLOB value.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expClasTestRes | Returns a character large object representation of a value of type DM_ClasTestResult | N | DM_expClasTestRes |
| DM_getClasError | Returns the Classification error value contained in the DM_ClasTestResult value | Y | DM_getClasError |
| DM_getConfMatrix | Returns a table holding the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel | Y | DM_getConfMatrix |
These functions act on a value of type DM_RegTestResult. The value holds the result of a Regression test run.
Use these functions to access the results of the test run, or to transform the test result to a CLOB value.
| Function | Purpose | SQL/MM function | See: |
|---|---|---|---|
| DM_expRegTestRes | Returns a character large object representation of a value of type DM_ClasTestResult | N | DM_expRegTestRes |
| DM_getPredError | Returns the prediction error value contained in the DM_RegTestResult value | Y | DM_getPredError |
Use these stored procedures to do administrative tasks connected with training runs, and to retrieve column information about source data tables.
| Procedure | Purpose | See: |
|---|---|---|
| DM_cancelTask | Cancels a mining run. See Canceling mining runs. | DM_cancelTask |
| DM_getEnv | Gets the environment variables that were set for a process. See Setting environment variables (for error and trace). | DM_getEnv |
| DM_getErrors | Retrieves complete error messages. | DM_getErrors(rowcount) |
| DM_getMiningData | Returns the column names and column types of the specified table in an XML format. | DM_getMiningData |
| DM_setEnv | Sets environment variables for a process. See Setting environment variables (for error and trace). | DM_setEnv |
This chapter contains descriptions of the following:
Full descriptions of all the database objects supplied with IM Modeling appear in the chapters that follow.
The DB2 catalog tables must contain a schema named Myschema (mixed case) and a table named Mytable (mixed case)
The DB2 catalog tables must contain a schema named MYSCHEMA and a table named MYTABLE
The DB2 catalog tables must contain a schema named MYSCHEMA and a table named "Myta"ble"
If you have a table named Mytab'le it must be specified as follows in the DM_defMiningData method:
The sizes of the input and output parameters of the methods, functions, and procedures are as follows:
This chapter contains full descriptions of all the methods provided with IM Modeling. They are presented in alphabetical order of the method names. For a listing in the order of the data types that they act on, see Overview of IM Modeling's database objects.
For instructions on how to use the database objects presented here, see Using IM Modeling.
This method adds an item to the list of item constraints contained in a DM_RuleSettings value. If a constraint type has not been set already, it is set to the default constraint type 'inclusive'.
Method syntax
>>-ruleSettings..DM_addConItem--(--item--)---------------------><
Function syntax
>>-DM_addConItem--(--ruleSettings--,--item--)------------------><
Method syntax
>>-fields..DM_addDataSpecFld--(--fieldName--)------------------><
Function syntax
>>-DM_addDataSpecFld--(--fields--,--fieldName--)---------------><
This method adds a name mapping to a value of type DM_LogicalDataSpec. The name mapping is defined by a reference to a table and to two columns, one containing the original data value and the other the mapped name.
The table is not read when this method is called. Reading the table and checking whether it exists happen during the training run.
Method syntax
>>-fields..DM_addNmp--(--name--,--tableName--,--dataValueCol--,--mappedValueCol--)-><
Function syntax
>>-DM_addNmp--(--fields--,--name--,--tableName--,--dataValueCol--,--mappedValueCol--)-><
This method defines a similarity matrix for a DM_ClusSettings value. The similarity matrix is a reference to a table. The table contains the similarity definitions to be used for the training runs. The table is not read when this method is called. Reading the table and checking whether the table exists happen during the run time of the training run.
Method syntax
>>-clusSettings..DM_addSimMat--(--simMatrixName--,--tableName--,--colNameValue1--,--> >--colNameValue2--,--colNameSimilarity--)----------------------><
Function syntax
>>-DM_addSimMat--(--clusSettings--,--simMatrixName--,--tableName--,--colNameValue1--,--> >--colNameValue2--,--colNameSimilarity--)----------------------><
This method adds a taxonomy to a value of type DM_LogicalDataSpec.
A taxonomy consists of a name and at least one category map. The first category is specified with this method. A category map consists of a reference to a table and to two columns containing child and parent values. It can optionally contain a name mapping for the parent values, and a type value that specifies whether the category map is recursive or non-recursive.
The table is not read when this method is called. Reading the table and checking whether it exists happen during the training run.
Method syntax
>>-fields..DM_addTax--(--name--,--tabName--,--childCol--,--parentCol--,--> >--parentNameMap--,--mapType--)--------------------------------><
Function syntax
>>-DM_addTax--(--fields--,--name--,--tabName--,--childCol--,--parentCol--,--> >--parentNameMap--,--mapType--)--------------------------------><
Possible values are:
This method adds a category map to an existing taxonomy in a value of type DM_LogicalDataSpec.
The category map consists of a reference to a table and to two column names containing the child and parent values of the category map. It can optionally contain a name mapping for the parent values, and a type value that specifies whether the category map is recursive or non-recursive.
The table is not read when this method is called. Reading the table and checking whether it exists happen during the training run.
Method syntax
>>-fields..DM_addTaxMap--(--name--,--tabName--,--childCol--,--parentCol--,--> >--parentNameMap--,--mapType--)--------------------------------><
Function syntax
>>-DM_addTaxMap--(--fields--,--name--,--tabName--,--childCol--,--parentCol--,--> >--parentNameMap--,--mapType--)--------------------------------><
Possible values are:
This method returns a DM_ClasBldTask value determined by the given DM_MiningData values for training and validation, and the given DM_ClasSettings value.
Method syntax
>>-DM_ClasBldTask()..DM_defClasBldTask--(--trainData--,--validationData--,--clasSettings--)-><
Function syntax
>>-DM_defClasBldTask--(--DM_ClasBldTask()--,--trainData--,--validationData--,--clasSettings--)-><
The DM_defClasBldTask method constructs a value of type DM_ClasBldTask with the given DM_MiningData and DM_ClasSettings values. If DM_defClasBldTask is called on an existing DM_ClasBldTask value, content is overwritten.
This method returns a DM_ClasTestTask value. The value is determined by the DM_MiningData value specified for the test, and a database location of the input model to be used for validation.
Method syntax
>>-clasTestTask..DM_defClasTestTask--(--miningData--,--tableName--,--colNameModel--,--> >--colNameID--,--modelName--)----------------------------------><
Function syntax
>>-DM_defClasTestTask--(--clasTestTask--,--miningData--,--tableName--,--colNameModel--,--> >--colNameID--,--modelName--)----------------------------------><
The DM_defClasTestTask method constructs a value of type DM_ClasTestTask with the given DM_MiningData and the database location of the input model. If DM_defClasTestTask is called on an existing DM_ClasTestTask value, content is overwritten.
This method returns the DM_ClusBldTask value determined by both a specified DM_MiningData value and a specified DM_ClusSettings value.
Method syntax
>>-DM_ClusBldTask()..DM_defClusBldTask--(--trainData--,--settings--)-><
Function syntax
>>-DM_defClusBldTask--(--DM_ClusBldTask()--,--trainData--,--settings--)-><
The DM_defClusBldTask method constructs a value of type DM_ClusBldTask with the given DM_MiningData and DM_ClusSettings values. If DM_defClusBldTask is called on an existing DM_ClusBldTask value, content is overwritten.
This method creates a DM_MiningData value consisting of the name of the source table and column information. The source table must be a base table, a view, or a nickname.
Method syntax
>>-DM_MiningData()..DM_defMiningData--(--sourceTableName--)----><
Function syntax
>>-DM_defMiningData--(--DM_MiningData()--,--sourceTableName--)-><
The column information is automatically retrieved. Only columns of the following DB2 base types are contained in the resulting value of type DM_MiningData. User-defined types (UDTs) are treated as their base types. Table 63 shows the corresponding sqlType values contained in the return value.
| SQL type in DM_MiningData | DB2 column types |
|---|---|
| SMALLINT | SMALLINT |
| INTEGER |
|
| BIGINT | BIGINT |
| REAL | REAL |
| DOUBLE |
|
| DECIMAL |
|
| CHAR |
|
| VARCHAR |
|
| LONG VARCHAR |
|
| DATE | DATE |
| TIME | TIME |
| TIMESTAMP | TIMESTAMP |
This method returns a DM_RegBldTask value determined by both, the given DM_MiningData values for training and validation, and the given DM_RegSettings value. If valiData is NULL, the kernel determines internally which part to use from the training data as validation data.
Method syntax
>>-DM_RegBldTask()..DM_defRegBldTask--(--trainData--,--valiData--,--settings--)-><
Function syntax
>>-DM_defRegBldTask--(--DM_RegBldTask()--,--trainData--,--valiData--,--settings--)-><
The DM_defRegBldTask method constructs a value of type DM_RegBldTask with the given DM_MiningData and DM_RegSettings values. If DM_defRegBldTask is called on an existing DM_RegBldTask value, its content is overwritten.
This method defines a complete task for a test run for regression. Specify mining data and the input model to be used by the mining run to test the model.
Method syntax
>>-regTestTask..DM_defRegTestTask--(--miningData--,--tableName--,--> >--colNameModel--,--colNameID--,--modelName--)-----------------><
Function syntax
>>-DM_defRegBldTask--(--regTestTask--,--miningData--,--tableName--,--> >--colNameModel--,--colNameID--,--modelName--)-----------------><
The DM_defRegTestTask method constructs a value of type DM_RegTestTask with the given DM_MiningData and the database location of the input model. If DM_defRegTestTask is called on an existing DM_RegTestTask value, content is overwritten.
This method returns a DM_RuleBldTask value determined by both a specified DM_MiningData value and a specified DM_RuleSettings value.
Method syntax
>>-DM_RuleBldTask()..DM_defRuleBldTask--(--trainData--,--settings--)-><
Function syntax
>>-DM_defRuleBldTask--(--DM_RuleBldTask()--,--trainData--,--settings--)-><
The DM_defRuleBldTask method constructs a value of type DM_RuleBldTask with the given DM_MiningData and DM_RuleSettings values. If DM_defRuleBldTask is called on an existing DM_RuleBldTask value, content is overwritten.
This method converts a value of type DM_ClasSettings to a CLOB value, and returns it. Export functions are helpful when you want to store values in an external media, for example, as a backup.
Method syntax
>>-settings..DM_expClasSettings--(--)--------------------------><
Function syntax
>>-DM_expClasSettings--(--settings--)--------------------------><
The return value is a CLOB value converted from settings.
This method converts a value of type DM_ClasBldTask to a CLOB value, and returns it. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-task..DM_expClasTask--(--)----------------------------------><
Function syntax
>>-DM_expClasTask--(--task--)----------------------------------><
The return value is a CLOB value converted from task.
This method converts a value of type DM_ClasTestTask to a CLOB value, and returns it. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-task..DM_expClasTestTask--(--)------------------------------><
Function syntax
>>-DM_expClasTestTask--(--task--)------------------------------><
The return value is a CLOB value converted from task.
This method converts a value of type DM_ClusSettings to a CLOB value, and returns it. Export functions are helpful when you want to store values in an external media, for example, as a backup.
Method syntax
>>-settings..DM_expClusSettings--(--)--------------------------><
Function syntax
>>-DM_expClusSettings--(--settings--)--------------------------><
The return value is a CLOB value converted from settings.
This method converts a value of type DM_ClusBldTask to a CLOB value, and returns it. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-task..DM_expClusTask--(--)----------------------------------><
Function syntax
>>-DM_expClusTask--(--task--)----------------------------------><
The return value is a CLOB value converted from task.
This method converts a value of type DM_LogicalDataSpec to a CLOB value, and returns it. Export functions are helpful when you want to store values in an external media, for example, as a backup.
Method syntax
>>-fields..DM_expDataSpec--(--)--------------------------------><
Function syntax
>>-DM_expDataSpec--(--fields--)--------------------------------><
The return value is a CLOB value converted from fields.
This method exports the DM_MiningData value as a CLOB value. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-miningData..DM_expMiningData--(--)--------------------------><
Function syntax
>>-DM_expMiningData--(--miningData--)--------------------------><
The return value is the content of the DM_MiningData value as a CLOB value.
Method syntax
>>-regSettings..DM_expRegSettings--(--)------------------------><
Function syntax
>>-DM_expRegSettings--(--regSettings--)------------------------><
The content of DM_RegSettings value is returned as a CLOB value.
This method converts a value of type DM_RegBldTask or DM_RegTestTask to a CLOB value and returns it.
Method syntax
>>-task..DM_expRegTask--(--)-----------------------------------><
Function syntax
>>-DM_expRegTask--(--task--)-----------------------------------><
A CLOB value converted from task is returned.
This method converts a value of type DM_RegTestTask to a CLOB value, and returns it. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-task..DM_expRegTestTask--(--)-------------------------------><
Function syntax
>>-DM_expRegTestTask--(--task--)-------------------------------><
The return value is a CLOB value converted from task.
This method converts a value of type DM_RuleSettings to a CLOB value, and returns it. Export functions are helpful when you want to store values in an external media, for example, as a backup.
Method syntax
>>-settings..DM_expRuleSettings--(--)--------------------------><
Function syntax
>>-DM_expRuleSettings--(--settings--)--------------------------><
The return value is a CLOB value converted from settings.
This method converts a value of type DM_RuleBldTask to a CLOB value, and returns it. Use this method if you want to pass the value as a CLOB value to a stored procedure.
Method syntax
>>-task..DM_expRuleTask--(--)----------------------------------><
Function syntax
>>-DM_expRuleTask--(--task--)----------------------------------><
The return value is a CLOB value converted from task.
This method generates a value of type DM_LogicalDataSpec from the field definitions contained in a value of DM_MiningData.
Method syntax
>>-miningData..DM_genDataSpec--(--)----------------------------><
Function syntax
>>-DM_genDataSpec--(--miningData--)----------------------------><
This method returns the cost of predicting a specific class label value for a specific actual class label value. Repeated calls of this method can be used to retrieve a cost matrix from a classification settings value.
Method syntax
>>-clasSettings..DM_getClasCost--(--actualClass--,--predictedClass--)-><
Function syntax
>>-DM_getClasCost--(--clasSettings--,--actualClass--,--predictedClass--)-><
The result of the invocation DM_getClasCost (actualClass, predictedClass) is determined as follows:
An example:
CREATE METHOD DM_getClasCost (actualClass CHARACTER VARYING (256) predictedClass CHARACTER VARYING(256)) RETURNS DOUBLE PRECISION FOR DM_ClasSettings BEGIN -- -- END
Another example: The following example first creates the DM_ClasSettings object (TreClaHrtCM) and stores it in IDMMX.ClasSettings. Later on DM_getClasCost is called on this persistent object.
INSERT INTO IDMMX.ClasSettings (ID, SETTINGS)
WITH MyData (MyDataCol) AS (VALUES(
IDMMX.DM_MiningData()
..DM_defMiningData('HEART')
))
SELECT 'TreClaHrtCM',
IDMMX.DM_ClasSettings()
..DM_useClasDataSpec(MyDataCol
..DM_genDataSpec()
)
..DM_setClasTarget('DISEASED')
..DM_setClasCost('2', '1', 5.0)
FROM MyData;
WITH MySettings (MySettingsCol) AS
(SELECT SETTINGS FROM IDMMX.ClasSettings where ID='TreClaHrtCM')
SELECT
MySettingsCol..DM_getClasCost('2', '1')
FROM MySettings;
Method syntax
>>-clasSettings..DM_getClasCostRate--(--clasSettings--)--------><
Function syntax
>>-DM_getClasCostRate--(--clasSettings--)----------------------><
Method syntax
>>-clasSettings..DM_getClasDataSpec--(--)----------------------><
Function syntax
>>-DM_getClasDataSpec--(--clasSettings--)----------------------><
This method returns the model column name defined in a DM_ClasTestTask value. The column must be of the type DM_ClasModel; it contains a Classification model that you want to validate in a test run.
Method syntax
>>-clasTestTask..DM_getClasMdlCol--(--)------------------------><
Function syntax
>>-DM_getClasMdlCol--(--clasTestTask--)------------------------><
This method returns the model name defined in a DM_ClasTestTask value. The model name is used to identify in a table the Classification model that you want to validate in a test run. The name refers to the modelName value found in the modelId column in the table containing the model.
Method syntax
>>-clasTestTask..DM_getClasMdlID--(--)-------------------------><
Function syntax
>>-DM_getClasMdlID--(--clasTestTask--)-------------------------><
This method returns the column name containing the name of a Classification model defined in a DM_ClasTestTask value. The column name, together with the model name, is used to identify in a table the Classification model that you want to validate in a test run.
Method syntax
>>-clasTestTask..DM_getClasMdlIDCol--(--)----------------------><
Function syntax
>>-DM_getClasMdlIDCol--(--clasTestTask--)----------------------><
This method returns the name of the table defined in a DM_ClasTestTask value. The table contains the Classification model that is validated in a Classification test run.
Method syntax
>>-clasTestTask..DM_getClasMdlTab--(--)------------------------><
Function syntax
>>-DM_getClasMdlTab--(--clasTestTask--)------------------------><
This method returns a value of type DM_ClasSettings representing the settings for a DM_ClasBldTask value.
Method syntax
>>-clasTask..DM_getClasSettings--(--)--------------------------><
Function syntax
>>-DM_getClasSettings--(--clasTask--)--------------------------><
Method syntax
>>-clasSettings..DM_getClasTarget--(--clasSettings--)----------><
Function syntax
>>-DM_getClasTarget--(--clasSettings--)------------------------><
Method syntax
>>-clasTestTask..DM_getClasTestData--(--)----------------------><
Function syntax
>>-DM_getClasTestData--(--clasTestTask--)----------------------><
This method returns a value of type DM_MiningData representing the training data for a DM_ClasBldTask value.
Method syntax
>>-clasTask..DM_getClasTrnData--(--)---------------------------><
Function syntax
>>-DM_getClasTrnData--(--clasTask--)---------------------------><
This method returns a value of type DM_MiningData representing the validation data for a DM_ClasBldTask value.
Method syntax
>>-clasTask..DM_getClasValData--(--)---------------------------><
Function syntax
>>-DM_getClasValData--(--clasTask--)---------------------------><
Method syntax
>>-clusSettings..DM_getClusDataSpec--(--)----------------------><
Function syntax
>>-DM_getClusDataSpec--(--clusSettings--)----------------------><
This method returns a value of type DM_ClusSettings representing the settings in a DM_ClusBldTask value.
Method syntax
>>-clusTask..DM_getClusSettings--(--)--------------------------><
Function syntax
>>-DM_getClusSettings--(--clusTask--)--------------------------><
This method returns a value of type DM_MiningData representing the training data in a DM_ClusBldTask value.
Method syntax
>>-clusTask..DM_getClusTrnData--(--)---------------------------><
Function syntax
>>-DM_getClusTrnData--(--clusTask--)---------------------------><
This method returns the name of a column at a specified position in a value of type DM_MiningData.
Method syntax
>>-miningData..DM_getColumnName--(--position--)----------------><
Function syntax
>>-DM_getColumnName--(--miningData--,--position--)-------------><
This method returns the name of an item at a specified position in the list of item constraints in a DM_RuleSettings value.
Method syntax
>>-ruleSettings..DM_getConItem--(--position--)-----------------><
Function syntax
>>-DM_getConItem--(--ruleSettings--,--position--)--------------><
This method returns the constraint type for mining association rules contained in a DM_RuleSettings value.
Method syntax
>>-ruleSettings..DM_getConType--(--)---------------------------><
Function syntax
>>-DM_getConType--(--ruleSettings--)---------------------------><
For information about the possible values that are returned, see DM_setConType.
This method returns the column name for the column containing the actual value of the cost matrix in the DM_ClasSettings value.
Method syntax
>>-clasSettings..DM_getCostMatAV--(--)-------------------------><
Function syntax
>>-DM_getCostMatAV--(--clasSettings--)-------------------------><
This method returns the column name for the column containing the predicted value of the cost matrix in a DM_ClasSettings value.
Method syntax
>>-clasSettings..DM_getCostMatPV--(--)-------------------------><
Function syntax
>>-DM_getCostMatPV--(--clasSettings--)-------------------------><
Method syntax
>>-clasSettings..DM_getCostMatTab--(--)------------------------><
Function syntax
>>-DM_getCostMatTab--(--clasSettings--)------------------------><
This method returns the column name for the column containing the weight value of the cost matrix in a DM_ClasSettings value.
Method syntax
>>-clasSettings..DM_getCostMatWGT--(--)------------------------><
Function syntax
>>-DM_getCostMatWGT--(--clasSettings--)------------------------><
This method gets, from a DM_ClusSettings value, the value of a settings parameter for a specified field that is specific to the Distribution-based Clustering algorithm.
Use the input parameter to the method to specify the particular field from which the settings parameter value is returned.
Method syntax
>>-clusSettings..DM_getDClusFldPar--(--fieldname--,--keyword--)-><
Function syntax
>>-DM_getDClusFldPar--(--clusSettings--,--fieldname--,--keyword--)-><
Permitted value for keyword: ValueWeighting.
This method gets, from a DM_ClusSettings value, the value of a settings parameter that is specific to the Distribution-based Clustering algorithm.
Use the method's input parameter to specify the particular settings parameter whose value is returned.
Method syntax
>>-clusSettings..DM_getDClusPar--(--keyword--)-----------------><
Function syntax
>>-DM_getDClusPar--(--clusSettings--,--keyword--)--------------><
Permitted value for keyword: SimThr.
Method syntax
>>-task..DM_getErrorTab--(--)----------------------------------><
Function syntax
>>-DM_getErrorTab--(--task--)----------------------------------><
The return value is a value of type VARCHAR.
The return value is determined by checking the following conditions in the given sequence:
This method returns the maximum execution time (in minutes) from a DM_ClusSettings value or a DM_RegSettings value.
Method syntax
>>-settings..DM_getExecTime--(--)------------------------------><
Function syntax
>>-DM_getExecTime--(--settings--)------------------------------><
This method returns the alias name of a column in a value of type DM_MiningData.
Method syntax
>>-miningData..DM_getFldAlias--(--columnName--)----------------><
Function syntax
>>-DM_getFldAlias--(--miningData--,--columnName--)-------------><
This method returns the name of a field at a specified position in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getFldName--(--position--)-----------------------><
Function syntax
>>-DM_getFldName--(--fields--,--position--)--------------------><
The value of position must be greater than zero, and less than or equal to the result of a call of DM_getNumFields.
The return value is a VARCHAR value.This method returns the name of a name mapping that is linked to a specified field contained in a DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getFldNmp--(--fieldName--)-----------------------><
Function syntax
>>-DM_getFldNmp--(--fields--,--fieldName--)--------------------><
This method returns the lower limit value of a numerical field contained in a DM_LogicalDataSpec value to be used for outlier treatment.
Method syntax
>>-fields..DM_getFldOutlLimLo--(--fieldName--)-----------------><
Function syntax
>>-DM_getFldOutlLimLo--(--fields--,--fieldName--)--------------><
This method returns the upper limit value of a numerical field contained in a DM_LogicalDataSpec value to be used for outlier treatment.
Method syntax
>>-fields..DM_getFldOutlLimUp--(--fieldName--)-----------------><
Function syntax
>>-DM_getFldOutlLimUp--(--fields--,--fieldName--)--------------><
This method returns the outlier treatment for a specified field contained in a DM_ClusSettings value.
Method syntax
>>-settings..DM_getFldOutlTreat--(--fieldName--)---------------><
Function syntax
>>-DM_getFldOutlTreat--(--settings--,--fieldName--)------------><
If an outlier treatment is set for the specified field, the return value is the outlier treatment as type INTEGER. Valid values for outlierTreatment are:
This method returns the name of the similarity matrix that is linked to a specified field contained in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getFldSimMat--(--fieldName--)--------------><
Function syntax
>>-DM_getFldSimMat--(--clusSettings--,--fieldName--)-----------><
This method returns the similarity scale for a specified field contained in a DM_ClusSettings value.
Similarity scale is a value that influences the calculation of the similarity measurement.
Method syntax
>>-clusSettings..DM_getFldSimScale--(--fieldName--)------------><
Function syntax
>>-DM_getFldSimScale--(--clusSettings--,--fieldName--)---------><
This method returns the name of a taxonomy that is linked to a specified field contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getFldTax--(--fieldName--)-----------------------><
Function syntax
>>-DM_getFldTax--(--fields--,--fieldName--)--------------------><
This method returns the mining field type of a specified field that is contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getFldType--(--fieldName--)----------------------><
Function syntax
>>-DM_getFldType--(--fields--,--fieldName--)-------------------><
This method returns the usage type for a specified field contained in a DM_RuleSettings, DM_ClasSettings, DM_ClusSettings, or DM_RegSettings value.
Method syntax
>>-settings..DM_getFldUsageType--(--fieldName--)---------------><
Function syntax
>>-DM_getFldUsageType--(--settings--,--fieldName--)------------><
Method syntax
>>-clusSettings..DM_getFldWeight--(--fieldName--)--------------><
Function syntax
>>-DM_getFldWeight--(--clusSettings--,--fieldName--)-----------><
Method syntax
>>-ruleSettings..DM_getGroup--(--)-----------------------------><
Function syntax
>>-DM_getGroup--(--ruleSettings--)-----------------------------><
This method returns the name of the field used to identify the items for mining association rules contained in a DM_RuleSettings value.
Method syntax
>>-ruleSettings..DM_getItemFld--(--)---------------------------><
Function syntax
>>-DM_getItemFld--(--ruleSettings--)---------------------------><
Method syntax
>>-ruleSettings..DM_getItemFormat--(--)------------------------><
Function syntax
>>-DM_getItemFormat--(--ruleSettings--)------------------------><
The return value is the active item format as type INTEGER. The default item format is 0. For more information on item format refer to DM_setItemFormat.
Method syntax
>>-ruleSettings..DM_getMaxLen--(--)----------------------------><
Function syntax
>>-DM_getMaxLen--(--ruleSettings--)----------------------------><
Method syntax
>>-clusSettings..DM_getMaxNumClus--(--)------------------------><
Function syntax
>>-DM_getMaxNumClus--(--clusSettings--)------------------------><
Method syntax
>>-ruleSettings..DM_getMinConf--(--)---------------------------><
Function syntax
>>-DM_getMinConf--(--ruleSettings--)---------------------------><
This method returns, from a DM_ClusSettings value, the minimum percentage of data that the Clustering training run must read when the execution time is limited.
Method syntax
>>-clusSettings..DM_getMinData--(--)---------------------------><
Function syntax
>>-DM_getMinData--(--clusSettings--)---------------------------><
Method syntax
>>-ruleSettings..DM_getMinSupport--(--)------------------------><
Function syntax
>>-DM_getMinSupport--(--ruleSettings--)------------------------><
This method returns the name of the column that contains the mapped name in a name mapping that is contained in a DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getNmpMapValCol--(--nameMapping--)---------------><
Function syntax
>>-DM_getNmpMapValCol--(--fields--,--nameMapping--)------------><
This method returns the name of a name mapping in a value of type DM_LogicalDataSpec at the specified position.
Method syntax
>>-fields..DM_getNmpName--(--position--)-----------------------><
Function syntax
>>-DM_getNmpName--(--fields--,--position--)--------------------><
Method syntax
>>-fields..DM_getNmpTabName--(--nameMapping--)-----------------><
Function syntax
>>-DM_getNmpTabName--(--fields--,--nameMapping--)--------------><
This method returns the column name of the data value of a name mapping contained in a DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getNmpValCol--(--nameMapping--)------------------><
Function syntax
>>-DM_getNmpValCol--(--fields--,--nameMapping--)---------------><
This method returns the number of columns that are contained in a DM_MiningData value.
Method syntax
>>-miningData..DM_getNumColumns--(--)--------------------------><
Function syntax
>>-DM_getNumColumns--(--miningData--)--------------------------><
The return value is the number of columns that are contained in miningData, as type INTEGER.
This method returns the number of items contained in the list of item constrains in the DM_RuleSettings value.
Method syntax
>>-ruleSettings..DM_getNumConItem--(--)------------------------><
Function syntax
>>-DM_getNumConItem--(--ruleSettings--)------------------------><
The return value is the number of items contained in the list of item constrains in the DM_RuleSettings value, as type INTEGER.
Method syntax
>>-fields..DM_getNumFields--(--)-------------------------------><
Function syntax
>>-DM_getNumFields--(--fields--)-------------------------------><
The return value is the number of fields that are contained in fields, as type INTEGER.
This method returns the number of name mappings that are contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getNumNmp--(--)----------------------------------><
Function syntax
>>-DM_getNumNmp--(--fields--)----------------------------------><
The return value is the number of name mappings that are contained in fields, as type INTEGER.
Method syntax
>>-clusSettings..DM_getNumSimMat--(--)-------------------------><
Function syntax
>>-DM_getNumSimMat--(--clusSettings--)-------------------------><
The return value is the number of similarity matrices, as an INTEGER value.
This method returns the number of taxonomies that are contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getNumTax--(--)----------------------------------><
Function syntax
>>-DM_getNumTax--(--fields--)----------------------------------><
The return value is the number of taxonomies that are contained in fields, as type INTEGER.
This method returns the number of category maps that belong to a specified taxonomy contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-Fields..DM_getNumTaxMap--(--taxName--)----------------------><
Function syntax
>>-DM_getNumTaxMap--(--fields--,--taxName--)-------------------><
Method syntax
>>-settings..DM_getPowerOptions--(--)--------------------------><
Function syntax
>>-DM_getPowerOptions--(--settings--)--------------------------><
Method syntax
>>-task..DM_getProgTab--(--)-----------------------------------><
Function syntax
>>-DM_getProgTab--(--task--)-----------------------------------><
The return value is a value of type VARCHAR.
The return value is determined by checking the following conditions in the given sequence:
Method syntax
>>-regSettings..DM_getRegDataSpec--(--)------------------------><
Function syntax
>>-DM_getRegDataSpec--(--regSettings--)------------------------><
Method syntax
>>-regTestTask..DM_getRegMdlCol--(--)--------------------------><
Function syntax
>>-DM_getRegMdlCol--(--regTestTask--)--------------------------><
This method returns the model name of the input model. This name refers to the modelName found in the modelId column in the table containing the model.
Method syntax
>>-regTestTask..DM_getRegMdlID--(--)---------------------------><
Function syntax
>>-DM_getRegMdlID--(--regTestTask--)---------------------------><
Method syntax
>>-regTestTask..DM_getRegMdlIDCol--(--)------------------------><
Function syntax
>>-DM_getRegMdlIDCol--(--regTestTask--)------------------------><
Method syntax
>>-regTestTask..DM_getRegMdlTab--(--)--------------------------><
Function syntax
>>-DM_getRegMdlTab--(--regTestTask--)--------------------------><
This method returns the maximum tolerated squared Pearson correlation coefficient r2 (with 0 <= r2 <= 1) between the prediction error on verification data and the actual target values.
Method syntax
>>-regSettings..DM_getRegRSquared--(--)------------------------><
Function syntax
>>-DM_getRegRSquared--(--regSettings--)------------------------><
This method returns the value of type DM_RegSettings representing the settings of a regression task.
Method syntax
>>-regBldTask..DM_getRegSettings--(--)-------------------------><
Function syntax
>>-DM_getRegSettings--(--regBldTask--)-------------------------><
This method specifies the target field for a DM_RegSettings value. The target field is the numerical field whose values are to be predicted.
Method syntax
>>-regSettings..DM_getRegTarget--(--)--------------------------><
Function syntax
>>-DM_getRegTarget--(--regSettings--)--------------------------><
Method syntax
>>-regTestTask..DM_getRegTestData--(--)------------------------><
Function syntax
>>-DM_getRegTestData--(--regTestTask--)------------------------><
This method returns a value of type DM_MiningData representing the training data for the regression build task.
Method syntax
>>-regBldTask..DM_getRegTrnData--(--)--------------------------><
Function syntax
>>-DM_getRegTrnData--(--regBldTask--)--------------------------><
This method returns a value of type DM_MiningData representing the validation data for the regression build task.
Method syntax
>>-regBldTask..DM_getRegValData--(--)--------------------------><
Function syntax
>>-DM_getRegValData--(--regBldTask--)--------------------------><
Method syntax
>>-ruleSettings..DM_getRuleDataSpec--(--)----------------------><
Function syntax
>>-DM_getRuleDataSpec--(--ruleSettings--)----------------------><
This method returns a value of type DM_RuleSettings representing the settings for a DM_RuleBldTask value.
Method syntax
>>-ruleTask..DM_getRuleSettings--(--)--------------------------><
Function syntax
>>-DM_getRuleSettings--(--ruleTask--)--------------------------><
This method returns a value of type DM_MiningData representing the input data for a DM_RuleBldTask value.
Method syntax
>>-ruleTask..DM_getRuleTrnData--(--)---------------------------><
Function syntax
>>-DM_getRuleTrnData--(--ruleTask--)---------------------------><
This method returns the name of the similarity matrix at a specified position in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getSimMatName--(--position--)--------------><
Function syntax
>>-DM_getSimMatName--(--clusSettings--,--position--)-----------><
This method returns the column name for the column containing the similarity value of the similarity matrix for a specified similarity matrix name in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getSimMatSim--(--simMatrixName--)----------><
Function syntax
>>-DM_getSimMatSim--(--clusSettings--,--simMatrixName--)-------><
This method returns the table name containing a specified similarity matrix in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getSimMatTab--(--simMatrixName--)----------><
Function syntax
>>-DM_getSimMatTab--(--clusSettings--,--simMatrixName--)-------><
This method returns the column name for the column containing the first value of the similarity matrix for a specified similarity matrix name in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getSimMatVal1--(--simMatrixName--)---------><
Function syntax
>>-DM_getSimMatVal1--(--clusSettings--,--simMatrixName--)------><
This method returns the column name for the column containing the second value of the similarity matrix for a specified similarity matrix name in a DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_getSimMatVal2--(--simMatrixName--)---------><
Function syntax
>>-DM_getSimMatVal2--(--clusSettings--,--simMatrixName--)------><
This method returns the name of the base table or view, or the nickname specified in a value of type DM_MiningData.
Method syntax
>>- miningData..DM_getTableName--(--)--------------------------><
Function syntax
>>-DM_getTableName--(--miningData--)---------------------------><
This method returns the name of the column that contains the child values of a category map in a taxonomy contained in DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getTaxChildCol--(--taxName--,--position--)-------><
Function syntax
>>-DM_getTaxChildCol--(--fields--,--taxName--,--position--)----><
This method returns the type of a category map of a taxonomy contained in a DM_LogicalDataSpec value. The type specifies whether the category map is recursive or non-recursive.
Method syntax
>>-fields..DM_getTaxMapType--(--taxName--,--position--)--------><
Function syntax
>>-DM_getTaxMapType--(--fields--,--taxName--,--position--)-----><
This method returns the name of a taxonomy at a specified position in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_getTaxName--(--position--)-----------------------><
Function syntax
>>-DM_getTaxName--(--fields--,--position--)--------------------><
This method returns the name of the column that contains the parent values of a category map in a taxonomy contained in DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getTaxParentCol--(--taxName--,--position--)------><
Function syntax
>>-DM_getTaxParentCol--(--fields--,--taxName--,--position--)---><
This method returns the name mapping of the parent values of a category map in a taxonomy contained in DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getTaxParentNmp--(--taxName--,--position--)------><
Function syntax
>>-DM_getTaxParentNmp--(--fields--,--taxName--,--position--)---><
This method returns the table name of a category map of a taxonomy contained in a DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_getTaxTabName--(--taxName--,--position--)--------><
Function syntax
>>-DM_getTaxTabName--(--fields--,--taxName--,--position--)-----><
This method gets the value of a settings parameter that is specific to the Tree Classification algorithm from a DM_ClasSettings value.
Use the method's input parameter to specify the particular settings parameter that the value is returned from.
Method syntax
>>-clasSettings..DM_getTreeClasPar--(--keyword--)--------------><
Function syntax
>>-DM_getTreeClasPar--(--clasSettings--,--keyword--)-----------><
Permitted values for keyword:
For information about the significance of these values, see DM_setTreeClasPar.
Method syntax
>>-miningData..DM_getWhereClause--(--)-------------------------><
Function syntax
>>-DM_getWhereClause--(--miningData--)-------------------------><
This method converts a CLOB value to a value of type DM_ClasSettings.
The CLOB value must be a value that was previously exported by means of the DM_expClasSettings method.
Method syntax
>>-settings..DM_impClasSettings--(--clobSettings--)------------><
Function syntax
>>-DM_impClasSettings--(--settings--,--clobSettings--)---------><
This method converts a CLOB value to a value of type DM_ClasBldTask. The CLOB value must be a value that was previously exported using the DM_expClasTask method.
Method syntax
>>-task..DM_impClasTask--(--clobTask--)------------------------><
Function syntax
>>-DM_impClasTask--(--task--,--clobTask--)---------------------><
This method converts a CLOB value to a value of type DM_ClasTestTask. The CLOB value must be a value that was previously exported using the DM_expClasTestTask method.
Method syntax
>>-task..DM_impClasTestTask--(--clobTask--)--------------------><
Function syntax
>>-DM_impClasTestTask--(--task--,--clobTask--)-----------------><
This method converts a CLOB value to a value of type DM_ClusSettings.
The CLOB value must be a value that was previously exported by means of the DM_expClusSettings method.
Method syntax
>>-settings..DM_impClusSettings--(--clobSettings--)------------><
Function syntax
>>-DM_impClusSettings--(--settings--,--clobSettings--)---------><
This method converts a CLOB value to a value of type DM_ClusBldTask. The CLOB value must be a value that was previously exported using the DM_expClusTask method.
Method syntax
>>-task..DM_impClusTask--(--clobTask--)------------------------><
Function syntax
>>-DM_impClusTask--(--task--,--clobTask--)---------------------><
This method converts a CLOB value to a value of type DM_LogicalDataSpec. The CLOB value must be a value that was previously exported using the DM_expDataSpec method.
Method syntax
>>-fields..DM_impDataSpec--(--logDataSpec--)-------------------><
Function syntax
>>-DM_impDataSpec--(--fields--,--logDataSpec--)----------------><
The return value is fields containing the content of logDataSpec. Any existing definitions in fields are overwritten by the content of logDataSpec.
This method converts a CLOB value to a value of type DM_MiningData. The CLOB value must be a value that was previously exported by means of the DM_expMiningData method or created by means of the DM_defMiningData method.
Method syntax
>>-miningData..DM_impMiningData--(--clobMiningData--)----------><
Function syntax
>>-DM_impMiningData--(--miningData--,--clobMiningData--)-------><
The return value is miningData, of type DM_MiningData, containing the content of clobMiningData. Any existing definitions in miningData are overwritten by the content of clobMiningData.
This method converts a CLOB value to a value of type DM_RegSettings. The CLOB value must be a value that was previously exported using the DM_expRegSettings method.
Method syntax
>>-regSettings..DM_impRegSettings--(--clobRegSettings--)-------><
Function syntax
>>-DM_impRegSettings--(--regSettings--,--clobRegSettings--)----><
This function returns regSettings containing the content of clobRegSettings. Any existing definitions in regSettings are overwritten by the content of clobRegSettings.
Method syntax
>>-regBldTask..DM_impRegTask--(--clobRegBldTask--)-------------><
Function syntax
>>-DM_impRegTask--(--regBldTask--,--clobRegBldTask--)----------><
regBldtask containing the content of clobRegBldTask. Any existing definitions in regBldtask are overwritten by the content of clobRegBldTask.
This method converts a CLOB value to a value of type DM_RegTestTask. The CLOB value must be a value that was previously exported using the DM_impRegTestTask method.
Method syntax
>>-task..DM_impRegTestTask--(--clobTask--)---------------------><
Function syntax
>>-DM_impRegTestTask--(--task--,--clobTask--)------------------><
This method converts a CLOB value to a value of type DM_RuleSettings.
The CLOB value must be a value that was previously exported by means of the DM_expRuleSettings method.
Method syntax
>>-settings..DM_impRuleSettings--(--clobSettings--)------------><
Function syntax
>>-DM_impRuleSettings--(--settings--,--clobSettings--)---------><
This method converts a CLOB value to a value of type DM_RuleBldTask. The CLOB value must be a value that was previously exported using the DM_expRuleTask method.
Method syntax
>>-task..DM_impRuleTask--(--clobTask--)------------------------><
Function syntax
>>-DM_impRuleTask--(--task--,--clobTask--)---------------------><
This method determines whether a DM_LogicalDataSpec value is compatible with another DM_LogicalDataSpec value. It compares two logical data specifications, and returns TRUE if they are compatible. It can be used to check whether a certain table with test data provides valid input for a certain model.
Method syntax
>>-existLogDataSpec..DM_isCompatible--(--logDataSpec--)--------><
Function syntax
>>-DM_isCompatible--(--existLogDataSpec--,--logDataSpec--)-----><
Note that calls to DM_isCompatible are not symmetric. A call DM_isCompatible(A,B) can return a result different from that returned by DM_isCompatible(B,A).
Method syntax
>>-ruleSettings..DM_remConItem--(--item--)---------------------><
Function syntax
>>-DM_remConItem--(--ruleSettings--,--item--)------------------><
Method syntax
>>-fields..DM_remDataSpecFld--(--fieldName--)------------------><
Function syntax
>>-DM_remDataSpecFld--(--fields--,--fieldName--)---------------><
This method removes the name mapping with the specified name from the fields contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_remNmp--(--name--)-------------------------------><
Function syntax
>>-DM_remNmp--(--fields--,--name--)----------------------------><
Method syntax
>>-clusSettings..DM_remSimMat--(--simMatrixName--)-------------><
Function syntax
>>-DM_remSimMat--(--clusSettings--,--simMatrixName--)----------><
This method removes the taxonomy with the specified name from the fields contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_remTax--(--taxName--)----------------------------><
Function syntax
>>-DM_remTax--(--fields--,--taxName--)-------------------------><
This method removes the category map identified by the specified position from the taxonomy contained in a DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_remTaxMap--(--taxName--,--position--)------------><
Function syntax
>>-DM_remTaxMap--(--fields--,--taxName--,--position--)---------><
This method returns a specified value of type DM_ClasSettings. Repeated calls are used to specify a cost matrix for a classification training run by providing individual cost values.
--------------------------------------------------------- setClasCost(A,B,2.0) setCostMat(COSTTAB, ...) // contains A,B,3 and A,C,5 => ERROR getClasCost(A,B) = 2.0 getClasCost(A,C) = 1.0 // the default value getCostMatTab() = NULL --------------------------------------------------------- setClasCostMat(COSTTAB, ...) // contains A,B,3 and A,C,5 getClasCost(A,B) => ERROR setClasCost(A,C,3.0) => ERROR getClasCost(A,D) => ERROR getCostMatTab() = COSTTAB ---------------------------------------------------------
Method syntax
>>-clasSettings..DM_setClasCost--(--actualClass--,--predictedClass--,--cost--)-><
Function syntax
>>-DM_setClasCost--(--clasSettings--,--actualClass--,--predictedClass--,--cost--)-><
The result of the invocation DM_setClasCost is determined as follows:
An example is:
CREATE METHOD DM_setClasCost (actualClass CHARACTER VARYING(256) predictedClass CHARACTER VARYING(256) cost DOUBLE PRECISION) RETURNS DM_ClasSettings FOR DM_ClasSettings BEGIN -- -- END
This method sets the cost rate value for a training run in a value of DM_ClasSettings.
The cost rate value specifies the percentage of incorrect predictions that can be tolerated in a Classification training run on validation data.
Method syntax
>>-clasSettings..DM_setClasCostRate--(--percentage--)----------><
Function syntax
>>-DM_setClasCostRate--(--clasSettings--,--percentage--)-------><
Method syntax
>>-clasSettings..DM_setClasTarget--(--targetField--)-----------><
Function syntax
>>-DM_setClasTarget--(--clasSettings--,--targetField--)--------><
This method defines a DM_MiningData value consisting of the names of the source table columns. The column names are specified in an input XML string.
Method syntax
>>-miningData..DM_setColumns--(--columns--)--------------------><
Function syntax
>>-DM_setColumns--(--miningData--,--columns--)-----------------><
<!ELEMENT Column EMPTY>
<!ATTLIST Column
alias CDATA#IMPLIED
name CDATA#REQUIRED
sqlType CDATA#IMPLIED>
If the column name contains any of the characters ' " < > &, each character must be specified in the XML string using its escape string. The escape strings are as follows:
' = ' " = " < = < > = > & = &The following SQL types are supported as the sqlType attribute in the XML string:
You can specify the XML string directly if you know the column names and column types.
This method specifies, in a DM_RuleSettings value, the constraint type for mining association rules.
Method syntax
>>-ruleSettings..DM_setConType--(--type--)---------------------><
Function syntax
>>-DM_setConType--(--ruleSettings--,--type--)------------------><
Valid values for type:
This method defines a cost matrix for the target field in a DM_ClasSettings value.
The cost matrix is a reference to a table. The table contains the values to be used for the training runs. These values must be greater than or equal to zero. Since the cost matrix contains misclassification weights, these weights should be zero for the matrix diagonal.
The table is not read when this method is called. During the training run it is checked whether the table exists and the values are read from the table.
Method syntax
>>-clasSettings..DM_setCostMat--(--tableName--,--colNameActualValue--,--> >--colNamePredValue--,--colNameWeight--)-----------------------><
Function syntax
>>-DM_setCostMat--(--clasSettings--,--tableName--,--colNameActualValue--,--> >--colNamePredValue--,--colNameWeight--)-----------------------><
This method defines settings parameters that are specific to the Distribution-based Clustering algorithm for a specified field in a DM_ClusSettings value.
Use the method's keyword parameter to specify the particular settings parameter that is set by the call to DM_setDClusPar.
Method syntax
>>-clusSettings..DM_setDClusFldPar--(--fieldname--,--keyword--,--> >--keyword value--)--------------------------------------------><
Function syntax
>>-DM_setDClusFldPar--(--clusSettings--,--fieldname--,--keyword--,--> >--keyword value--)--------------------------------------------><
Permitted values for keyword and keyword value are:
Permitted values for keyword value are:
This method sets, in a DM_ClusSettings value, settings parameters that are specific to the Distribution-based Clustering algorithm.
Use the method's first parameter to specify the particular settings parameter that is set by the call to DM_setDClusPar.
Method syntax
>>-clusSettings..DM_setDClusPar--(--keyword--,--keyword value--)-><
Function syntax
>>-DM_setDClusPar--(--clusSettings--,--keyword--,--keyword value--)-><
Permitted values for keyword and keyword value are:
Method syntax
>>-task..DM_setErrorTab--(--errorTableName--)------------------><
Function syntax
>>-DM_setErrorTab--(--task--,--errorTableName--)---------------><
The return value of type task is determined by checking the following conditions in the given sequence:
This method sets the execution time for a:
Method syntax
>>-settings..DM_setExecTime--(--duration--)--------------------><
Function syntax
>>-DM_setExecTime--(--settings--,--duration--)-----------------><
Method syntax
>>-miningData..DM_setFldAlias--(--dataFieldName--,--aliasName--)-><
Function syntax
>>-DM_setFldAlias--(--miningData--,--dataFieldName--,--aliasName--)-><
This method makes a name mapping that exists in a DM_LogicalDataSpec value active by linking it to a field contained in the DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_setFldNmp--(--fieldName--,--nameMapping--)-------><
Function syntax
>>-DM_setFldNmp--(--fields--,--fieldName--,--nameMapping--)----><
This method sets outlier limits for the specified field contained in a DM_LogicalDataSpec value. All values that fall outside of this range are treated as outliers. This applies only to numerical fields.
Method syntax
>>-fields..DM_setFldOutlLim--(--fieldName--,--lower--,--upper--)-><
Function syntax
>>-DM_setFldOutlLim--(--fields--,--fieldName--,--lower--,--upper--)-><
numVal = DOUBLE(DAYS(dateVal)) dateVal = DATE(INTEGER(numVal))
numVal = DOUBLE(MIDNIGHT_SECONDS(timeVal)) timeVal = TIME('00:00:00') + INTEGER(numVal) SECONDS
numVal = DOUBLE( DAYS(stampVal) ) + DOUBLE( MIDNIGHT_SECONDS(stampVal) + DOUBLE(MICROSECOND(stampVal)) / 1000000 ) / 86400 stampVal = TIMESTAMP(DATE(INTEGER(numVal)), TIME('00:00:00')) + (numVal-INTEGER(numVal))*86400000000 MICROSECONDS
Method syntax
>>-clusSettings..DM_setFldOutlTreat--(--fieldName--,--outlierTreatment--)-><
Function syntax
>>-DM_setFldOutlTreat--(--clusSettings--,--fieldName--,--outlierTreatment--)-><
Valid values for outlierTreatment:
This method makes a similarity matrix contained in a DM_ClusSettings value active. It does this by linking the name of the similarity matrix with a field contained in the DM_ClusSettings value.
Method syntax
>>-clusSettings..DM_setFldSimMat--(--fieldName--,--simMatrixName--)-><
Function syntax
>>-DM_setFldSimMat--(--clusSettings--,--fieldName--,--simMatrixName--)-><
This method sets the similarity scale for a specified field in a DM_ClusSettings value.
Similarity scale is a value that influences the calculation of the similarity measurement.
Method syntax
>>-clusSettings..DM_setFldSimScale--(--fieldName--,--similarityScale--)-><
Function syntax
>>-DM_setFldSimScale--(--clusSettings--,--fieldName--,--similarityScale--)-><
This method makes a taxonomy that exists in a DM_LogicalDataSpec value active by linking it to a specified field contained in the DM_LogicalDataSpec value.
Method syntax
>>-fields..DM_setFldTax--(--fieldName--,--taxonomy--)----------><
Function syntax
>>-DM_setFldTax--(--fields--,--fieldName--,--taxonomy--)-------><
This method sets the mining field type of a specified field that is already contained in a value of type DM_LogicalDataSpec.
Method syntax
>>-fields..DM_setFldType--(--fieldName--,--miningType--)-------><
Function syntax
>>-DM_setFldType--(--fields--,--fieldName--,--miningType--)----><
This method sets the usage type for the specified field or all fields in a value of type settings.
You can set the usage type for all fields at once. This is useful, for example, if you want to set all fields to usage type active to prevent automatic field usage type determination. For more information refer to Autonomic variable selection.
If you specify DM_setFldUsageType(usageType), the usage type usageType is assigned to all fields.
Method syntax
>>-settings..DM_setFldUsageType--(--+--------------+--usageType--)->< '-fieldname--,-'
Function syntax
>>-DM_setFldUsageType--(--settings--,--+--------------+--usageType--)->< '-fieldname--,-'
Valid values for usageType:
Supplementary (Clustering): The field is not taken into account when the clusters are determined. Nevertheless, the statistical information for this field on those clusters is collected and written into the model.
The routines of the autonomic variable selection check if the fields do not have a usage type and suggest to the kernel whether the field should be used or not. For example, obvious key fields, degenerated fields (only a single value), or unusable fields (all records have missing values for it) should be dropped.
Expert miners know which fields to use and set all the respective fields to active. If you are new to data mining, you can specify that fields do not have a usage type and let the routines of the autonomic variable selection check these fields. In most cases, users might have a number of fields which they want to use because from the business context they know their importance, but are not sure about others. They can use the routines of the autonomic variable selection.
In general, the autonomic variable selection:
The resulting models are rather simple and robust, and provide a quick overview.
Method syntax
>>-clusSettings..DM_setFldWeight--(--fieldName--,--fieldWeight--)-><
Function syntax
>>-DM_setFldWeight--(--clusSettings--,--fieldName--,--fieldWeight--)-><
This method specifies, in a DM_RuleSettings value, the field used to identify the group (for example, a purchase group) for mining association rules.
Method syntax
>>-ruleSettings..DM_setGroup--(--groupField--)-----------------><
Function syntax
>>-DM_setGroup--(--ruleSettings--,--groupField--)--------------><
This method explicitly specifies, in a DM_RuleSettings value, the field used to identify the items for mining associations rules.
Method syntax
>>-ruleSettings..DM_setItemFld--(--itemfield--)----------------><
Function syntax
>>-DM_setItemFld--(--ruleSettings--,--itemfield--)-------------><
This method defines how the item names are built from the field value and the field name. This method specifies the table layout that is used for the input data in a DM_RuleSettings value. The method acts on all input fields except of the field that was defined as group ID by the method DM_setGroup.
Method syntax
>>-DM_RuleSettings..DM_setItemFormat--(--itemFormat--)---------><
Function syntax
>>-DM_setItemFormat--(--itemFormat--)--------------------------><
If itemFormat is:
This method sets the maximum rule length in a DM_RuleSettings value.
The maximum rule length determines the number of items in the rule, including the rule head.
Method syntax
>>-ruleSettings..DM_setMaxLen--(--maxRuleLen--)----------------><
Function syntax
>>-DM_setMaxLen--(--ruleSettings--,--maxRuleLen--)-------------><
This method sets, in the DM_ClusSettings value, the maximum number of clusters to be created during a training run.
Method syntax
>>-clusSettings..DM_setMaxNumClus--(--number--)----------------><
Function syntax
>>-DM_setMaxNumClus--(--clusSettings--,--number--)-------------><
Method syntax
>>-ruleSettings..DM_setMinConf--(--minConfidence--)------------><
Function syntax
>>-DM_setMinConf--(--ruleSettings--,--minConfidence--)---------><
This method sets the minimum percentage of data that a Clustering training run must read in a DM_ClusSettings value. This parameter is considered only if the execution time is limited. If the execution time is not limited, the data is always processed in full. To set the execution time, use the method DM_setExecTime.
Method syntax
>>-clusSettings..DM_setMinData--(--percentage--)---------------><
Function syntax
>>-DM_setMinData--(--clusSettings--,--percentage--)------------><
Method syntax
>>-ruleSettings..DM_setMinSupport--(--minSupport--)------------><
Function syntax
>>-DM_setMinSupport--(--ruleSettings--,--minSupport--)---------><
This method sets power options to be used for a training run. If you want to specify more than one option, concatenate the options.
Method syntax
>>-settings..DM_setPowerOptions--(--powerOption--)-------------><
Function syntax
>>-DM_setPowerOptions--(--settings--,--powerOption--)----------><
You can specify for example:
DM_setPowerOptions('-buf 256 -IDM_WORKING_DIRECTORY /tmp/MiningRuns')
A check is not made as to whether the power options are valid. If the mining algorithm knows the power options, they are used during the training run.
Method syntax
>>-task..DM_setProgTab--(--progressTableName--)----------------><
Function syntax
>>-DM_setProgTab--(--task--,--progressTableName--)-------------><
The return value is a value of type task.
The return value is determined by a check of the following conditions in the given sequence:
This method sets the maximum tolerated squared Pearson correlation coefficient r2 (with 0 <= r2 <= 1) between the prediction error on verification data and the actual target values. Note: r2=0 means that the prediction error and the target field values are uncorrelated, r2=1 means that the two values are perfectly (positively or negatively) correlated. Therefore, setting an upper threshold for r2 means setting an upper limit for the acceptable systematic error of the model.
Method syntax
>>-regSettings..DM_setRegRSquared--(--rSquared--)--------------><
Function syntax
>>-DM_setRegRSquared--(--regSettings--,--rSquared--)-----------><
This method specifies the target field for a DM_RegSettings value. The target field is the field whose values are to be predicted.
Method syntax
>>-regSettings..DM_setRegTarget--(--targetField--)-------------><
Function syntax
>>-DM_setRegTarget--(--regSettings--,--targetField--)----------><
This method defines settings parameters that are specific to the Tree Classification algorithm in a DM_ClasSettings value.
Use the method's first parameter to specify the particular settings parameter that is set by the call to DM_setTreeClasPar.
Method syntax
>>-clasSettings..DM_setTreeClasPar--(--keyword--,--keyword value--)-><
Function syntax
>>-DM_setTreeClasPar--(--clasSettings--,--keyword--,--keyword value--)-><
Permitted values for keyword and keyword value are:
Method syntax
>>-miningData..DM_setWhereClause--(--whereClause--)------------><
Function syntax
>>-DM_setWhereClause--(--miningData--,--whereClause--)---------><
This method specifies a DM_LogicalDataSpec value for a DM_ClasSettings value.
The DM_LogicalDataSpec value determines the valid input data of type DM_MiningData that can be processed in a training run.
Method syntax
>>-clasSettings..DM_useClasDataSpec--(--dataSpec--)------------><
Function syntax
>>-DM_useClasDataSpec--(--clasSettings--,--dataSpec--)---------><
This method specifies a DM_LogicalDataSpec value for the DM_ClusSettings value. The DM_LogicalDataSpec value determines the valid DM_MiningData values that can be processed in a training run.
Method syntax
>>-clusSettings..DM_useClusDataSpec--(--logDataSpec--)---------><
Function syntax
>>-DM_useClusDataSpec--(--clusSettings--,--logDataSpec--)------><
This method specifies a DM_LogicalDataSpec value for a DM_RegSettings value. The DM_LogicalDataSpec value determines valid input data of type DM_MiningData which can be processed in a training run.
Method syntax
>>-regSettings..DM_useRegDataSpec--(--dataSpec--)--------------><
Function syntax
>>-DM_useRegDataSpec--(--regSettings--,--dataSpec--)-----------><
This method specifies a DM_LogicalDataSpec value for a DM_RuleSettings value. The DM_LogicalDataSpec value determines the valid input data of type DM_MiningData that can be processed in a training run.
Method syntax
>>-ruleSettings..DM_useRuleDataSpec--(--dataSpec--)------------><
Function syntax
>>-DM_useRuleDataSpec--(--ruleSettings--,--dataSpec--)---------><
This chapter contains full descriptions of all the functions provided with IM Modeling. They are presented in alphabetical order of the function names. For a listing in the order of the data types that they act on, see Overview of IM Modeling's database objects.
For instructions on how to use the database objects presented here, see Using IM Modeling.
This function returns a character large object representing a PMML Classification model of type DM_ClasModel.
The return value is a character large object representing the PMML Classification model in question. The CLOB XML string is encoded in database encoding (the code set specified when the database was created) regardless of the encoding specification found in the XML content.
This function returns a character large object, representing a Classification test result of type DM_ClasTestResult. Export functions are helpful when you want to store values in an external media, for example, as a backup.
The result of invoking this method is a character large object representing the Classification test result. The CLOB XML string is encoded in database encoding (the code set specified when the database was created) regardless of the encoding specification found in the XML content.
This function returns a character large object representing the PMML Clustering model extracted from a value of type DM_ClusteringModel.
The return value is a character large object representing the Clustering model. The CLOB XML string is encoded in database encoding (the code set specified when the database was created) regardless of the encoding specification found in the XML content.
This function returns a character large object representing the Regression test result of type DM_RegTestResult.
The result of the invocation DM_expRegTestRes is a CHARACTER LARGE OBJECT representing the regression test result.
This function returns a character large object representing a PMML or XML Regression model of type DM_RegressionModel.
A character large object (CLOB) represents a Regression model, if it is a valid instance of the PMML-based regression DTD according to XML.
The return value is a character large object (CLOB) representing the Regression model. The CLOB XML string is encoded in the code set, which is specified when the database is created, regardless of the encoding specification found in the XML content.
This function returns a character large object representing an Associations model of type DM_RuleModel.
The result of invoking DM_expRuleModel is a character large object representing the Associations model. The CLOB XML string is encoded in database encoding (the code set specified when the database was created) regardless of the encoding specification found in the XML content.
This function returns the classification cost rate of the Classification model computed in a validation phase during the training phase. It uses the validation data specified in the DM_ClasBldTask value used to generate the model.
For more information refer to DM_setClasCostRateDM_setClasCostRate.
The return value is the name of the Classification model as a VARCHAR value.
This function returns the DM_LogicalDataSpec value representing the set of fields needed for an application of the Classification model.
To do a test of the model, you must also call the function DM_getClasTarget to complete the set of fields needed for a test run.
The return value is the DM_LogicalDataSpec value representing the set of fields needed for an application of the Classification model.
The return value is the target field name as a VARCHAR value.
The return value is the name of the Clustering model as a VARCHAR value.
This function returns the DM_LogicalDataSpec value representing the set of fields needed for an application of the Clustering model.
The return value is the DM_LogicalDataSpec value representing the set of fields needed for an application of the Clustering model.
The result of invoking this function is determined as follows:
This function returns the name of a cluster at a specified position in a value of type DM_ClusteringModel.
This function returns a table that contains the clusters of a Clustering model. For each cluster, the size and homogeneity is given.
You can use this function for example to determine the smallest clusters for deviation detection. The cluster IDs can be used in result specification methods.
The result of invoking DM_getClusters is a table. Table 64 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ID | INTEGER | Are the index values of the cluster in the model |
| NAME | VARCHAR(128) | Contains the names of the clusters |
| SIZE | BIGINT | Contains the number of records in the clusters |
| HOMOGENEITY | REAL | Contains a measure for the homogeneity of the records in the cluster. The value is between 0 (heterogeneous) and 1 (homogeneous, all records are identical) |
| DESCRIPTION | VARCHAR(1024) | Contains for each cluster a text description of the most important fields for characterizing the cluster. |
The DESCRIPTION of a cluster is built up as follows:
The text of an individual field depends on the field type:
"<field alias> is much more/less often <value> than average"
"<field alias> is more/less often <value> than average"
"<field alias> is much larger/smaller than average"
"<field alias> is larger/smaller than average"
"<field alias> has a larger/smaller variance than input data"
Table 65 shows an example for the table returned by DM_getClusters:
| ID | NAME | SIZE | HOMOGENEITY | DESCRIPTION |
|---|---|---|---|---|
| 1 | lost customer | 765 | 0.8 | AGE is smaller than average, GENDER is more often FEMALE than average, INCOME is much larger than average |
| 2 | loyal customer | 8156 | 0.4 | This cluster is overall similar to input data |
| 3| | undecided customer | 172 | 0.7 | INCOME larger than average, GENDER is more often FEMALE than average, AGE is larger than average |
| 4 | potential customer | 455 | 0.4 | GENDER is much more often MALE than average, NUM_OF_INSURANCES is smaller than average, SICK_LEAVE is much smaller than average, CAR_INSURANCE is much less often YES, NUM_OF_CHILDREN is larger than average |
Returns a table that holds the confusion matrix and cost matrix information contained in a value of type DM_ClasTestResult or DM_ClasModel. If the value is of type DM_ClasModel, then the confusion and cost matrix are returned from the validation result.
If no validation result is contained in the model, then nothing is returned if you have not specified explicitly that the confusion and cost matrix of the Classification model should be returned. For each pair of class label values, the number of test rows is provided for which the first class label value was the actual value and the second the predicted value.
>>-DM_getConfMatrix--(--clasTestResult--)----------------------><
>>-DM_getConfMatrix--(--classificationModel--)-----------------><
>>-DM_getConfMatrix--(--classificationModel--,--useTrainingModel--)-><
The result of invoking DM_getConfMatrix is a table. Table 66 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ACTUAL | VARCHAR(256) | Specifies the actual values |
| PREDICTED | VARCHAR(256) | Specifies the predicted values |
| COUNT | BIGINT |
|
| COST | DOUBLE | Specifies the cost weight (error weight) that is used when the model was created for misclassification of a record with an actual value as the predicted value. |
If neither confusion matrix nor cost matrix information is contained in clasTestResult or classificationModel, then NULL is returned.
If any of the parameters is NULL, then NULL is returned.
If useTrainingModel is 1, then the confusion matrix contained in the Classification model is returned. If useTrainingModel is 0, then the confusion matrix contained in the validation result is returned. For any other value of useTrainingModel an error is returned that the parameter is out of range. If useTrainingModel is not specified and the function is called with classificationModel, then the confusion matrix of the validation result is returned. If neither confusion matrix nor cost matrix exists, NULL is returned.
If any of the class label values in clasTestResult or classificationModel is longer than 256 characters, this value is truncated to a length of 253, and three dot characters (...) are added at the end. For example the class label value:
'POSITIVE RESPONSE. This indicates that the person has checked one of "strongly agree", "agree", or "somewhat agree". The other options on the questionnaire were "somewhat disagree", "disagree" and "completely disagree". The answers were aggregated in order to simplify the evaluation to "positive" vs. "negative".'
This class label value is shortened to:
'POSITIVE RESPONSE. This indicates that the person has checked one of "strongly agree", "agree", or "somewhat agree". The other options on the questionnaire were "somewhat disagree", "disagree" and "completely disagree". The answers were aggregated in or...'.
Table 67 shows the table that might be returned.
| Column Name: | ACTUAL | PREDICTED | COUNT | COST |
| Column Type: | VARCHAR(256) | VARCHAR(256) | BIGINT | DOUBLE |
| ... | YES | YES | 205,381 | 0.0 |
| example rows: | YES | NO | 5,972 | 1.0 |
| ... | YES | PERHAPS | 3 | 3.0 |
| ... | NO | YES | 184,102 | 1.0 |
| NO | NO | 7,389,092 | 0.0 | |
| NO | PERHAPS | 17 | 1.0 | |
| PERHAPS | YES | 0 | 1.0 | |
| PERHAPS | NO | 0 | 1.0 | |
| PERHAPS | PERHAPS | 0 | 0.0 |
This function returns a table containing the correlations between fields with respect to a data mining model. For each pair of fields, their correlation is given.
>>-DM_getCorrelations--(--+-ruleModel-----------+--)----------->< +-regressionModel-----+ +-classificationModel-+ '-clusteringModel-----'
The result of invoking DM_getCorrelations is a table. Table 68 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| FIELDNAME1 | VARCHAR(128) | Contains alias names as defined in the value of type DM_MiningData, which was used in the mining task |
| FIELDNAME2 | VARCHAR(128) | Contains alias names as defined in the value of type DM_MiningData, which was used in the mining task |
| CORRELATION | REAL | If field correlation information is contained in the
input model, the CORRELATION column holds values between
-1 and 1 describing the correlation between the fields in FIELDNAME1 and FIELDNAME2 with respect to the model
or NULL, if the information is missing for that pair of fields. A value of:
Note:
Pairs of fields may be missing from this table if no
information about their correlation is contained in the model. This is equivalent
to a row with CORRELATION value NULL. |
The resulting virtual table has the following layout. In Table 69 the first row shows the column name, the second row shows the column type, and the following rows show examples.
| FIELDNAME1 | FIELDNAME2 | CORRELATION |
| VARCHAR(128) | VARCHAR(128) | REAL |
| REVENUE | churn_probability | 0.22 |
| age | age | 0.78 |
| age | REVENUE | 0.78 |
| CUSTOMER_AGE | churn_probability | - 0.31 |
If the model contains the information shown in Table 70:
| Correlation | AGE | INCOME | NO_CHILDREN |
| AGE | 1.0 | unknown (not computed) | 0.6 |
| INCOME | unknown (not computed) | 1.0 | 0.0 |
| NO_CHILDREN | 0.6 | 0.0 | 1.0 |
The following rows are returned as shown in Table 71:
| FIELDNAME1 | FIELDNAME2 | CORRELATION |
| AGE | NO_CHILDREN | 0.6 |
| INCOME | NO_CHILDREN | 0.0 |
If rowcount is NULL, all error messages are returned.
The result of invoking DM_getErrors is a table. Table 72 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ROWCOUNT | INTEGER | Contains the row number (can be used to order) |
| ERRMSG | VARCHAR(1024) | Contains the complete error message |
| ERRDATE | VARCHAR(12) | Contains the date formatted as in error file (system locale) |
| ERRTIME | VARCHAR(12) | Contains the time formatted as in error file (system locale) |
| ERRTYPE | CHAR(1) |
|
| THREADID | INTEGER | Contains the thread ID of thread writing the error |
| EVENT | INTEGER | Contains the IM Scoring or IM Modeling reason code or event ID as documented in message reference |
An example is:
SELECT * FROM TABLE (IDMMX.DM_GETERRORS(5)) AS ERRORS
This function returns a table that contains the signature of a model. The signature of a model is the set of all input data fields which appear in the model's internal equations and whose values are therefore needed to apply the model. For each signature field, its importance for the model may also be contained in the table. It replaces and completes the following methods or functions:
>>-DM_getFields--(--+-classificationModel-+--)----------------->< +-clusteringModel-----+ +-regressionModel-----+ '-ruleModel-----------'
The result of invoking DM_getFields is a table. Table 73 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| COLNAME | VARCHAR(128) | Contains the original column names in the database table holding the training data. |
| FIELDNAME | VARCHAR(128) | Contains alias names as defined in the PMML attributes displayName. If no alias is defined, it contains the same value as the column COLNAME. |
| MININGTYPE | SMALLINT | Is 0 for categorical and 1 for numerical fields. |
| IMPORTANCE | REAL | If field importance information is contained in the input model, the IMPORTANCE column holds values between 0 and 1 describing the contribution of this input field to the model. A value of 1 means that this field contains all the model information by itself, a value of 0 indicates that the field has no influence on the model. Otherwise, all values are NULL. |
The resulting virtual table has the following layout. In Table 74 the first row shows the column name, the second row shows the column type, and the following rows show examples.
| COLNAME | FIELDNAME | MININGTYPE | IMPORTANCE |
| VARCHAR(128) | VARCHAR(128) | SMALLINT | REAL |
| REVENUE | REVENUE | 1 | 0.753 |
| ZIPCODE | zip | 0 | 0.018 |
| EDUCATION | EDUCATION | 0 | 0.331 |
| CUSTOMER_AGE | age | 1 | 0.240 |
This function returns a table of the fields contained in a value of type DM_MiningData. It contains the column names, their alias names, and their types.
The result of invoking DM_getFields(miningData) is a table. Table 75 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| COLNAME | VARCHAR(128) | Contains the column names. |
| ALIAS | VARCHAR(128) | Contains alias names. If no alias name is contained in miningData for a column, the column name is used as the alias name. |
| TYPENAME | VARCHAR(16) | Is the name of the type. |
Table 76 shows the table that might be returned.
| Column Name: | COLNAME | ALIAS | TYPENAME |
| Column Type: | VARCHAR(128) | VARCHAR(128) | VARCHAR(16) |
| ... | CUSTOMER_AGE | age | INTEGER |
| Example rows: | CHURN | CHURN | CHAR |
| ... | REVENUE | REVENUE | DECIMAL |
| ... | ZIPCODE | zip | INTEGER |
This function returns a table containing gains chart information from a Classification or Regression model.
Syntax for regression
>>-DM_getGainsChart--(--+-regressionModel-+--)----------------->< '-regTestResult---'
Syntax for classification
>>-DM_getGainsChart--(--+-classificationModel-+--,--targetValue--)->< '-clasTestResult------'
If targetValue does not occur in input, an error is returned: "wrong target".
The result of invoking DM_getGainsChart is a table. Table 77 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ROWCOUNT | BIGINT | Each row in the output table represents a set of validation
or test records. It is one of the subsets of all records containing ROWCOUNT records for which the sum of the predicted values is the maximum.
Consider all the records ordered by predicted value in descending order and
select the first ROWCOUNT records. The ROWCOUNT column contains the number of records in the subset.
The biggest value of ROWCOUNT is the size of the test or validation data. |
| SUMACTUAL | DOUBLE | Contains the sum of the actual target field values (on validation or test data) |
| THRESHOLD | DOUBLE | Contains the smallest predicted value for the subset |
The resulting virtual table has the following layout. In Table 78 the first row shows the column name, the second row shows the column type, and the following rows show examples.
| ROWCOUNT | SUMACTUAL | THRESHOLD |
| BIGINT | DOUBLE | DOUBLE |
| 10,000 | 1,000,000 | 81 |
| 20,000 | 1,800,000 | 72 |
| 40,000 | 2,800,000 | 38 |
| 80,000 | 2,600,000 | -110 |
The result of invoking DM_getGainsChart is a table. Table 79 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ROWCOUNT | BIGINT |
Each row in the output table represents a set of validation or test records. It is one of the subsets of all records containing ROWCOUNT records for which the sum of confidences with respect to targetValue is the maximum. Consider all the records ordered by confidence in predicting targetValue in descending order and select the first ROWCOUNT records. The ROWCOUNT column contains the number of records in the subset. The biggest value of ROWCOUNT is the size of the test or validation data. |
| SUMACTUAL | DOUBLE | Contains the number of records with actual value targetValue (on validation or test data) |
| THRESHOLD | DOUBLE | Contains the smallest confidence with respect to targetValue for the subset |
The resulting virtual table has the following layout. In Table 80 the first row shows the column name, the second row shows the column type, and the following rows show examples.
| ROWCOUNT | SUMACTUAL | THRESHOLD |
| BIGINT | DOUBLE | DOUBLE |
| 10,000 | 9,200 | 0.83 |
| 20,000 | 16,000 | 0.72 |
| 40,000 | 18,000 | 0.41 |
| 80,000 | 31,000 | 0 |
This function returns a value (0 <= value <= 1) that indicates the model's quality as it has been determined in a preceding validation or test run. A high value indicates a "good" model.
>>-DM_getMdlQuality--(--+-ruleModel-----------+--)------------->< +-classificationModel-+ +-clusteringModel-----+ +-regressionModel-----+ +-clasTestResult------+ '-regTestResult-------'
The value ( 0 <= value <= 1) shows the overall model quality, where a high value indicates a "good" model.
An overall model quality value close to 0 indicates a very poor model with respect to predictive accuracy, reliability, and the ability to rank data. An overall model quality value close to 1 indicates an excellent model that correctly classifies the data, ranks it correctly, and is maximally reliable.
The overall model quality is based on the quality details accuracy, ranking, and reliability.
max(the arithmetic average of the values
returned by functions
DM_getPredAccuray, DM_getRankQuality and
DM_getReliability, 0).
This function returns the number of clusters contained in a value of type DM_ClusteringModel.
This function returns the number of transactions contained in the dataset used to build the model of type DM_RuleModel. The number of transactions can be used to determine absolute support of individual rules in conjunction with DM_getRules.
The result of invoking DM_getNumTransacts is an INTEGER specifying the number of transactions contained in the dataset used to build ruleModel.
This function returns a value that describes for:
It returns a value between 0 and 1 which indicates whether the model produces systematic deviations between predicted values and actual target values. A value of 1 means that the model produces no systematic error, a value of 0 means that the model produces a systematic error as large as that one produced by always predicting the mean target field value.
This function is related to DM_getRegRSquared and DM_getRMSE.
(number of correct prediction of the specified value) / (number of all predictions of specified value)This means that the accuracy value provides the probability that a prediction of the specified value is correct. For example, a value of 0.8 means that 80 percent of the records for which the specified value is predicted are correctly classified, 20 percent of those records actually have a value different from the value predicted.
This function is related to DM_getRegRSquared and DM_getRMSE.
Syntax for regression
>>-DM_getPredAccuracy--(--+-regressionModel-+--)--------------->< '-regTestResult---'
Syntax for classification
>>-DM_getPredAccuracy--(--+-classificationModel-+--,--targetFieldValue--)->< '-clasTestResult------'
If regressionModel or regTestResult are created by IM Modeling V8.2, the accuracy is always available:
If classificationModel or clasTestResult was created by IM Modeling V8.2, accuracy information will always be available.
The result of the invocation DM_getPredError is the DOUBLE PRECISION value representing the aggregated error computed during the test of a Regression model.
This function is available for:
This information can be used, for example, for selecting the top N customers in a campaign if the exact values are not important.
This information can be used, for example, to find out those customers in a mailing campaign who are the most likely to respond.
The formula to calculate this value is:
value = area(model) / area(optimum)
where:
If area(optimum) equals 0, NULL is returned. This happens in a DM_ClasTestResult when all records tested have the same (actual) value.
The following values are possible:
Syntax for regression
>>-DM_getRankQuality--(--+-regressionModel-+--)---------------->< '-regTestResult---'
Syntax for classification
>>-DM_getRankQuality--(--+-classificationModel-+--,--targetFieldValue--)->< '-clasTestResult------'
If regressionModel or regTestResult was created by IM Modeling V8.2, ranking quality information is always available.
If classificationModel or clasTestResult was created by IM Modeling V8.2, ranking quality information is always available:
The return value is the name of the Regression model as a VARCHAR value.
This function returns the DM_LogicalDataSpec value representing the set of fields needed for an application of the Regression model. The field names contained in the DM_LogicalDataSpec value are the field names of the DM_LogicalDataSpec value used for building the Regression model. To test the model, you must also call the function DM_getRegTarget to complete the set of fields needed for a test run.
The return value is the DM_LogicalDataSpec value representing the set of fields needed for an application of the Regression model.
This function returns the squared Pearson correlation coefficient of the Regression model computed during the training phase using the validation data specified in the DM_RegBldTask value used to generate the model.
This coefficient measures the correlation between the prediction error on verification data and the actual target values.
This function returns the name of the target field used when training the Regression model. The name is the appropriate column alias name of the DM_MiningData value used for building the model.
If the model was produced by means of IM Modeling, the target field name is the name that was set by means of the method DM_setRegTarget in the DM_RegSettings value.
The target field name is returned as a value of type VARCHAR.
The result of the invocation DM_getRegTask is determined as follows:
This function returns a value that indicates the model's estimated capability to correctly predict unknown data, compared to its prediction capability on the training data.
It can have a value between 0 and 1, which describes how well the model performs when applied to test or validation data (which was not used for training before) compared to the model's performance on the training data. Values considerably smaller than 1 indicate that the model is overtrained.
If model or testResult is created by IM Modeling V8.2, the reliability value is always available.
For classification models with validation data and classification test results that have been created by IM Modeling V8.2 the reliability value is always available. In this case, the reliability is defined as:
error rate (training data) / error rate (validation data) or error rate (training data) / error rate (test data)
This function returns the root mean squared error between actual and predicted target field values on the test data. It returns a value in absolute units (comparable to the original range in the target field) to describe the expected deviation of a predicted value from the actual value.
If regressionModel or regTestResult is created by IM Modeling V8.2, the root mean squared error is always available.
This function returns a table containing the bodies of rules in a value of type DM_RuleModel.
The result of invoking DM_getRuleBodies is a table. Table 81 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| BODYID | INTEGER | Contains the ID of the body. Each value in BODYID appears in n rows, where n is the size of the item set. There is a distinct entry in BODYID for each item set appearing in a rule of ruleModel.
Note:
The table contains each BODYID that
appears in a rule. However, not every BODYIDthat is
contained in the table also appears in a rule. |
| ITEMNAME | VARCHAR(1024) | The item name after name mapping (if any) |
| ITEM | VARCHAR(1024) | The original item name before name mapping |
An item set could be, for example:
[shoes][coat][hat]
The resulting virtual table has the following layout. In Table 82 the first row shows the body ID, the item name, and the item, and the following rows show examples.
| BODYID | ITEMNAME | ITEM |
| 17 | 2576901 | shoes |
| 17 | 1288737 | coat |
| 17 | 1298130 | hat |
This example is related to the example shown in DM_getRules.
The return value is the name of the Associations model as a VARCHAR value.
This function returns a table containing the rules in a value of type DM_RuleModel.
The result of invoking DM_getRules is a table. Table 83 describes the data type and purpose of each column contained in this table.
| Column | Data type | Purpose |
|---|---|---|
| ID | INTEGER | Is a number generated to identify the rules. |
| HEADNAME | VARCHAR(1024) | Contains the head item of the rule after name mapping (if any). |
| HEAD | VARCHAR(1024) | Uses the original item before name mappings. |
| BODYID | INTEGER | Is a generated identifier to allow joining the resulting
table with a table generated by DM_getRuleBodies.
Note:
Values of BODYID may appear in several rows, if there
are rules with identical sets of items in their bodies. |
| BODYTEXT | VARCHAR(4096) | Is a concatenation of the names of all body items separated by the term 'AND'. The body items and their names can be determined using the table DM_getRuleBodies. |
| LENGTH | SMALLINT | Is a count of all items in the head and body. |
| SUPPORT | REAL | Is the rule support and contains percentage values between
0.0 and 100.0.
The support of an association rule is the percentage of groups that contain all of the items listed in that association rule. |
| CONFIDENCE | REAL | Is the rule confidence and contains percentage values
between 0.0 and 100.0.
The confidence of an association rule is a percentage value that shows how frequently the rule head occurs among all the groups containing the rule body. |
| LIFT | REAL | Indicates how much more confidence the rule has as might
be expected if the items were statistically independent; the value is given
as a positive factor.
The lift of a rule is the ratio of confidence to the expected confidence. It indicates how much more confidence the rule has as might be expected if the items were statistically independent. |
If, for example, model contains the rules:
[shoes][coat][hat] ==> [scarf]
and
[shoes][coat][hat] ==> [scarf][blouse]
There will be three rows in the result table as shown in Table 84.
| ID | HEADNAME | HEAD | BODYID | BODYTEXT | LENGTH | SUPPORT | CONFIDENCE | LIFT |
| 1 | scarf | 1271180 | 17 | shoes AND coat AND hat | 4 | 5.8 | 82.0 | 0.7 |
| 2 | scarf | 1271180 | 17 | shoes AND coat AND hat | 5 | NULL | NULL | NULL |
| 2 | blouse | 2222333 | 17 | shoes AND coat AND hat | 5 | NULL | NULL | NULL |
This example is related to the example shown in DM_getRuleBodies.
This function returns a table that contains one record for each node of a Tree Classification model. Each record contains the node ID, as presented by the visualizer, and a textual description of the rule that defines the node. In addition to this, the predicted class, the confidence, and the depth of the node are provided.
| Column | Data type | Purpose |
|---|---|---|
| NODEID | VARCHAR(IDM_SQL_NODE_ID)
or VARCHAR(128) |
The values are unique strings identifying an individual node in the tree. The format is identical to the one used by IM Visualization. For example, "1.1.2.1" indicates the node at depth 4 that is reached from the root node by selecting the first successor, then the second, and then the first again. The root node itself has NODEID "1". |
| ISLEAF | SMALLINT | Contains 1 if the node is a leaf node, otherwise it contains 0. The prune level of the model determines which nodes are leaf nodes. The resulting table does not contain any nodes lower than the current prune level. |
| CLASS | VARCHAR(IDM_SQL_CLASS_LABEL=256) | Is the predicted class label (when scoring) for records
that belong to this node.
Note:
The predicted class label need not
be the majority class label in the node if a cost matrix was used. |
| CONFIDENCE | REAL | Is a value between 0 and 1, indicating the probability (based on training data) that the value in CLASS will be a correct prediction for records belonging to the node. CONFIDENCE is sometimes also called purity of a node. |
| SIZE | BIGINT | Is the number of training records that belong to the node. |
| DEPTH | SMALLINT | Holds the depth at which the node occurs in the tree as a SMALLINT, the root node has a depth of 1. |
| CONDITION | VARCHAR(4096) | Is a human-readable string that describes the condition defining the node. There may not be a single decision for each level in the order of the tree branch, as the node text is optimized to eliminate redundancies. CONDITION is truncated if the string is longer than 4096. In this case, the string ends with "..." to indicate that it is truncated. |
The layout of the virtual table is as follows. In Table 86 the first row shows the column name, the second row shows the column type, and the following rows show examples.
| NODEID | ISLEAF | CLASS | CONFIDENCE | SIZE | DEPTH | CONDITION |
| VARCHAR(128) | SMALLINT | VARCHAR(256) | REAL | BIGINT | SMALLINT | VARCHAR(32K) |
| 1 | 0 | NO | 0.51 | 512,606 | 1 | TRUE |
| 1.1 | 0 | NO | 0.62 | 248,384 | 2 | age<=34 |
| 1.1.2 | 0 | YES | 0.55 | 123,811 | 3 | age<=34 AND color IS IN (red, green) |
| 1.1.2.1 | 0 | YES | 0.67 | 75,589 | 4 | 23<=age < 34 AND color IS IN (red, green) |
| 1.1.2.1.2 | 0 | YES | 0.70 | 32,066 | 5 | 23<=age<34 AND color IS IN (red, green) AND income>23200 |
| 1.1.2.1.2.1 | 1 | NO | 0.73 | 15,754 | 6 | 23<=age<34 AND color=blue AND income>23200 |
| 1.1.2.1.2.2 | 1 | YES | 0.92 | 16,312 | 6 | 23<=age<34 AND color IS IN (red, green, blue) AND income>23200 |
The function returns:
This chapter contains full descriptions of all the stored procedures provided with IM Modeling. They are presented in alphabetical order of the procedure names. For a listing in the order of the data types that they act on, see Overview of IM Modeling's database objects.
For instructions on how to use the database objects presented here, see Using IM Modeling.
Each of the three versions of this procedure that are described here builds and stores a value of type DM_ClasModel in a specified table with a specified ID. If a model with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_buildClasModel--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_buildClasModelCmd--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_buildClasModel--(--clasTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
Each of the three versions of this procedure that are described here builds and stores a value of type DM_ClusteringModel in a specified table with a specified ID. If a model with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_buildClusModel--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_buildClusModelCmd--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_buildClusModel--(--clusTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
Each of the three versions of this procedure that are described here builds and stores a value of type DM_RegressionModel in a specified table with a specified ID. If a model with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_buildRegModel--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_buildRegModelCmd--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_buildRegModel--(--regTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
The following exceptions are raised for version 2 and version 3 if:
Each of the three versions of this procedure that are described here builds and stores a value of type DM_RuleModel in a specified table with a specified ID. If a model with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_buildRuleModel--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_buildRuleModelCmd--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_buildRuleModel--(--ruleTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
The stored procedure returns an error message if any of the following is true:
This procedure lists all the environment variables in the running agent process that have the IDM_ prefix.
The return value is a string that concatenates all variable=value entries of the environment, separated by an end-of-line character. Only those variables that have the prefix IDM_ are selected.
To display the environment variables from the command line, enter this call:
CALL IDMMX.DM_getEnv(?)
If you did not set any of the environment variables recognized by IM Scoring or IM Modeling (IDM_MX_ERRORFILE, IDM_MX_TRACEFILE, IDM_MX_TRACELEVEL, IDM_MX_MAX_OPEN_MODELS) before, the resulting list of variables will be empty.
This procedure returns the column names and column types of a specified table in an XML string.
The following SQL types are supported as the SqlType attribute in the XML string:
CHAR, VARCHAR, LONG VARCHAR, TIME, DATE, TIMESTAMP, SMALLINT, INTEGER, DOUBLE, FLOAT, DECIMAL, BIGINT, REAL
If columns are found in the table that have LOB or GRAPHIC data types in all variations, these columns are omitted in the XML string.
The alias is always set to the same name as the column name.
Exceptions are raised in the following cases:
The procedure checks that the variable name has the prefix IDM_. This ensures that you change only variables specific to IM Modeling or IM Scoring.
If value is NULL, the variable with the name variable is removed from the environment of the process.
The following call sets the name and directory of the error file:
CALL IDMMX.DM_setEnv('IDM_MX_ERRORFILE', '/tmp/myerrors.log')The error file is set to its default value:
CALL IDMMX.DM_setEnv('IDM_MX_ERRORFILE', NULL)
Each of the two versions of this procedure that are described here tests a Classification model on new data, and stores the result of the test, as a value of type DM_ClasTestResult, in a table with a specified ID. If a result with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_testClasModelCmdD--(--dataTableName--,--dataColumnName--,--> >--dataIDColumnName--,--dataID--,--modelTableName--,--modelColumnName--,--> >--modelIdColumnName--,--modelId--,--resultTableName--,--resultColumnName--,--> >--resultIdColumnName--,--resultId--)--------------------------><
Version 2
>>-DM_testClasModelD--(--miningData--,--modelTableName--,--modelColumnName--,--> >--modelIdColumnName--,--modelId--,--resultTableName--,--resultColumnName--,--> >--resultIdColumnName--,--resultId--)--------------------------><
Exceptions are raised in the following cases:
Each of the three versions of this procedure that are described here tests a Classification model, using a Classification test task. The procedure stores a value of type DM_ClasTestResult in a specified table with a specified ID. If a result with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_testClasModelT--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_testClasModelCmdT--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_testClasModelT--(--clasTestTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
Each of the two versions of this procedure that are described here tests a Regression model on new data, and stores the result of the test, as a value of type DM_RegTestResult, in a table with a specified ID. If a result with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_testRegModelCmdD--(--dataTableName--,--dataColumnName--,--> >--dataIDColumnName--,--dataID--,--modelTableName--,--modelColumnName--,--> >--modelIdColumnName--,--modelId--,--resultTableName--,--resultColumnName--,--> >--resultIdColumnName--,--resultId--)--------------------------><
Version 2
>>-DM_testRegModelD--(--miningData--,--modelTableName--,--modelColumnName--,--> >--modelIdColumnName--,--modelId--,--resultTableName--,--resultColumnName--,--> >--resultIdColumnName--,--resultId--)--------------------------><
Exceptions are raised in the following cases:
Each of the three versions of this procedure that are described here tests a Regression model, using a Regression test task. The procedure stores a value of type DM_RegTestResult in a specified table with a specified ID. If a result with the specified ID already exists in the table, it is overwritten. The table must already exist.
Version 1
>>-DM_testRegModelT--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Version 2
>>-DM_testRegModelCmdT--(--task_fullyQualifiedTableName--,--task_columnName--,--> >--task_idColumnName--,--task_id--,--fullyQualifiedTableName--,--modelColumnName--,--> >--idColumnName--,--id--)--------------------------------------><
Version 3
>>-DM_testRegModelT--(--regTestTask--,--callid--,--fullyQualifiedTableName--,--> >--modelColumnName--,--idColumnName--,--id--)------------------><
Exceptions are raised in the following cases:
This chapter contains full descriptions of the commands that are provided with IM Modeling. With these commands, you can do the following tasks:
See The idmlicm command.
See The idmlevel command.
You can find these commands in the bin directory of your IM Modeling installation.
The idmcheckdb command checks the parameters of a database. It identifies DB CFG parameters if they are not valid and tells you how to solve the problem. It also checks whether a specified database is enabled:
>>-idmcheckdb--dbname--+-------------+--+-------------------------------+->< '-show detail-' '-user--userID--using--password-'
The idmcheckdb utility returns the following messages:
| The database "mydb" is enabled for IM Modeling Version 8.2 and IM Scoring Version 8.2 in "fenced" mode. |
| The database "mydb" is enabled for IM Scoring Version 8.2 in "fenced" mode. |
| The database "mydb" is enabled for IM Modeling Version 8.2 in "fenced" mode. |
| The database "mydb" is not enabled for IM Modeling Version 8.2 or IM Scoring Version 8.2. |
If the database was enabled with the current version of the product, idmcheckdb reports:
The database "sample" is enabled for IM Modeling Version 8.2 and IM Scoring Version 8.2 in "fenced" mode.
If the database was enabled with the current version of the product using the Tablespace option, idmcheckdb sample reports:
The database "sample" is enabled for IM Modeling Version 8.2 and IM Scoring Version 8.2 in "fenced" mode. The following tables contain one or more columns with mining objects: IDMMX.CLASSETTINGS (TABLESPACE USERSPACE2), IDMMX.CLASSIFMODELS (TABLESPACE USERSPACE2), IDMMX.CLASTASKS (TABLESPACE USERSPACE2), IDMMX.CLASTESTRESULTS (TABLESPACE USERSPACE2), IDMMX.CLASTESTTASKS (TABLESPACE USERSPACE2), IDMMX.CLUSSETTINGS (TABLESPACE USERSPACE2), IDMMX.CLUSTASKS (TABLESPACE USERSPACE2), IDMMX.CLUSTERMODELS (TABLESPACE USERSPACE2), IDMMX.LOGICALDATASPECS (TABLESPACE USERSPACE2), IDMMX.MININGDATA (TABLESPACE USERSPACE2), IDMMX.REGRESSIONMODELS (TABLESPACE USERSPACE2), IDMMX.REGSETTINGS (TABLESPACE USERSPACE2), IDMMX.REGTASKS (TABLESPACE USERSPACE2), IDMMX.REGTESTRESULTS (TABLESPACE USERSPACE2), IDMMX.REGTESTTASKS (TABLESPACE USERSPACE2), IDMMX.RULEMODELS (TABLESPACE USERSPACE2), IDMMX.RULESETTINGS (TABLESPACE USERSPACE2), IDMMX.RULETASKS (TABLESPACE USERSPACE2)
If the database was enabled with a previous but compatible version of the product, idmcheckdb reports:
The database "sample" is enabled for IM Scoring Version 8.1.0.1 in "fenced" mode. The database can be used with the current version 8.2. IBM recommends to migrate the database. Use command idmenabledb to migrate your database.
If the database was enabled with a previous but incompatible version of the product, idmcheckdb reports:
The database "sample" is enabled for IM Modeling Version 8.1 and IM Scoring Version 8.1 in "fenced" mode. To use this database with the current version 8.2 you must migrate the database. Use command idmenabledb to migrate your database.
Another example using user ID and password: To check a cataloged database on a remote system, you can specify a user ID and a password, such as:
idmcheckdb sample user peter using mypassword
If a user has not installed IM Scoring or IM Modeling on the client, enter the following to get information about the status of the database enablement:
db2 "select * from IDMMX.VERSION"
The database is not enabled, if the following information is returned:
SQL0204N "IDMMX.VERSION" is an undefined name. SQLSTATE=42704
Otherwise, the following information is returned:
V_KEY V_VALUE V_TIMESTAMP -------------------- ------------------------------ -------------------------- IM Scoring 8.2 2004-05-08-10.10.33.576001 IM Modeling 8.2 2004-05-08-10.10.43.430001
To find out if a database is enabled in fenced or unfenced mode, you can use the following query:
db2 "select routinename,fenced from syscat.routines where
routineschema = 'IDMMX' and origin='E'"
The idmdisabledb command disables a database. It deletes the following mining objects from a specified database:
The idmenabledb command enable a database. It creates new database objects in the database and changes existing database objects if required.
This command is shared between IM Modeling and IM Scoring. It detects which:
>>-idmenabledb--dbname--+----------+--+---------+---------------> +-fenced---+ +-dbcfg---+ '-unfenced-' '-nodbcfg-' >--+------------------+--+------------------+-------------------> '-ClasModelSize--n-' '-RuleModelSize--n-' >--+------------------+--+-----------------+--------------------> '-ClusModelSize--n-' '-RegModelSize--n-' >--+---------------+--+-----------------+--+---------------+----> '-StructSize--n-' '-ApplDataSize--n-' '-ResultSize--n-' >--+-----------------------------+----------------------------->< '-Tablespace--tablespace-name-'
If dbcfg is specified, the database configuration (DB CFG) is changed as recommended without prompting the user.
If nodbcfg is specified, only a warning message is displayed. The database configuration (DB CFG) is not changed.
If you want to change the parameter sizes after you have created models in your database, follow the instructions in Intelligent Miner Scoring: Administration and Programming for DB2.
The default is 2 KB, which is suitable for all default results and for most of the results created according to a result specification with 10 additional results data. If you want to use a result specification that contains more or bigger results data, increase the size accordingly. The maximum size is 32 KB.
ClusModelSize 20M ResultSize 2K
"Database successfully enabled. However, some types already exist with a different size than requested. First disable the database and run the command again."
An example is:
idmenabledb testdb fenced ClasModelSize 5 RuleModelSize 7 RegModelSize 9
where:
The idminstfunc command enables the DB2 instance for the use of IM Modeling and IM Scoring. Enabling the DB2 instance means that shared libraries containing the implementation of the UDFs, UDMs, and stored procedures are linked into the sqllib/function directory of the DB2 instance.
The idminstfunc command is a shared command between IM Modeling and IM Scoring, and it must be called only once if both products are installed. If only one of the two products is installed, the command must be called again when the other product is added later on.
The idminstfunc command enables the instance that is specified in the DB2INSTANCE environment variable. This variable is automatically set when the respective db2profile script of the instance is executed. It automatically detects if it is a 32 or 64-bit instance. If you want to upgrade an instance from 32 to 64 bit, you must call idminstfunc again. The bin directory of the IM Scoring installation is added to the search path of the DB2 instance, so that further commands of IM Scoring can be called without specifying the full path.
Refer to DB2 Intelligent Miner Modeling, DB2 Intelligent Miner Scoring, DB2 Intelligent Miner Visualization: Installing the Intelligent Miner products.
The idmuninstfunc command disables the DB2 instance for the use of IM Modeling and IM Scoring. Disabling the DB2 instance means that links to the shared libraries containing the implementation of the UDFs, UDMs, and stored procedures are removed from the sqllib/function directory of the DB2 instance.
This command must be called only on UNIX platforms, and it can be called only by a user with SYSADM authority.
The idmuninstfunc command is a shared command between IM Modeling and IM Scoring, and needs be called only once if both products are installed. It is not possible to disable the instance for the use of only one product if both products are installed.
After the idmuninstfunc command is called, IM Modeling and IM Scoring can no longer be used for that DB2 instance. To enable the DB2 instance again, call the idminstfunc command.
Use the command idmlevel to collect information about the software environment (operating system, DB2 version) and IM product version you are using.
idmlevel c:\immodeling.log
idmlevel
Use the idmlicm command to check your license status. IM Scoring and IM Modeling use nodelocked license keys installed in a license file. The full product contains production license keys, which are installed during installation. The 'Try and Buy' version does not include a production license key. You can use the idmlicm command to generate a 'Try and Buy' license key.
The idmlicm command is located in the bin directory. It has no parameters. When invoked, idmlicm checks the license status.
The license for the product "DB2 Intelligent Miner Scoring"
was found in the file "nodelock_sc".
The license for the product "DB2 Intelligent Miner Modeling"
was found in the file "nodelock_mo".
If no production license is installed, idmlicm can generate a temporary license key the first time it is invoked.
W 2771: You are now using a temporary license. You need to enroll "DB2 Intelligent Miner Scoring" within "89" days in the license file "d:\IMinerX\bin\nodelock_sc".
If you invoke idmlicm when a temporary license is already installed, you get the following sample output:
W 2772: The number of days left is "89". You are still using a temporary license. You need to enroll "DB2 Intelligent Miner Scoring" in the license file "d:\IMinerX\bin\nodelock_sc".
To inform the process that runs the stored procedures about new or changed environment variables, you can use a stored procedure that directly modifies environment variables in the running agent process instead of restarting the DB2 server. There is also a stored procedure to retrieve information about the current environment variables.
These stored procedures are as follows:
This is the procedure on Windows 2000. On other Windows versions, the navigation path may differ slightly.
The progress information that is generated by the mining algorithms during a training or test run can be written into the Progress Information Table (PIT). Progress information records are inserted into the PIT without issuing a COMMIT. This means that the table can be read from another connection only with isolation level UR (uncommitted read). There is no special function or procedure to enable the PIT to be read. You can create your own SELECT statements to query the information in the PIT.
You can specify the name of the PIT; see the description of the relevant method at DM_setProgTab. If the specified table does not exist, an error is written to the error file and to the error table. (For information to be written to the error table, the table must exist. For more information on error handling, see Getting error information.) The stored procedure then returns this error. It is also considered an error if the PIT exists but the required columns have not been defined correctly.
There is a separate sample SQL script for creating a PIT (createProgressTable.db2). You may change the name of the table in the script and you may add columns to the table in the script, but the actual column definitions must not be changed.
A PIT has the following columns:
| Column name | SQL type | Description |
|---|---|---|
| CALLID | CHAR(19) FOR BIT DATA | The call ID that identifies the training or test run. The call ID that was passed to the stored procedure for the mining run is written into this column. When a new mining run is started, first all records having the same call ID as that passed to the stored procedure are deleted from the PIT. This prevents confusion between old and new progress information records. |
| PROCNAME | VARCHAR(100) | The name of the stored procedure executing the mining run. |
| KERNELPHASEID | INTEGER | Each mining algorithm runs through one or more (kernel) phases. This ID identifies the phase. If the mining algorithms has not reported a phase so far, the value in this column is NULL. |
| KERNELPHASE | VARCHAR(500) | The name of the kernel phase, or a sentence that explains it. If the kernel has not reported a phase so far, or does not report a phase, the string is set to "---". |
| KERNELINFO | CLOB(32K) | At the beginning of their operation, the kernels report some basic information about their operation. This includes the list of phases they expect to run through, the type name of the sub-phases (iterations) that are counted by the ITERATIONNO value, and the maximum execution time. This information is stored in this column. However, the information is stored in this column only once by the kernels; subsequent records will have NULL in this column. The information is stored in an XML format. |
| ITERATIONNO | INTEGER | The number of the current pass over the data. The first pass is number 1. |
| PROGRESS | REAL | Progress is a value between 0 and 1. When a new iteration begins, the progress value is reset to 0. |
| QUALITYID | INTEGER | The quality ID identifies the quality measure used to evaluate the quality of building the model. |
| QUALITYMEASURE | VARCHAR(500) | The quality measure names the unit of evaluation for the quality of building the model. |
| QUALITYVALUE | REAL | The quality value gives a numerical value for the quality of building the model. The unit of this value is the quality measure. |
| TIMESTMP | TIMESTAMP | The time when the record was written to the PIT. Also, this column is the location where a start time record and an end time record for the mining run is written to the PIT. For start and end time records, all columns except TIMESTMP and CALLID are NULL. |
| MESSAGEID | INTEGER | This is an identifier for the MESSAGE stored in the next column. |
| MESSAGE | VARCHAR(1000) | A message describing the current status of the mining run. |
| CANCELREQUEST | INTEGER | Normally NULL. Set to 1 by the stored procedure DM_cancelTask. Reset to 0 when the mining run has taken note of the cancel request. |
For instructions on how to specify a PIT and how to identify a mining run in the table, see Defining additional control parameters.
This section provides information on how IM Modeling handles error messages and on how you can define the error file and error message table (EMT).
For information on error message format and for a full reference resource to the error messages provided by IM Modeling, see DB2 Intelligent Miner Modeling, DB2 Intelligent Miner Scoring: Messages.
IM Modeling writes all error messages and warnings to a file (as does IM Scoring). When a stored procedure is called, error information can additionally be written to an EMT. A new error message is appended to the file, and it is inserted into the EMT; this happens without a COMMIT instruction being issued. There is no special function or procedure that you can use to read the EMT. To query the information in the EMT, create your own SELECT statements.
The default error file is named idmMxError.log; it resides in the temporary directory of the system. You can change the error file name and directory by using the environment variable IDM_MX_ERRORFILE. If this variable is not set, the default error file is used. For information on setting this variable, see Setting environment variables (for error and trace).
There is a separate sample SQL script for creating an EMT (createErrorTable.db2). You can change the name of the table in the script and add columns to the table in the script; however, you must not change the actual column definitions.
An EMT has the following columns:
| Column name | SQL type | Description |
|---|---|---|
| CALLID | CHAR(19) FOR BIT DATA | The call ID that identifies the training or test run. The call ID that was passed to the stored procedure for the mining run is written into this column. When a new mining run is started, first all records having the same call ID as that passed to the stored procedure are deleted from the EMT. This prevents confusion between old and new error message records. |
| RC | CHAR(1) | The return code, which is one of the following:
|
| SQLSTATE | CHAR(5) | The five-digit SQLSTATE of the error. The SQLSTATE of the severest error that happened during the execution of the stored procedure is returned to DB2. |
| EXCID | INTEGER | The IM Modeling four-digit error event code. |
| PROCNAME | VARCHAR(100) | The name of the stored procedure executing the mining run. |
| COMPNAME | VARCHAR(100) | The name of the internal software component where the error or warning occurred. |
| TIMESTMP | TIMESTAMP | The time when the EMT record was written. |
| MESSAGE | VARCHAR(1000) | The text of the error or warning message. |
For instructions on how to specify an EMT and how to identify a mining run in the error message table, see Defining additional control parameters.
Before you contact IBM for support, check the information provided in the release.txt file that comes with the product. This file can be found in the installation directory.
To find the latest information about IM Modeling access the Intelligent Miner Web site.
When you contact IBM for support, prepare to answer the questions in the problem identification worksheet. Make yourself familiar with the instructions on how to collect trace information given at Getting trace information.
The IBM Software Support Guide contains the following problem identification worksheet.
Answer the questions in the worksheet before contacting IBM support.
PROBLEM IDENTIFICATION WORKSHEET
Complete this form before calling Technical Support
This form helps you identify problems and assists IBM Technical Support in
finding solutions.
System Information
What is the failing product? _______________________________________________
What is the version and release number?_____________________________________
What machine model, operating system, and version are running?______________
Problem Description
What are the expected results?______________________________________________
What statement or command is being used? ___________________________________
What are the exact symptoms and syntax? ____________________________________
____________________________________________________________________________
What is or isn't happening, including exact error number and message text?
____________________________________________________________________________
____________________________________________________________________________
Is anyone else experiencing the problem? ___________________________________
Is this the first time this operation has been attempted? __________________
Is this the first time this problem has occurred?___________________________
Environment
When did this activity work last? __________________________________________
What has changed since the activity last worked? ___________________________
_____ Hardware type/model _____ Application
_____ Operating system/version _____ Level of usage
_____ New product version/release _____ Maintenance applied
If the problem does not occur every time, under what conditions does the
problem not occur?
____________________________________________________________________________
____________________________________________________________________________
Is there any other software running on the system which may be conflicting
with this product?
____________________________________________________________________________
____________________________________________________________________________
Problem Isolation
Identify the specific feature of the software causing the problem.__________
____________________________________________________________________________
Can the problem be reproduced? If so, please provide a reproducible test case
or instructions on how to reproduce the error condition.____________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Use the command idmlevel to collect information about the software environment (operating system, DB2 version) and IM product version you are using.
For more information on using this command on Windows or UNIX operating systems refer to The idmlevel command.
The trace facility in IM Modeling helps IBM to locate an error by writing information about an error situation to a file. This information consists of trace messages.
The trace facility is configured by means of two environment variables. These are as follows:
IDM_MX_TRACELEVEL determines the filtering of trace messages. IDM_MX_TRACELEVEL is effectively an on/off switch for tracing.
Since trace messages are controlled by means of environment variables, concurrent mining runs write to the same trace file.
The trace message that is written to the trace file consists of:
Additionally, basic system information is written once per trace.
To work with the tracing facility, set the environment variable IDM_MX_TRACELEVEL, IDM_MX_TRACEFILE, or both. To switch the tracing facility on, set IDM_MX_TRACELEVEL to BASIC, MOST, or ALL. You can also optionally set IDM_MX_TRACEFILE to a file name including the whole path. If IDM_MX_TRACEFILE is not set explicitly, the trace information is written to the file /tmp/idmMxTrace.log by default.
For information on how to inform DB2 about these environment variables, see Setting environment variables (for error and trace).
To work with the tracing facility, set the environment variable IDM_MX_TRACELEVEL, IDM_MX_TRACEFILE, or both. To switch the tracing facility on, set IDM_MX_TRACELEVEL to BASIC, MOST, or ALL. You can also optionally set IDM_MX_TRACEFILE to a file name including the whole path. If IDM_MX_TRACEFILE is not set explicitly, the trace information is written to the file idmMxTrace.log by default.
For information on how to inform DB2 about these environment variables, see Setting environment variables (for error and trace).
If you need to contact IBM support, you might also need to provide DB2 diagnostic information like DB2CLI trace or db2diag.log. For more information, see the DB2 Troubleshooting Guide.
A mining run can take a very long time, hours or even days. Therefore, you need to be able to cancel a mining run.
To cancel a mining run, you issue a cancel request. You can make the request at any time during the mining run. If the mining run is close to its end, the mining function might not fulfill the cancel request. If it fulfills the request, it chooses the best time to cancel the run. This means that a cancel request does not immediately shut down the calculation. The request is a demand to the mining kernel to stop execution at the next possible point in time.
You call the stored procedure DM_cancelTask to start the cancellation process. Since the synchronous call of a mining run blocks the corresponding database connection, this procedure has to be called by means of a second connection. This can be the connection that is also used to read progress information.
For a full description of the stored procedure, see DM_cancelTask. The procedure takes two parameters, progressTableName and callId. These two parameters identify the mining run to be canceled. These parameters must be the same as those used when the task for the mining run was defined (see DM_setProgTab) and when the stored procedure was called. The stored procedure writes a cancel request indicator into the progress information table (that is, the column CANCELREQUEST in the progress information table is set to 1), as well as the passed callId. If callId is NULL, there should be no other concurrent mining run that uses this progress information table and has no callId. Otherwise, you would cancel the mining run that does not use a callId and that accesses the progress information table next, and the others would not be canceled. If the task for the mining run did not contain the name of a progress information table, the mining run cannot be canceled.
As soon as the cancel request is read by the mining algorithm, the cancel request indicator is reset (that is, the column CANCELREQUEST in the progress information table is set to 0) in order to acknowledge that the cancel request has been noted. However, when you call DM_cancelTask, you should be aware that there is no guarantee that the mining run will be canceled as requested. The mining algorithm that does the actual cancellation may, for example, decide not to react to the request because the mining run is close to its end.
Note that DM_cancelTask performs a COMMIT to make the record written to the progress information table readable for the mining run that is part of another transaction.
If you want to migrate from IM Modeling V8.1 to IM Modeling V8.2, in general you can start working with IM Modeling V8.2 after performing the following steps:
If you want to perform scoring operations with both versions, the recommended way to do this is to use different DB2 instances. The reason for this is that an instance is enabled for a specific version of IM Modeling by means of the command idminstfunc. If you want to use the same DB2 instance for both products, disable and enable the DB2 instance first before you use the second product. For this scenario, it is recommended that you use different databases.
IM Scoring and IM Modeling support DB2 V8.
If you use DB2 Version 7 with previous versions of IM Scoring or IM Modeling, you must first migrate DB2 Version 7 to Version 8 as described in the DB2 documentation. Then proceed with the migration instructions for IM Scoring or IM Modeling.
Before you start the migration you must consider the following:
If you want to migrate from IM Modeling V8.1 to IM Modeling V8.2, in general you can start working with IM Modeling V8.2 after performing the following steps:
A DB2 instance must have access to the libraries containing the IM Modeling or IM Scoring functions to use IM from that instance. Some library names and installation paths have changed with Version 8.2. To migrate the DB2 instances to the new version of IM, use the command idminstfunc. For more information refer to The idminstfunc command.
IM Modeling and IM Scoring work with database objects, such as user-defined types (UDT), user-defined functions (UDF), user-defined methods (UDM), and stored procedures (SP). These objects must be created in each DB2 database to be used with IM. This step is called "enabling the database". New database objects have been added in Version 8.2 and some database objects need to be updated.
To migrate existing database objects:
db2 list db directory
Sample output:
System Database Directory Number of entries in the directory=2 Database 1 entry: Database alias = SAMPLE Database name = SAMPLE Database drive = D:\DB2 Database release level = a.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Database 2 entry: Database alias = IMDEMO Database name = IMDEMO Database drive = D:\DB2 Database release level = a.00 Comment = Directory entry type = Indirect Catalog database partition number = 0
idmcheckdb dbnameSample output:
E:\>idmcheckdb sample The database "sample" is enabled for IM Modeling Version 8.1 and IM Scoring Version 8.1 in "fenced" mode. To use this database with the current version 8.2 you must migrate the database. Use command idmenabledb to migrate your database. ...
idmenabledb dbnameFor
more information refer to The idmenabledb command.
E:\>idmcheckdb sample The database "sample" is enabled for IM Modeling Version 8.2 and IM Scoring Version 8.2 in "fenced" mode. ...
External libraries implementing UDF, UDM, or SP may remain loaded in DB2's processes until the DB2 instance is restarted. To avoid that DB2 uses older libraries of a previous version, the database instance should be restarted after migration. To restart the instance, use the commands:
db2stop db2start
For more information refer to the DB2 manuals.
IM Modeling provides a set of user-defined methods, functions, and stored procedures to DB2. You invoke these database objects by using SQL statements. For applications that you want to use in connection with IM Modeling, the following interfaces are available:
For further information about the DB2 CLI, refer to the platform-specific guide and reference, for example, IBM DB2 Universal Database Call Level Interface Guide and Reference.
You can find further information about JDBC on the JDBC Web site.
The use of embedded SQL requires precompilation and binding. Precompilation converts SQL statements into DB2 run-time API calls. Binding creates a package from a bind file, which contains information on the SQL statements in the application program.
For further information about embedded SQL, refer to the IBM DB2 UDB Application Development Guide.
For further information about issuing SQL statements from the DB2 command line, refer to your SQL documentation, for example, IBM DB2 UDB Getting Started.
The DB2 SQL interface supports the development of data mining modeling applications in programming languages that support at least one of these interfaces.
The following sections briefly describe these interfaces, and give references to further information about them. Most of these interfaces are also described in greater detail in DB2 UDB SQL Reference.
This appendix outlines the differences between IM Modeling and IM for Data. The differences lie in the following areas:
In IM for Data, the physical data specifications are done in a data object. IM for Data has no subdivision into physical data and logical data. This means that the specifications in a DM_MiningData value covers only a subset of the specifications that can be done in the IM for Data data object. Some of the IM for Data object specifications can be done in the logical data specifications. Examples are name mappings, and lower and upper bounds for continuous fields. Others are no longer available in IM Modeling, as follows:
The following settings parameters in IM for Data are not supported in IM Modeling:
This section outlines how you can use IM Modeling to set parameters, as they appear in IM for Data, for the Clustering mining function.
The following table lists the parameters as they appeared in IM for Data and the corresponding SQL methods in IM Modeling that you can use to set them. The parameters no longer in use are in square brackets, for example, [comment]. The new parameters are written in italics, for example, desired execution time.
| Section | Parameter | In SQL type | With SQL set method |
|---|---|---|---|
| Mining function | name | -- | -- |
| [comment] | -- | -- | |
| [mining function] | -- | -- | |
| Input data | input data | DM_ClusBldTask | DM_defClusBldTask |
| optimize for.. | -- | -- | |
| filter records | DM_MiningData | DM_setWhereClause | |
| power options | DM_ClusSettings | DM_setPowerOptions | |
| Mode parameters | use mode | -- | -- |
| maximum clusters | DM_ClusSettings | DM_setMaxNumClus | |
| [accuracy improvement] | -- | -- | |
| similarity threshold | DM_ClusSettings | DM_setDClusPar | |
| desired execution time | DM_ClusSettings | DM_setExecTime | |
| minimum percentage data | DM_ClusSettings | DM_setMinData | |
| Input fields | active fields | DM_ClusSettings | DM_setFldUsageType |
| supplementary fields | |||
| Field parameters | field weight | DM_ClusSettings | DM_setFldWeight |
| outlier treatment | DM_ClusSettings | DM_setFldOutlTreat | |
| Value weighting | DM_ClusSettings | DM_setDClusFldPar | |
| compensate | |||
| Additional field parameters | distance unit | DM_ClusSettings | DM_setFldSimScale |
| Outlier treatment | [outlier treatment] | ||
| Similarity matrix | similarity matrix | DM_ClusSettings | DM_addSimMat, then DM_setFldSimMat |
| Parallel parameters | [run the parallel mode of the function] | ||
| Output fields | * | ||
| Output data | * | ||
| Results | * |
This section outlines how you can use IM Modeling to set parameters, as they appear in IM for Data, for the Classification mining function.
The following table lists the parameters as they appeared in IM for Data and the corresponding SQL methods in IM Modeling that you can use to set them.
| Section | IM for Data related parameter | IM Modeling related method or value of type |
|---|---|---|
| Mining function | Classification - Tree | DM_ClasBldTask DM_ClasTestTask |
| Input data | Settings name | DM_MiningData |
| Filter records condition | DM_setWhereClause | |
| Power options | DM_setPowerOptions | |
| Mode parameters | Training mode | DM_ClasBldTask |
| Test mode | DM_ClasTestTask | |
| Application mode | (Use IM Scoring) | |
| Input fields | Available fields | Not available |
| Input fields | All fields from DM_LogicalDataSpec | |
| Class labels | Field set by means of DM_setClasTarget | |
| Filter mask | Not available | |
| Field parameters | Input fields | -- |
| Field weights | -- | |
| Error matrix | Available value mappings | Not available |
| Settings name | DM_setCostMat | |
| Parallel parameters | Run the serial mode of the function | Not available |
| Run the parallel mode of the function | -- | |
| Output fields | Available fields | Not available |
| Output fields | -- | |
| Class ID field name | -- | |
| Confidence field name | -- | |
| Output data | Available output data | Not available |
| Settings name | -- | |
| Results | Available results | Not available |
| Results name | Result built and stored by means of DM_buildClusModel |
There are no tools available to migrate from IM for Data to IM Modeling.
Here you find an overview of the data or information that is shared between IM Modeling and IM Scoring.
The schema IDMMX is shared between IM Modeling and IM Scoring.
The following data types are shared between IM Modeling and IM Scoring:
The following functions are shared between IM Modeling and IM Scoring:
The following methods are shared between IM Modeling and IM Scoring:
The following commands are shared between IM Modeling and IM Scoring:
PMML is a markup language for data mining. Based on XML, PMML provides a standard that enables data mining models to be shared between the applications of different vendors. It provides a vendor-independent method of defining models. It allows you to exchange models between applications.
You can find more information about PMML on the Web site of the Data Mining Group (DMG).
Here you find information on how IM Scoring conforms to the PMML standard. The following naming conventions of the PMML standard are used:
IM Modeling complies with the PMML producer conformance clause of the PMML standard for association rules and decision trees.
IM Modeling also complies with the PMML producer conformance clause of the PMML standard for distribution-based clustering when value weighting is not used. See the definition of value weighting in Specifying value weighting, and its usage in DM_setDClusFldPar. However, if value weighting is used, IM Modeling produces non-conforming PMML models with a specific extension for value weighting. This extension can be read only by IM Scoring, which will use value weighting when scoring data on these models. Other PMML consumer tools will ignore the extension. However, they will read the model successfully, and will not consider value weighting when scoring data on these models.
IM Modeling does not comply with the PMML producer conformance clause of the PMML standard for regression. The complex Regression models produced by IM Modeling cannot be represented in PMML 2.1. Therefore, Regression models are written in a PMML-extended XML representation that has been submitted for approval to the Data Mining Group for the next PMML version.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation Licensing 2-31 Roppongi 3-chome, Minato-ku Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you.
Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact:
IBM Deutschland GmbH Department 0790 Pascalstrasse 100 70569 Stuttgart Germany
Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee.
The licensed program described in this information and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement or any equivalent agreement between us.
Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-level systems and there is no guarantee that these measurements will be the same on generally available systems. Furthermore, some measurement may have been estimated through extrapolation. Actual results may vary. Users of this document should verify the applicable data for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products.
All statements regarding IBM's future direction or intent are subject to change or withdrawal without notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrates programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.
You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing, or distributing application programs conforming to IBM's application programming interfaces.
Each copy or any portion of these sample programs or any derivative work, must include a copyright notice as follows:
(C) (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. (C) Copyright IBM Corp. _enter the year or years_. All rights reserved.
The following terms are trademarks of the IBM Corporation in the United States, other countries, or both:
UNIX is a registered trademark of The Open Group in the United States and other countries.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, and service names may be trademarks or service marks of others.
This glossary defines terms as they are used in this book. If you cannot find the term you are looking for, refer to the Dictionary of Computing New York: McGraw-Hill, 1994.
Example of application: store layout.
Example of application: insurance risk prediction.
Example of application: customer mailings.
This bibliography lists all publications in the Intelligent Miner library other than this book, related IBM publications that are relevant to the contents of this book, and non-IBM publications that might be useful for reference purposes.
Where appropriate, IBM publication numbers are given after the document title. This will assist you in finding the document online at the IBM Publications Center.
If you need to, download DB2 fixpacks.
To download patches, go to the SUN Solaris home page
\doc\ScoringBean\index.html