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>_KMEANS_DATA_TBL VALUES (12, 16.5, 'C', 16.5);<br />

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>_CONV2_OUT_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_CONV2_OUT_TBL LIKE <strong>PAL</strong>_CONV2_OUT_T;<br />

DROP VIEW <strong>PAL</strong>_CONV2_IN_V;<br />

CREATE VIEW <strong>PAL</strong>_CONV2_IN_V AS SELECT "ID", "V001" FROM <strong>PAL</strong>_KMEANS_DATA_TBL;<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 ('OUT_PUT_COLUMNS', 5, null, null);<br />

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

--call procedure<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_CONV2BINARY_PROC(<strong>PAL</strong>_CONV2_IN_V, #<strong>PAL</strong>_CONTROL_TBL,<br />

<strong>PAL</strong>_CONV2_OUT_TBL) with OVERVIEW;<br />

--prepare data<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL LIKE <strong>PAL</strong>_SILHOUETTE_ASSIGN_T;<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (0, 0);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (1, 0);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (2, 0);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (3, 0);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (4, 0);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (5, 1);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (6, 1);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (7, 1);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (8, 1);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (9, 1);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (10, 2);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (11, 2);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (12, 2);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (13, 2);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (14, 2);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (15, 3);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (16, 3);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (17, 3);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (18, 3);<br />

INSERT INTO <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL VALUES (19, 3);<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 ('VARIABLE_NUM', 6, null, null);<br />

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

DROP VIEW <strong>PAL</strong>_SILHOUETTE_V;<br />

CREATE VIEW <strong>PAL</strong>_SILHOUETTE_V AS (<br />

SELECT A."ID", "V000", "A0", "A1", "A2", "A3", "V002" FROM<br />

<strong>PAL</strong>_KMEANS_DATA_TBL AS A JOIN <strong>PAL</strong>_CONV2_OUT_TBL AS B ON A.ID=B.ID<br />

);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SILHOUETTE_RESULT_TBL LIKE <strong>PAL</strong>_SILHOUETTE_RESULT_T;<br />

--call procedure<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_SILHOUETTE_PROC(<strong>PAL</strong>_SILHOUETTE_V, <strong>PAL</strong>_SILHOUETTE_ASSIGN_TBL,<br />

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

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

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