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.

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

'<strong>PAL</strong>_WEIGHTEDTABLE_PROC', <strong>PAL</strong>_WS_PDATA_TBL);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_DATA_TBL LIKE <strong>PAL</strong>_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (0,'male',5000,1.73);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (1,'male',9000,1.80);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (2,'female',6000,1.55);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (3,'male',15000,1.65);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (4,'female',2000,1.70);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (5,'female',12000,1.65);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (6,'male',1000,1.65);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (7,'male',8000,1.60);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (8,'female',5500,1.85);<br />

INSERT INTO <strong>PAL</strong>_DATA_TBL VALUES (9,'female',9500,1.85);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_MAP_FUN_TBL LIKE <strong>PAL</strong>_MAP_FUN_T;<br />

INSERT INTO <strong>PAL</strong>_MAP_FUN_TBL VALUES ('male',2.0, 0,0.0, 1.5,0.0);<br />

INSERT INTO <strong>PAL</strong>_MAP_FUN_TBL VALUES ('female',1.5, 5500,1.0, 1.6,1.0);<br />

INSERT INTO <strong>PAL</strong>_MAP_FUN_TBL VALUES (null,0.0, 9000,2.0, 1.71,2.0);<br />

INSERT INTO <strong>PAL</strong>_MAP_FUN_TBL VALUES (null,0.0, 12000,3.0, 1.80,3.0);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_PARA_TBL LIKE <strong>PAL</strong>_PARA_T;<br />

INSERT INTO <strong>PAL</strong>_PARA_TBL VALUES (0.5,1,2);<br />

INSERT INTO <strong>PAL</strong>_PARA_TBL VALUES (2.0,-1,4);<br />

INSERT INTO <strong>PAL</strong>_PARA_TBL VALUES (1.0,-1,4);<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 />

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

CREATE COLUMN TABLE <strong>PAL</strong>_RESULT_TBL LIKE <strong>PAL</strong>_RESULT_T;<br />

CALL "DM_<strong>PAL</strong>".<strong>PAL</strong>_WEIGHTEDTABLE_PROC(<strong>PAL</strong>_DATA_TBL, <strong>PAL</strong>_MAP_FUN_TBL,<br />

<strong>PAL</strong>_PARA_TBL, #<strong>PAL</strong>_CONTROL_TBL, <strong>PAL</strong>_RESULT_TBL) with overview;<br />

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

Expected Result<br />

<strong>PAL</strong>_WT_RESULT_TBL:<br />

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

<strong>PAL</strong> Functions P U B L I C 551

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

Saved successfully!

Ooh no, something went wrong!