具有时间戳类型的SAP自动预测库而不是日期

时间:2016-07-25 12:28:19

标签: sap hana

我想使用Automated Predictive Library APL执行一些分析,如回归/分类,聚类或时间序列。 我有一个Timestamp类型的表(23.09.2011 19:30:00.0,23.09.2011 19:45:00.0,23.09.2011 20:00:00.0 ....)我创建了一个APL模型,但我得到了空表for" MODEL_TRAIN_BIN"," OPERATION_LOG"," SUMMARY"和"指标"

我尝试过火车并申请但是我收到了这个错误: [APL错误]自动分析错误(-2147024809):阶段' KxCPPInterf :: IKxenModel :: sendMode()' [[Root [7f2c5ed9f800]:日期变量(ZEITSTEMPEL)无效。这是不变的。 ]

我想知道我们是否可以使用Timestamp类型执行时间序列,还是应该只使用Date变量。

提前致谢

这是SQL:

  drop type IST_VERBRAUCH_T;  
create type IST_VERBRAUCH_T as table (  
  "ZEITSTEMPEL" TIMESTAMP,  
  "IST_VERBRAUCH" DECIMAL(10,3)  
);  
-- --------------------------------------------------------------------------  
-- Create table type for the forecast output  
-- --------------------------------------------------------------------------  
drop type IST_VERBRAUCH_OUT_T;  
create type IST_VERBRAUCH_OUT_T as table (  
  "ZEITSTEMPEL" TIMESTAMP,  
  "IST_VERBRAUCH" DECIMAL(10,3),  
  "kts_1" DOUBLE  
);  
-- --------------------------------------------------------------------------  
-- Create AFL wrappers for the APL function  
-- --------------------------------------------------------------------------  
-- the AFL wrapper generator needs the signature of the expected stored proc  
drop table FORECAST_SIGNATURE;  
create column table FORECAST_SIGNATURE like PROCEDURE_SIGNATURE_T;  
insert into FORECAST_SIGNATURE values (1, 'USER_APL','FUNCTION_HEADER_T', 'IN');  
insert into FORECAST_SIGNATURE values (2, 'USER_APL','OPERATION_CONFIG_T', 'IN');  
insert into FORECAST_SIGNATURE values (3, 'USER_APL','VARIABLE_DESC_T', 'IN');  
insert into FORECAST_SIGNATURE values (4, 'USER_APL','VARIABLE_ROLES_T', 'IN');  
insert into FORECAST_SIGNATURE values (5, 'USER_APL','IST_VERBRAUCH_T', 'IN');  
insert into FORECAST_SIGNATURE values (6, 'USER_APL','IST_VERBRAUCH_OUT_T', 'OUT');  
insert into FORECAST_SIGNATURE values (7, 'USER_APL','OPERATION_LOG_T', 'OUT');  
insert into FORECAST_SIGNATURE values (8, 'USER_APL','SUMMARY_T', 'OUT');  
insert into FORECAST_SIGNATURE values (9, 'USER_APL','INDICATORS_T', 'OUT');  
call SYS.AFLLANG_WRAPPER_PROCEDURE_DROP('USER_APL','APLWRAPPER_FORECAST');  
call SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('APL_AREA','FORECAST','USER_APL', 'APLWRAPPER_FORECAST', FORECAST_SIGNATURE);  
-- --------------------------------------------------------------------------  
-- Create the input/output tables used as arguments for the APL function  
-- --------------------------------------------------------------------------  
drop table FUNC_HEADER;  
create table FUNC_HEADER like FUNCTION_HEADER_T;  
insert into FUNC_HEADER values ('Oid', '#42');  
insert into FUNC_HEADER values ('LogLevel', '8');  
-- Create a view which contains the sorted dataset  
drop view IST_VERBRAUCH_SORTED;  
create view IST_VERBRAUCH_SORTED as select "ZEITSTEMPEL","IST_VERBRAUCH" from POC_ENVIAM_APP.IST_VERBRAUCH order by "ZEITSTEMPEL" asc;  
drop table FORECAST_CONFIG;  
create table FORECAST_CONFIG like OPERATION_CONFIG_T;  
insert into FORECAST_CONFIG values ('APL/Horizon', '21');  
insert into FORECAST_CONFIG values ('APL/TimePointColumnName', 'ZEITSTEMPEL');  
insert into FORECAST_CONFIG values ('APL/LastTrainingTimePoint', '23.09.2011 19:30:00.0');  
drop table VARIABLE_DESC;  
create table VARIABLE_DESC like VARIABLE_DESC_T;  
drop table VARIABLE_ROLES;  
create table VARIABLE_ROLES like VARIABLE_ROLES_T;  
insert into VARIABLE_ROLES values ('ZEITSTEMPEL', 'input');  
insert into VARIABLE_ROLES values ('IST_VERBRAUCH', 'target');  
drop table FORECAST_OUT;  
create table FORECAST_OUT like IST_VERBRAUCH_OUT_T;  
drop table OPERATION_LOG;  
create table OPERATION_LOG like OPERATION_LOG_T;  
drop table SUMMARY;  
create table SUMMARY like SUMMARY_T;  
drop table INDICATORS;  
create table INDICATORS like INDICATORS_T;  
-- --------------------------------------------------------------------------  
-- Execute the APL function using its AFL wrapper and the actual input/output tables  
-- --------------------------------------------------------------------------  
call APLWRAPPER_FORECAST(FUNC_HEADER, FORECAST_CONFIG, VARIABLE_DESC, VARIABLE_ROLES, USER_APL.IST_VERBRAUCH_SORTED, FORECAST_OUT, OPERATION_LOG, SUMMARY, INDICATORS) with overview;  
select * from "USER_APL"."FORECAST_OUT" order by "ZEITSTEMPEL" asc;  
select * from "USER_APL"."OPERATION_LOG";  
select * from "USER_APL"."SUMMARY";  
select * from "USER_APL"."INDICATORS";  

1 个答案:

答案 0 :(得分:1)

这已在此处讨论和回答http://scn.sap.com/thread/3936133