SQL/MX Data Mining Guide

Mining the Data
HP NonStop SQL/MX Data Mining Guide523737-001
4-7
Building Decision Trees
Showing the Homogeneous Branches
For each of the preceding conditions, these queries show that he branches in the
decision tree are homogeneous with respect to the goal attribute Cust_Left.
Computing Cross Table When Marital Status is Divorced and Gender is
Male
This query generates cross tables for the Gender attribute compared to the goal when
Marital Status is Divorced and Gender is Male:
SELECT Independent_Variable, IV1, cust_left, COUNT(*)
FROM miningview
WHERE marital_status = 'Divorced' AND gender = 'M'
TRANSPOSE ('GENDER', gender)
AS (Independent_Variable, IV1)
GROUP BY Independent_Variable, IV1, cust_left
ORDER BY Independent_Variable, IV1, cust_left;
INDEPENDENT_VARIABLE IV1 CUST_LEFT (EXPR)
-------------------- --- --------- ---------
GENDER M Y 5
--- 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 Divorced and Gender is
Female
This query generates cross tables for the Gender attribute compared to the goal when
Marital Status is Divorced and Gender is Female:
SELECT Independent_Variable, IV1, cust_left, COUNT(*)
FROM miningview
WHERE marital_status = 'Divorced' AND gender = 'F'
TRANSPOSE ('GENDER', gender)
AS (Independent_Variable, IV1)
GROUP BY Independent_Variable, IV1, cust_left
ORDER BY Independent_Variable, IV1, cust_left;
INDEPENDENT_VARIABLE IV1 CUST_LEFT (EXPR)
-------------------- --- --------- ---------
GENDER F N 1
--- 1 row(s) selected.
This group of records is homogeneous with respect to Cust_Left—that is, Cust_Left is
equal to N in all cases.