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.

INSERT INTO <strong>PAL</strong>_DISTRPROB_DATA_TBL VALUES (42);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRPROB_DISTRPARAM_TBL LIKE <strong>PAL</strong>_DISTRPROB_DISTRPARAM_T;<br />

INSERT INTO <strong>PAL</strong>_DISTRPROB_DISTRPARAM_TBL VALUES ('DistributionName', 'Weibull');<br />

INSERT INTO <strong>PAL</strong>_DISTRPROB_DISTRPARAM_TBL VALUES ('Shape', '1.40528');<br />

INSERT INTO <strong>PAL</strong>_DISTRPROB_DISTRPARAM_TBL VALUES ('Scale', '36.3069');<br />

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

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

"NAME" VARCHAR (50),<br />

"INTARGS" INTEGER,<br />

"DOUBLEARGS" DOUBLE,<br />

"STRINGARGS" VARCHAR (100)<br />

);<br />

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

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

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRPROB_RESULT_TBL LIKE <strong>PAL</strong>_DISTRPROB_RESULT_T;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRPROB_PROC(<strong>PAL</strong>_DISTRPROB_DATA_TBL,<br />

<strong>PAL</strong>_DISTRPROB_DISTRPARAM_TBL, #<strong>PAL</strong>_CONTROL_TBL, <strong>PAL</strong>_DISTRPROB_RESULT_TBL) WITH<br />

OVERVIEW;<br />

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

The expected result is as follows:<br />

Step 4<br />

Get the CDF (cumulative distribution function) of Weibull distribution for the control treatment data:<br />

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

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

CREATE TYPE <strong>PAL</strong>_DISTRPROB_DATA_T AS TABLE("DATACOL" DOUBLE);<br />

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

CREATE TYPE <strong>PAL</strong>_DISTRPROB_DISTRPARAM_T AS TABLE(<br />

"NAME" VARCHAR(50),<br />

"VALUE" VARCHAR(50)<br />

);<br />

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

CREATE TYPE <strong>PAL</strong>_DISTRPROB_RESULT_T AS TABLE(<br />

"INPUTDATA" DOUBLE,<br />

"PROBABILITY" DOUBLE<br />

);<br />

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

CREATE TYPE <strong>PAL</strong>_CONTROL_T AS TABLE(<br />

"NAME" VARCHAR (50),<br />

"INTARGS" INTEGER,<br />

"DOUBLEARGS" DOUBLE,<br />

"STRINGARGS" VARCHAR (100)<br />

);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRPROB_PDATA_TBL(<br />

"POSITION" INT,<br />

"SCHEMA_NAME" NVARCHAR(256),<br />

"TYPE_NAME" NVARCHAR(256),<br />

"PARAMETER_TYPE" VARCHAR(7)<br />

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

End-to-End Scenarios

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

Saved successfully!

Ooh no, something went wrong!