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.

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 TABLE <strong>PAL</strong>_SVM_PDATA_TBL;<br />

CREATE TABLE <strong>PAL</strong>_SVM_PDATA_TBL("POSITION" INT, "SCHEMA_NAME" NVARCHAR(256),<br />

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

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

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

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

CALL SYS.AFLLANG_WRAPPER_PROCEDURE_DROP('SYSTEM','<strong>PAL</strong>_SVM_TRAIN');<br />

CALL<br />

SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('AFL<strong>PAL</strong>','SVMTRAIN','SYSTEM','<strong>PAL</strong>_SVM_TRAIN'<br />

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

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

CREATE COLUMN TABLE <strong>PAL</strong>_SVM_TRAINING_TBL LIKE <strong>PAL</strong>_SVM_TRAINING_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_MODEL_TBL_EX3;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_SVM_MODEL_TBL_EX3 LIKE <strong>PAL</strong>_SVM_MODEL_T;<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(0,1,10,100,'A',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(1,1.1,10.1,100,'A',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(2,1.2,10.2,100,'A',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(3,1.3,10.4,100,'A',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(4,1.2,10.3,100,'AB',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(5,4,40,400,'AB',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(6,4.1,40.1,400,'AB',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(7,4.2,40.2,400,'AB',1);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(8,4.3,40.4,400,'AB',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(9,4.2,40.3,400,'AB',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(10,9,90,900,'B',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(11,9.1,90.1,900,'A',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(12,9.2,90.2,900,'B',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(13,9.3,90.4,900,'A',2);<br />

INSERT INTO <strong>PAL</strong>_SVM_TRAINING_TBL VALUES(14,9.2,90.3,900,'A',2);<br />

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

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

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

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

CALL<br />

SYSTEM.<strong>PAL</strong>_SVM_TRAIN(<strong>PAL</strong>_SVM_TRAINING_TBL,#<strong>PAL</strong>_CONTROL_TBL,<strong>PAL</strong>_SVM_MODEL_TBL_EX3)<br />

WITH OVERVIEW;<br />

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

Expected Result<br />

SVMPREDICT<br />

This function uses the training model generated by SVMTRAIN to make predictive analysis.<br />

Procedure Generation<br />

CALL SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE (‘AFL<strong>PAL</strong>’, ‘SVMPREDICT’,<br />

‘’, '', );<br />

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