-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
i317814
committed
Mar 28, 2023
1 parent
2ca1b4d
commit 6c5f351
Showing
11 changed files
with
203 additions
and
23 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
runtimes/cpp/Sample/win_X64-WIN64-VC15.mak → runtimes/cpp/Sample/win_X64-WIN64-VC22.mak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright....: (c) SAP 1999-2021 | ||
# Project......: | ||
# Library......: | ||
# File.........: win.mak | ||
# Author.......: | ||
# Created......: Tue Mar 09 16:51:38 2010 | ||
# Description..: | ||
# | ||
# CVS infos....: | ||
# .............. $Id: win_X64-WIN64.mak,v 1.2 2012/05/30 10:28:17 port Exp $ | ||
# .............. $Date: 2012/05/30 10:28:17 $ | ||
# .............. $Revision: 1.2 $ | ||
# ---------------------------------------------------------------------------- | ||
|
||
# Some macros for SUN OS compiler | ||
# ---------------------------------------------------------------------------- | ||
# Copyright....: (c) SAP 1999-2023 | ||
# Project......: | ||
# Library......: | ||
# File.........: win.mak | ||
# Author.......: | ||
# Created......: Tue Mar 09 16:51:38 2010 | ||
# Description..: | ||
# | ||
# CVS infos....: | ||
# .............. $Id: win_X64-WIN64.mak,v 1.2 2012/05/30 10:28:17 port Exp $ | ||
# .............. $Date: 2012/05/30 10:28:17 $ | ||
# .............. $Revision: 1.2 $ | ||
# ---------------------------------------------------------------------------- | ||
|
||
# Some macros for SUN OS compiler | ||
include win_X64-WIN64.mak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
sql/procedure/apl_samples/timeseries/apl_create_model_train_apply_debrief.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
-- @required(hanaMinimumVersion,2.0.40) | ||
-- ================================================================ | ||
-- APL_AREA, FORECAST | ||
-- Description : | ||
-- Assumption 1: the users & privileges have been created & granted (see apl_admin_ex.sql). | ||
-- @depend(apl_apply_proc.sql) | ||
|
||
connect USER_APL password Password1; | ||
SET SESSION 'APL_CACHE_SCHEMA' = 'APL_CACHE'; | ||
|
||
|
||
-- -------------------------------------------------------------------------- | ||
-- Create a view which contains the sorted dataset | ||
-- -------------------------------------------------------------------------- | ||
|
||
drop view CASHFLOWS_SORTED; | ||
create view CASHFLOWS_SORTED as select * from APL_SAMPLES.CASHFLOWS_FULL order by "Date" asc; | ||
|
||
-- -------------------------------------------------------------------------- | ||
-- Create the input/output tables used as arguments for the APL function | ||
-- -------------------------------------------------------------------------- | ||
drop table MODEL_BIN_OUT; | ||
create table MODEL_BIN_OUT like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.MODEL_BIN_OID"; | ||
|
||
drop table OPERATION_LOG; | ||
create table OPERATION_LOG like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_LOG"; | ||
|
||
drop table SUMMARY; | ||
create table SUMMARY like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.SUMMARY"; | ||
|
||
drop table INDICATORS; | ||
create table INDICATORS like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.INDICATORS"; | ||
|
||
drop table APPLY_LOG; | ||
create column table APPLY_LOG like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_LOG"; | ||
|
||
drop table APPLY_SUMMARY; | ||
create column table APPLY_SUMMARY like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.SUMMARY"; | ||
|
||
drop table APPLY_DEBRIEF_METRIC; | ||
create table APPLY_DEBRIEF_METRIC like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_METRIC_OID"; | ||
|
||
drop table APPLY_DEBRIEF_PROPERTY; | ||
create table APPLY_DEBRIEF_PROPERTY like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_PROPERTY_OID"; | ||
|
||
drop table APPLY_OUT; | ||
|
||
DO BEGIN | ||
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER"; | ||
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED"; | ||
declare apply_config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED"; | ||
declare var_desc "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID"; | ||
declare var_role "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID"; | ||
|
||
:header.insert(('Oid', '#42')); | ||
:header.insert(('LogLevel', '8')); | ||
:header.insert(('ModelFormat', 'bin')); | ||
|
||
:config.insert(('APL/ModelType', 'timeseries',null)); | ||
:config.insert(('APL/Horizon', '20',null)); | ||
:config.insert(('APL/TimePointColumnName', 'Date',null)); | ||
:config.insert(('APL/LastTrainingTimePoint', '2001-12-29 00:00:00',null)); | ||
:config.insert(('APL/WithExtraPredictable', 'false',null)); | ||
:config.insert(('APL/ForcePositiveForecast', 'true',null)); | ||
|
||
:var_role.insert(('Date', 'input',null,null,null)); | ||
:var_role.insert(('Cash', 'target',null,null,null)); | ||
|
||
insert into :var_desc select *,'42' from APL_SAMPLES.CASHFLOWS_DESC; | ||
|
||
"SAP_PA_APL"."sap.pa.apl.base::CREATE_MODEL_AND_TRAIN"(:header, :config, :var_desc,:var_role, 'USER_APL','CASHFLOWS_SORTED', model, train_log, train_sum, train_indic); | ||
|
||
call "apl_apply_debrief_example"(:header, :model, :config, 'USER_APL','CASHFLOWS_SORTED', 'USER_APL','APPLY_OUT',out_apply_log,out_apply_sum,out_debrief_metric, out_debrief_property); | ||
|
||
-- store result into table | ||
insert into "USER_APL"."MODEL_BIN_OUT" select * from :model; | ||
insert into "USER_APL"."OPERATION_LOG" select * from :train_log; | ||
insert into "USER_APL"."SUMMARY" select * from :train_sum; | ||
insert into "USER_APL"."INDICATORS" select * from :train_indic; | ||
insert into "USER_APL"."APPLY_LOG" select * from :out_apply_log; | ||
insert into "USER_APL"."APPLY_SUMMARY" select * from :out_apply_sum; | ||
insert into "USER_APL"."APPLY_DEBRIEF_PROPERTY" select * from :out_debrief_property; | ||
insert into "USER_APL"."APPLY_DEBRIEF_METRIC" select * from :out_debrief_metric; | ||
END; | ||
|
||
select * from "USER_APL"."APPLY_OUT"; | ||
select * from "USER_APL"."APPLY_DEBRIEF_PROPERTY"; | ||
select * from "USER_APL"."APPLY_DEBRIEF_METRIC"; |
67 changes: 67 additions & 0 deletions
67
sql/procedure/apl_samples/timeseries/segmented_apply_debrief.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
-- @required(hanaMinimumVersion,2.0.40) | ||
-- ================================================================ | ||
-- APL_AREA, APPLY_MODEL, using a binary format for the model | ||
-- This script demonstrates the application of the binary classification model | ||
-- to predict the target and to get the individual contributions per input | ||
-- | ||
-- Assumption 1: The users & privileges have been created & granted (see apl_admin_ex.sql). | ||
-- Assumption 2: There's a valid trained model (created by APL) in the MODEL_TRAIN_BIN table. | ||
-- @depend(segmented_create_train.sql) | ||
-- @depend(apl_apply_proc.sql) | ||
connect USER_APL password Password1; | ||
SET SESSION 'APL_CACHE_SCHEMA' = 'APL_CACHE'; | ||
|
||
drop table APPLY_OPERATION_LOG; | ||
create table APPLY_OPERATION_LOG like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_LOG"; | ||
|
||
drop table APPLY_SUMMARY; | ||
create table APPLY_SUMMARY like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.SUMMARY"; | ||
|
||
drop table APPLY_DEBRIEF_METRIC; | ||
create table APPLY_DEBRIEF_METRIC like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_METRIC_OID"; | ||
|
||
drop table APPLY_DEBRIEF_PROPERTY; | ||
create table APPLY_DEBRIEF_PROPERTY like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_PROPERTY_OID"; | ||
|
||
|
||
DO BEGIN | ||
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER"; | ||
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED"; | ||
declare model "SAP_PA_APL"."sap.pa.apl.base::BASE.T.MODEL_BIN_OID"; | ||
declare out_log "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_LOG"; | ||
declare out_sum "SAP_PA_APL"."sap.pa.apl.base::BASE.T.SUMMARY"; | ||
declare out_debrief_metric "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_METRIC_OID"; | ||
declare out_debrief_property "SAP_PA_APL"."sap.pa.apl.base::BASE.T.DEBRIEF_PROPERTY_OID"; | ||
|
||
insert into :model select * from MODEL_TRAIN_BIN; | ||
|
||
:header.insert(('Oid', '#42')); | ||
:header.insert(('LogLevel', '8')); | ||
:header.insert(('ModelFormat', 'bin')); | ||
:header.insert(('MaxTasks', '2')); -- define nb parallel tasks to use for train | ||
|
||
:config.insert(('APL/SegmentColumnName', 'Seg',null)); -- define the column used as the segmentation colum | ||
:config.insert(('APL/ApplyLastTimePoint', '2001-12-29 00:00:00',null)); | ||
|
||
call "apl_apply_debrief_example"(:header, :model, :config, 'USER_APL','CASHFLOWS_SORTED', 'USER_APL','APPLY_OUT',out_log,out_sum,out_debrief_metric, out_debrief_property); | ||
|
||
insert into APPLY_OPERATION_LOG select * from :out_log; | ||
insert into APPLY_SUMMARY select * from :out_sum; | ||
insert into APPLY_DEBRIEF_PROPERTY select * from :out_debrief_property; | ||
insert into APPLY_DEBRIEF_METRIC select * from :out_debrief_metric; | ||
END; | ||
|
||
--SELECT * from CASHFLOWS_SORTED; | ||
SELECT "Seg", count(*) from APPLY_OUT group by "Seg"; | ||
|
||
-- Nb trained models | ||
select count(*) from APPLY_SUMMARY where "KEY" = 'AplTaskElapsedTime'; | ||
|
||
-- Average time to train a segment | ||
select AVG(to_double("VALUE")) from APPLY_SUMMARY where "KEY" = 'AplTaskElapsedTime'; | ||
|
||
-- Total time | ||
select * from APPLY_SUMMARY where "KEY" = 'AplTotalElapsedTime'; | ||
|
||
-- Get models in error | ||
select * from APPLY_OPERATION_LOG where "LEVEL" = 0; |