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.

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

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

INSERT INTO <strong>PAL</strong>_ENET_MLR_PDATA_TBL values (1,'DM_<strong>PAL</strong>','<strong>PAL</strong>_ENET_MLR_DATA_T',<br />

'IN');<br />

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

INSERT INTO <strong>PAL</strong>_ENET_MLR_PDATA_TBL values (3,'DM_<strong>PAL</strong>','<strong>PAL</strong>_ENET_MLR_RESULT_T',<br />

'OUT');<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_PDATA_TBL values (4,'DM_<strong>PAL</strong>','<strong>PAL</strong>_ENET_MLR_FITTED_T',<br />

'OUT');<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_PDATA_TBL values<br />

(5,'DM_<strong>PAL</strong>','<strong>PAL</strong>_ENET_MLR_SIGNIFICANCE_T', 'OUT');<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_PDATA_TBL values<br />

(6,'DM_<strong>PAL</strong>','<strong>PAL</strong>_ENET_MLR_PMMLMODEL_T', 'OUT');<br />

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

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

'<strong>PAL</strong>_ENET_MLR_PROC', <strong>PAL</strong>_ENET_MLR_PDATA_TBL);<br />

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

CREATE LOCAL TEMPORARY COLUMN TABLE #<strong>PAL</strong>_CONTROL_TBL ("NAME"<br />

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

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

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

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

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

CREATE COLUMN TABLE <strong>PAL</strong>_ENET_MLR_DATA_TBL ( "ID" INT,"Y" DOUBLE,"V1" DOUBLE,"V2"<br />

DOUBLE,"V3" DOUBLE);<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_DATA_TBL VALUES (0, 1.2, 0.1, 0.205, 0.9);<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_DATA_TBL VALUES (1, 0.2, -1.705, -3.4, 1.7);<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_DATA_TBL VALUES (2, 1.1, 0.4, 0.8, 0.5);<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_DATA_TBL VALUES (3, 1.1, 0.1, 0.201, 0.8);<br />

INSERT INTO <strong>PAL</strong>_ENET_MLR_DATA_TBL VALUES (4, 0.3, -0.306, -0.6, 0.2);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_ENET_MLR_RESULTS_TBL ("Coefficient"<br />

varchar(50),"CoefficientValue" DOUBLE);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_ENET_MLR_FITTED_TBL ("ID" INT,"Fitted" DOUBLE);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_ENET_MLR_SIGNIFICANCE_TBL ("NAME" varchar(50),"VALUE"<br />

DOUBLE);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_ENET_MLR_PMMLMODEL_TBL ("ID" INT, "PMMLMODEL"<br />

VARCHAR(5000));<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_ENET_MLR_PROC(<strong>PAL</strong>_ENET_MLR_DATA_TBL,"#<strong>PAL</strong>_CONTROL_TBL",<br />

<strong>PAL</strong>_ENET_MLR_RESULTS_TBL, <strong>PAL</strong>_ENET_MLR_FITTED_TBL,<br />

<strong>PAL</strong>_ENET_MLR_SIGNIFICANCE_TBL, <strong>PAL</strong>_ENET_MLR_PMMLMODEL_TBL) WITH OVERVIEW;<br />

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

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

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

Expected Results<br />

<strong>PAL</strong>_ENET_MLR_RESULTS_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 273

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

Saved successfully!

Ooh no, something went wrong!