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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (13, 15.5, 'C', 16.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (14, 15.6, 'D', 16.2);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (15, 15.5, 'D', 0.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (16, 16.5, 'D', 0.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (17, 16.5, 'D', 1.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (18, 15.5, 'D', 1.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (19, 15.7, 'A', 1.6);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_ASSIGNED_TBL LIKE <strong>PAL</strong>_KMEANS_ASSIGNED_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_CENTERS_TBL LIKE <strong>PAL</strong>_KMEANS_CENTERS_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_SIL_CENTERS_TBL LIKE <strong>PAL</strong>_KMEANS_SIL_CENTERS_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_STATISTIC_TBL LIKE <strong>PAL</strong>_KMEANS_STATISTIC_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_MODEL_TBL LIKE <strong>PAL</strong>_KMEANS_MODEL_T;<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_KMEANS_PROC(<strong>PAL</strong>_KMEANS_DATA_TBL, #<strong>PAL</strong>_CONTROL_TBL,<br />

<strong>PAL</strong>_KMEANS_ASSIGNED_TBL, <strong>PAL</strong>_KMEANS_CENTERS_TBL, <strong>PAL</strong>_KMEANS_SIL_CENTERS_TBL,<br />

<strong>PAL</strong>_KMEANS_STATISTIC_TBL, <strong>PAL</strong>_KMEANS_MODEL_TBL) with OVERVIEW;<br />

-------- NEXT CLUSTER ASSIGNMENT ----------<br />

DROP TYPE <strong>PAL</strong>_CLUSTER_ASSIGNED_T;<br />

CREATE TYPE <strong>PAL</strong>_CLUSTER_ASSIGNED_T AS TABLE(<br />

"ID" INTEGER,<br />

"CLUSTER" INTEGER,<br />

"DISTANCE" DOUBLE<br />

);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL("POSITION" INT,<br />

"SCHEMA_NAME" NVARCHAR(256), "TYPE_NAME" NVARCHAR(256), "PARAMETER_TYPE"<br />

VARCHAR(7));<br />

INSERT INTO <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL VALUES (1, 'DM_<strong>PAL</strong>',<br />

'<strong>PAL</strong>_KMEANS_DATA_T', 'IN');<br />

INSERT INTO <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL VALUES (2, 'DM_<strong>PAL</strong>',<br />

'<strong>PAL</strong>_KMEANS_MODEL_T', 'IN');<br />

INSERT INTO <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL VALUES (3, 'DM_<strong>PAL</strong>',<br />

'<strong>PAL</strong>_CONTROL_T', 'IN');<br />

INSERT INTO <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL VALUES (4, 'DM_<strong>PAL</strong>',<br />

'<strong>PAL</strong>_CLUSTER_ASSIGNED_T', 'OUT');<br />

CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_DROP('DM_<strong>PAL</strong>',<br />

'<strong>PAL</strong>_CLUSTERASSIGNMENT_PROC');<br />

CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_CREATE('AFL<strong>PAL</strong>', 'CLUSTERASSIGNMENT',<br />

'DM_<strong>PAL</strong>', '<strong>PAL</strong>_CLUSTERASSIGNMENT_PROC', <strong>PAL</strong>_CLUSTERASSIGNMENT_PDATA_TBL);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_KMEANS_DATA_TBL LIKE <strong>PAL</strong>_KMEANS_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (0, 0.5, 'A', 0.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (1, 1.5, 'A', 7.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (2, 1.5, 'B', 15.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (3, 10.5, 'F', 1.5);<br />

INSERT INTO <strong>PAL</strong>_KMEANS_DATA_TBL VALUES (4, 2.1, 'B', 1.2);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_CLUSTER_ASSIGNED_TBL LIKE <strong>PAL</strong>_CLUSTER_ASSIGNED_T;<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_CLUSTERASSIGNMENT_PROC(<strong>PAL</strong>_KMEANS_DATA_TBL,<br />

<strong>PAL</strong>_KMEANS_MODEL_TBL, #<strong>PAL</strong>_CONTROL_TBL, <strong>PAL</strong>_CLUSTER_ASSIGNED_TBL) with OVERVIEW;<br />

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

Expected Result<br />

42 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!