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.

NAME VARCHAR(50),<br />

INTARGS INTEGER,<br />

DOUBLEARGS DOUBLE,<br />

STRINGARGS VARCHAR(100)<br />

);<br />

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

CREATE TYPE <strong>PAL</strong>_SVM_MODEL_T AS TABLE( ID VARCHAR(50), MODEL VARCHAR(5000));<br />

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

CREATE TYPE <strong>PAL</strong>_SVM_RESULT_T AS TABLE( ID INTEGER, DECISION_VAL DOUBLE);<br />

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

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

NVARCHAR(256), "TYPE_NAME" NVARCHAR(256), "PARAMETER_TYPE" VARCHAR(7));<br />

INSERT INTO <strong>PAL</strong>_SVM_PDATA_TBL VALUES (1,'DM_<strong>PAL</strong>','<strong>PAL</strong>_SVM_SCORING_T','IN');<br />

INSERT INTO <strong>PAL</strong>_SVM_PDATA_TBL VALUES (2,'DM_<strong>PAL</strong>','<strong>PAL</strong>_CONTROL_T','IN');<br />

INSERT INTO <strong>PAL</strong>_SVM_PDATA_TBL VALUES (3,'DM_<strong>PAL</strong>','<strong>PAL</strong>_SVM_MODEL_T','IN');<br />

INSERT INTO <strong>PAL</strong>_SVM_PDATA_TBL VALUES (4,'DM_<strong>PAL</strong>','<strong>PAL</strong>_SVM_RESULT_T','OUT');<br />

CALL SYS.AFLLANG_WRAPPER_PROCEDURE_DROP('DM_<strong>PAL</strong>','<strong>PAL</strong>_SVM_PREDICT');<br />

CALL<br />

SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('AFL<strong>PAL</strong>','SVMPREDICT','DM_<strong>PAL</strong>','<strong>PAL</strong>_SVM_PRED<br />

ICT',<strong>PAL</strong>_SVM_PDATA_TBL);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SVM_SCORING_TBL LIKE <strong>PAL</strong>_SVM_SCORING_T;<br />

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

CREATE LOCAL TEMPORARY COLUMN TABLE #<strong>PAL</strong>_CONTROL_TBL LIKE <strong>PAL</strong>_CONTROL_T;<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_SVM_RESULT_TBL LIKE <strong>PAL</strong>_SVM_RESULT_T;<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(0,1,1,0,0.2,0,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(1,0,0,1,0.1,1,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(2,0,0,1,0.3,0,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(3,2,1,1,0.2,0,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(4,3,1,1,0.4,1,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(5,4,1,1,0.7,0,'qid:1');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(6,0,0,1,0.2,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(7,1,0,1,0.4,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(8,0,0,1,0.2,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(9,1,1,1,0.2,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(10,2,2,1,0.4,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(11,3,3,1,0.2,0,'qid:4');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(12,0,0,1,0.1,1,'qid:5');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(13,1,0,0,0.4,1,'qid:5');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(14,0,1,1,0.5,0,'qid:5');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(15,1,1,1,0.5,1,'qid:5');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(16,2,2,0,0.7,1,'qid:5');<br />

INSERT INTO <strong>PAL</strong>_SVM_SCORING_TBL VALUES(17,1,3,1,1.5,0,'qid:5');<br />

CALL<br />

DM_<strong>PAL</strong>.<strong>PAL</strong>_SVM_PREDICT(<strong>PAL</strong>_SVM_SCORING_TBL,#<strong>PAL</strong>_CONTROL_TBL,<strong>PAL</strong>_SVM_MODEL_TBL_EX2<br />

,<strong>PAL</strong>_SVM_RESULT_TBL) WITH OVERVIEW;<br />

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

Expected Result<br />

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