SQL/MX Data Mining Guide

Mining the Data
HP NonStop SQL/MX Data Mining Guide523737-001
4-8
Building Decision Trees
Computing Cross Table When Marital Status is Single and Children is Zero
This query generates cross tables for the Number_Children attribute compared to the
goal when Marital Status is Single and Number_Children is 0:
SELECT Independent_Variable, IV2, cust_left, COUNT(*)
FROM miningview
WHERE marital_status = 'Single' AND number_children = 0
TRANSPOSE ('NUMBER_CHILDREN', number_children)
AS (Independent_Variable, IV2)
GROUP BY Independent_Variable, IV2, cust_left
ORDER BY Independent_Variable, IV2, cust_left;
INDEPENDENT_VARIABLE IV2 CUST_LEFT (EXPR)
-------------------- ----- --------- ---------
NUMBER_CHILDREN 0 Y 3
--- 1 row(s) selected.
This group of records is homogeneous with respect to Cust_Left—that is, Cust_Left is
equal to Y in all cases.
Computing Cross Table When Marital Status is Single and Children > Zero
This query generates cross tables for the Number_Children attribute compared to the
goal when Marital Status is Single and Number of Children is greater than 0:
SELECT Independent_Variable, IV2, cust_left, COUNT(*)
FROM miningview
WHERE marital_status = 'Single' AND number_children > 0
TRANSPOSE ('NUMBER_CHILDREN', number_children)
AS (Independent_Variable, IV2)
GROUP BY Independent_Variable, IV2, cust_left
ORDER BY Independent_Variable, IV2, cust_left;
--- 0 row(s) selected.
This group of records is homogeneous with respect to Cust_Left equal to N.
Final Decision Tree
You have now finished developing the decision tree. Each branch of the tree is
homogeneous with respect to the value of Cust_Left. In practice, this process is highly
iterative. Expanding each node might require several iterations, and you might need to
back up to a previous node to consider another alternative.