SAP预测分析库(SAP Predictive Analysis Library,PAL)是SAP HANA中的一项功能,它允许我们在SAP HANA SQLScript过程中执行分析算法。

基于ABAP的SAP应用可以调用PAL提供的功能,包含分类,回归,聚类,关联规则,社交网络分析,推荐系统等。通常使用AMDP来实现调用。

AMDP(ABAP-Managed Database Procedures)是一种在SAP HANA中进行ABAP开发时可以使用的代码优化模式,简而言之,它可以让开发者在ABAP中写HANA数据库存储过程。

 

本文链接:https://www.cnblogs.com/hhelibeb/p/12610644.html

英文原文:An example to call PAL Apriori via AMDP

示例

接下来用一个例子来展示如何使用PAL。这里用到的PAL函数是Apriori

步骤一(可选) 熟悉使用SQLScript调用PAL函数

如果你已经熟悉PAL的HANA存储过程接口和它的调用,可以跳过这步。

通过HANA Studio连接HANA数据库,运行下面的脚本:

SET SCHEMAZHAOJE;DROP TABLEPAL_APRIORI_PARAMETER_TBL;CREATE COLUMN TABLEPAL_APRIORI_PARAMETER_TBL (
“PARAM_NAME ”
VARCHAR(100),
“INT_VALUE”
INTEGER,
“DOUBLE_VALUE”
DOUBLE,
“STRING_VALUE”
VARCHAR (100)
);
INSERT INTO PAL_APRIORI_PARAMETER_TBL VALUES (‘MIN_SUPPORT’, null, 0.1, null);INSERT INTO PAL_APRIORI_PARAMETER_TBL VALUES (‘MIN_CONFIDENCE’, null, 0.3, null);INSERT INTO PAL_APRIORI_PARAMETER_TBL VALUES (‘MIN_LIFT’, null, 1.1, null);INSERT INTO PAL_APRIORI_PARAMETER_TBL VALUES (‘MAX_CONSEQUENT’, 1, null, null);INSERT INTO PAL_APRIORI_PARAMETER_TBL VALUES (‘PMML_EXPORT’, 1, null, null);DROP TABLEPAL_APRIORI_TRANS_TBL;CREATE COLUMN TABLEPAL_APRIORI_TRANS_TBL (
“CUSTOMER”
INTEGER,
“ITEM”
VARCHAR(20)
);
INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (2, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (2, ‘item3’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (3, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (3, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (3, ‘item4’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (4, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (4, ‘item3’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (5, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (5, ‘item3’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (6, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (6, ‘item3’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (0, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (0, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (0, ‘item5’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (1, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (1, ‘item4’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (7, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (7, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (7, ‘item3’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (7, ‘item5’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (8, ‘item1’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (8, ‘item2’);INSERT INTO PAL_APRIORI_TRANS_TBL VALUES (8, ‘item3’);

CALL _SYS_AFL.PAL_APRIORI(PAL_APRIORI_TRANS_TBL, PAL_APRIORI_PARAMETER_TBL, ?, ?);

标签: none

添加新评论