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>_SOM_DATA_TBL VALUES (18, 55.3, 50.4);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (19, 50.4, 56.5);<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 ('MAX_ITERATION', 3000, null, null);<br />

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

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

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

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

CREATE COLUMN TABLE <strong>PAL</strong>_SOM_MAP_TBL LIKE <strong>PAL</strong>_SOM_MAP_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SOM_RESASSIGN_TBL LIKE <strong>PAL</strong>_SOM_RESASSIGN_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SOM_MODEL_TBL LIKE <strong>PAL</strong>_SOM_MODEL_T;<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_SELF_ORG_MAP_PROC(<strong>PAL</strong>_SOM_DATA_TBL, #<strong>PAL</strong>_CONTROL_TBL,<br />

<strong>PAL</strong>_SOM_MAP_TBL, <strong>PAL</strong>_SOM_RESASSIGN_TBL, <strong>PAL</strong>_SOM_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>_SOM_DATA_T', 'IN');<br />

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

'<strong>PAL</strong>_SOM_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>_SOM_DATA_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_SOM_DATA_TBL LIKE <strong>PAL</strong>_SOM_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (0, 0.1, 0.2);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (1, 0.22, 0.25);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (2, 15.3, 5.4);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (3, 5.4, 6.5);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (4, 55.3, 50.4);<br />

INSERT INTO <strong>PAL</strong>_SOM_DATA_TBL VALUES (5, 50.4, 56.5);<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>_SOM_DATA_TBL, <strong>PAL</strong>_SOM_MODEL_TBL,<br />

#<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 />

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