25.10.2016 Views

SAP HANA Predictive Analysis Library (PAL)

sap_hana_predictive_analysis_library_pal_en

sap_hana_predictive_analysis_library_pal_en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Overcast', 83, 78, 'No', 'Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Overcast', 64, 65, 'Yes', 'Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Overcast', 81, 75, 'No', 'Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Rain', 71, 80, 'Yes', 'Do not Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Rain', 65, 70, 'Yes', 'Do not Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Rain', 75, 80, 'No', 'Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Rain', 68, 80, 'No', 'Play');<br />

INSERT INTO <strong>PAL</strong>_CART_DATA_TBL VALUES ('Rain', 70, 96, 'No', 'Play');<br />

DROP TABLE #<strong>PAL</strong>_CONTROL_TBL;<br />

CREATE LOCAL TEMPORARY COLUMN TABLE #<strong>PAL</strong>_CONTROL_TBL(<br />

"NAME" VARCHAR (100),<br />

"INTARGS" INTEGER,<br />

"DOUBLEARGS" DOUBLE,<br />

"STRINGARGS" VARCHAR (100)<br />

);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('THREAD_NUMBER',2,null,null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('SPLIT_CRITERIA', 103, null, null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('SPLIT_THRESHOLD', null, 0.001, null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('MAX_DEPTH', 5, null, null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('MIN_RECORDS_OF_PARENT', 2, null, null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('MIN_RECORDS_OF_LEAF',1, null, null);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('PMML_EXPORT', 2, null, null);<br />

DROP TABLE <strong>PAL</strong>_CART_TREEMODEL_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_CART_TREEMODEL_TBL LIKE <strong>PAL</strong>_CART_TREEMODEL_T;<br />

DROP TABLE <strong>PAL</strong>_CART_STATISTIC_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_CART_STATISTIC_TBL LIKE <strong>PAL</strong>_CART_STATISTIC_T;<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_CART_PROC(<strong>PAL</strong>_CART_DATA_TBL, #<strong>PAL</strong>_CONTROL_TBL,<br />

<strong>PAL</strong>_CART_TREEMODEL_TBL, <strong>PAL</strong>_CART_STATISTIC_TBL) with OVERVIEW;<br />

SELECT * FROM <strong>PAL</strong>_CART_TREEMODEL_TBL;<br />

SELECT * FROM <strong>PAL</strong>_CART_STATISTIC_TBL;<br />

Expected Result:<br />

<strong>PAL</strong>_CART_TREEMODEL_TBL:<br />

<strong>PAL</strong>_CART_STATISTIC_TBL:<br />

3.2.5 CHAID Decision Tree<br />

CHAID stands for CHi-squared Automatic Interaction Detection. It is similar to the C4.5 decision tree. CHAID is<br />

a classification method for building decision trees by using chi-square statistics to identify optimal splits.<br />

CHAID examines the cross tabulations between each of the input fields and the outcome, and tests for<br />

significance using a chi-square independence test. If more than one of these relations is statistically<br />

significant, CHAID will select the input field that is the most significant (smallest p value). CHAID can generate<br />

non-binary trees.<br />

150 P U B L I C<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Predictive</strong> <strong>Analysis</strong> <strong>Library</strong> (<strong>PAL</strong>)<br />

<strong>PAL</strong> Functions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!