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.

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

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

"ID" INT,<br />

"CLASSLABEL" VARCHAR(50)<br />

);<br />

-- create procedure<br />

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

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

"POSITION" INT,<br />

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

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

"PARAMETER_TYPE" VARCHAR(7)<br />

);<br />

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

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

INSERT INTO <strong>PAL</strong>_PCDT_PDATA_TBL VALUES (3, 'DM_<strong>PAL</strong>', '<strong>PAL</strong>_PCDT_JSONMODEL_T',<br />

'IN');<br />

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

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

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

'<strong>PAL</strong>_PREDICTWITHDT_PROC', <strong>PAL</strong>_PCDT_PDATA_TBL);<br />

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

CREATE COLUMN TABLE <strong>PAL</strong>_PCDT_DATA_TBL LIKE <strong>PAL</strong>_PCDT_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_PCDT_DATA_TBL VALUES (10, 20, 100003);<br />

INSERT INTO <strong>PAL</strong>_PCDT_DATA_TBL VALUES (11, 30, 200003);<br />

INSERT INTO <strong>PAL</strong>_PCDT_DATA_TBL VALUES (12, 40, 400003);<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>_PCDT_RESULT_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_PCDT_RESULT_TBL LIKE <strong>PAL</strong>_PCDT_RESULT_T;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_PREDICTWITHDT_PROC(<strong>PAL</strong>_PCDT_DATA_TBL, "#<strong>PAL</strong>_CONTROL_TBL",<br />

<strong>PAL</strong>_CDT_JSONMODEL_TBL, <strong>PAL</strong>_PCDT_RESULT_TBL) WITH OVERVIEW;<br />

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

The expected prediction result is as follows:<br />

4.2 Scenario: Analyze the Cash Flow of an Investment on a<br />

New Product<br />

We wish to do an analysis of the cash flow of an investment required to create a new product. Projected<br />

estimates are given for the product revenue, product costs, overheads, and capital investment for each year of<br />

the analysis, from which the cash flow can be calculated. For capital investment appraisal the cash flows are<br />

summed for each year and discounted for future values, in other words the net present value of the cash flow<br />

is derived as a single value measuring the benefit of the investment.<br />

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