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>_DBSCAN_DATA_TBL VALUES(28,16.11,16.11, 'A');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES(29,20.11,20.12, 'C');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES(30,15.12,15.11, 'A');<br />

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

CREATE LOCAL TEMPORARY COLUMN TABLE #<strong>PAL</strong>_CONTROL_TBL( NAME varchar(50), INTARGS<br />

integer, DOUBLEARGS double, STRINGARGS varchar(100));<br />

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

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

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

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

CREATE COLUMN TABLE <strong>PAL</strong>_DBSCAN_RESULTS_TBL( ID integer, RESULT integer);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_DBSCAN_MODEL_TBL like <strong>PAL</strong>_DBSCAN_MODEL_T;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DBSCAN(<strong>PAL</strong>_DBSCAN_DATA_TBL, "#<strong>PAL</strong>_CONTROL_TBL",<br />

<strong>PAL</strong>_DBSCAN_RESULTS_TBL, <strong>PAL</strong>_DBSCAN_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>_DBSCAN_DATA_T', 'IN');<br />

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

'<strong>PAL</strong>_DBSCAN_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>_DBSCAN_DATA_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_DBSCAN_DATA_TBL LIKE <strong>PAL</strong>_DBSCAN_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES (1,0.10, 0.10, 'B');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES (2,0.10, -2.10, 'A');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES (3,3.10,0.10, 'B');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES (4,10.10,10.10, 'D');<br />

INSERT INTO <strong>PAL</strong>_DBSCAN_DATA_TBL VALUES (5,3.10,-0.50, 'C');<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>_DBSCAN_DATA_TBL,<br />

<strong>PAL</strong>_DBSCAN_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 />

<strong>PAL</strong>_CLUSTER_ASSIGNED_TBL:<br />

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