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.

Table Column Column Data Type Description Constraint<br />

2nd column Integer or double Value A i<br />

●<br />

●<br />

●<br />

●<br />

A 0 : intercept<br />

A 1 : beta coefficient<br />

for X 1<br />

A 2 : beta coefficient<br />

for X 2<br />

…<br />

Fitted Data 1st column Integer, bigint, varchar,<br />

or nvarchar<br />

ID<br />

2nd column Integer or double Value Y i<br />

Significance 1st column Varchar or nvarchar Name (R^2 / F)<br />

2nd column Double Value<br />

PMML Result 1st column Integer ID<br />

2nd column<br />

CLOB, varchar, or<br />

nvarchar<br />

Logarithmic regression<br />

model in PMML<br />

format<br />

Example<br />

Assume that:<br />

●<br />

●<br />

●<br />

DM_<strong>PAL</strong> is a schema belonging to USER1; and<br />

USER1 has been assigned the AFLPM_CREATOR_ERASER_EXECUTE role; and<br />

USER1 has been assigned the AFL__SYS_AFL_AFL<strong>PAL</strong>_EXECUTE or<br />

AFL__SYS_AFL_AFL<strong>PAL</strong>_EXECUTE_WITH_GRANT_OPTION role.<br />

SET SCHEMA DM_<strong>PAL</strong>;<br />

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

CREATE TYPE <strong>PAL</strong>_NLR_DATA_T AS TABLE( "ID" INT,"Y" DOUBLE,"X1" DOUBLE);<br />

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

CREATE TYPE <strong>PAL</strong>_NLR_RESULT_T AS TABLE("ID" INT,"Ai" DOUBLE);<br />

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

CREATE TYPE <strong>PAL</strong>_NLR_FITTED_T AS TABLE("ID" INT,"Fitted" DOUBLE);<br />

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

CREATE TYPE <strong>PAL</strong>_NLR_SIGNIFICANCE_T AS TABLE("NAME" varchar(50),"VALUE" DOUBLE);<br />

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

CREATE TYPE <strong>PAL</strong>_CONTROL_T AS TABLE("NAME" VARCHAR(100), "INTARGS" INT,<br />

"DOUBLEARGS" DOUBLE,"STRINGARGS" VARCHAR(100));<br />

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

CREATE TYPE <strong>PAL</strong>_NLR_PMMLMODEL_T AS TABLE("ID" INT,"Model" varchar(5000));<br />

DROP table <strong>PAL</strong>_NLR_PDATA_TBL;<br />

CREATE column table <strong>PAL</strong>_NLR_PDATA_TBL("POSITION" INT, "SCHEMA_NAME"<br />

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

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (1,'DM_<strong>PAL</strong>','<strong>PAL</strong>_NLR_DATA_T','IN');<br />

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (2,'DM_<strong>PAL</strong>','<strong>PAL</strong>_CONTROL_T','IN');<br />

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (3,'DM_<strong>PAL</strong>','<strong>PAL</strong>_NLR_RESULT_T','OUT');<br />

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (4,'DM_<strong>PAL</strong>','<strong>PAL</strong>_NLR_FITTED_T','OUT');<br />

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (5,'DM_<strong>PAL</strong>','<strong>PAL</strong>_NLR_SIGNIFICANCE_T','OUT');<br />

insert into <strong>PAL</strong>_NLR_PDATA_TBL values (6,'DM_<strong>PAL</strong>','<strong>PAL</strong>_NLR_PMMLMODEL_T','OUT');<br />

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

CALL<br />

SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('AFL<strong>PAL</strong>','LNREGRESSION','DM_<strong>PAL</strong>','<strong>PAL</strong>_LNR_PR<br />

OC',<strong>PAL</strong>_NLR_PDATA_TBL);<br />

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

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