[Step By Step]SAP HANA PAL逻辑回归预测分析Logistic Regression编程实例LOGISTICREGRESSION(模型)

逻辑回归预测分析编程规范(模型):http://www.cnblogs.com/omygod/archive/2013/05/15/3080437.html

逻辑回归预测分析编程规范(预测):http://www.cnblogs.com/omygod/archive/2013/05/15/3080441.html

 

 

-- PAL setup 
SET SCHEMA _SYS_AFL; 
CREATE TYPE PAL_T_RGEL_DATA AS TABLE (LIFESPEND INTEGER, GENDER INTEGER); 
truncate table PAL_RG_SIGNATURE; 
INSERT INTO PAL_RG_SIGNATURE VALUES (1, 'PAL_T_RGEL_DATA', 'in'); 
INSERT INTO PAL_RG_SIGNATURE VALUES (2, 'PAL_T_RG_PARAMS', 'in'); 
INSERT INTO PAL_RG_SIGNATURE VALUES (3, 'PAL_T_RG_COEFF', 'out'); 
INSERT INTO PAL_RG_SIGNATURE VALUES (4, 'PAL_T_RG_PMML', 'out'); 
--call system.AFL_WRAPPER_ERASER ('PAL_RG'); 
CALL SYSTEM.AFL_WRAPPER_GENERATOR ('PAL_RGEL', 'AFLPAL', 'LOGISTICREGRESSION', PAL_RG_SIGNATURE);

-- app setup 
SET SCHEMA PAL; 
--drop view V_RG_DATA; 
CREATE VIEW V_RGEL_DATA AS 
    SELECT TOP 1000 l.LIFESPEND, c.CUSTOMER_GENDER_ID AS GENDER 
     FROM CUSTOMER c 
     INNER JOIN ( 
            SELECT CUSTOMER_ID, SUM(SALES_AMOUNT) AS LIFESPEND 
             FROM ORDER_FACTS 
             GROUP BY CUSTOMER_ID 
                ) l ON(c.CUSTOMER_ID = l.CUSTOMER_ID) 
     ;

truncate table RG_PARAMS; 
INSERT INTO RG_PARAMS VALUES ('THREAD_NUMBER', 2, null, null); 
INSERT INTO RG_PARAMS VALUES ('MAX_ITERATION', 1000, null, null); 
INSERT INTO RG_PARAMS VALUES ('EXIT_THRESHOLD', null, 0.00001, null); 
INSERT INTO RG_PARAMS VALUES ('VARIABLE_NUM', 1, null, null); 
INSERT INTO RG_PARAMS VALUES ('METHOD', 0, null, null); 
INSERT INTO RG_PARAMS VALUES ('PMML_EXPORT', 2, null, null); 
--INSERT INTO RG_PARAMS VALUES ('STEP_SIZ', 100, null, null);

-- app runtime 
SET SCHEMA PAL; 
TRUNCATE TABLE RG_COEFF; 
TRUNCATE TABLE RG_PMML;

CALL _SYS_AFL.PAL_RGEL (V_RGEL_DATA, RG_PARAMS, RG_COEFF, RG_PMML) WITH OVERVIEW;


select *   from V_RG_DATA 
select * from RG_COEFF

专注于企业信息化,最近对股票数据分析较为感兴趣,可免费分享股票个股主力资金实时变化趋势分析工具,股票交流QQ群:457394862
分类: SAP HANA

本文转自沧海-重庆博客园博客,原文链接:http://www.cnblogs.com/omygod/archive/2013/05/16/3081367.html,如需转载请自行联系原作者
上一篇:一次快速闪回区满导致数据库不能启动的解决过程


下一篇:instance和client