cancel
Showing results for 
Search instead for 
Did you mean: 

Time Series for beginners

Former Member
0 Kudos

Hello,

I’m trying to use time series. When we have a list of dates and I pick the last date in the list I get the message: “NO future values detected after the last training date given:…”

I saw in the example file that if I would like to predict future values, The key should exist in the file and it will predict it. But if we use a databse taable should we create empty records with the key?

I also noticed that when we don’t have enough data we get the message : Error     There is not enough rows to use this cutting strategy.” Is it possible than in such cases to return an average value or something similar? How can we know how much data is enough?

Thanks,

Amir

Accepted Solutions (1)

Accepted Solutions (1)

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amir,

On your first question;

are you using extra predictable variables when creating your time series model? If that's the case you need to fill the values of these extra predictable variables for the future values. As an example you can refer to the file CashFlows.txt available here in my local installation: C:\Program Files\SAP Predictive Analytics\Desktop 3.0\Automated\Samples\KTS. When opening this file you can notice the values for all variables are filled for the year 2002 but the output.

For a complete walkthrough you can either refer to the help guide here: http://help.sap.com/businessobject/product_guides/pa30/en/pa30_ts_user_en.pdf or to Andreas Foster tutorial here: http://scn.sap.com/docs/DOC-69324

On your second question, can you please explain how many data points you are currently using and how many you would like to forecast? What is the level of granularity of your dataset?

Thanks & regards,

Antoine

Former Member
0 Kudos

Hi Antoine,

1. I saw this example and i wonder, If i'm using a database and filling the values of the future period variables, what value should i put in the Target variable?  Should it be NULL?

2.We are running our model on bank accounts. From few examples that i tried it depends on the data. in most of the cases we need at least 10 periods....We are running on monthly granularity.

Thanks,

Amir

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amir,

1. You are correct - this is the value that you want to forecast.

2. The time series models are looking for several patterns, like cycles and seasonal phenomena.

Ideally you should get at least one or two years history if that's possible, otherwise this might be quite challenging to identify nice patterns.

Do not attach too much to the figures I provide, as it really depends on each particular business scenario.

Is it an option to go one level down in order to get more data points? (week level for instance). It's difficult to tell more as it would need detailed investigation on your scenario.

This is where you need to liaise with your business experts to understand what data makes sense to provide to the product and to forecast.

Hope this helps,

Thanks

Antoine

Former Member
0 Kudos

Hi Antonie,

We succeeded to run to model in batch through script.we found out that for each time serious it uses different training date although all the series have the same last date. How do we pick the training date? i couldnt find it in the tutorial.

Thanks,

Amir

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

For creating segmented models, I would recommend to use the Predictive Factory (PF).  You can check my post here:

You can see where the training date is positioned in SAP PA and SAP PF in the post.

Hope this helps,

Best,


Antoine

Former Member
0 Kudos

Hi,

We are using predictive 2.1. We dont have the 3 version

Thanks,

Amir

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Ok - the training date is being defined when you create the initial PA model. This is in the same screen where you set the role of variables before creating the model

Former Member
0 Kudos

In our case we created one model with paramaters and in the script we changed the paramater value (as described in the toturial) but when we checked the result we found out that for each series it run for different period... All the series ends with the same date but not all the series starts with the same date.....

Maybe there is a limitation for the number of periods? Maybe it pick the period by the number of the last period in the series ive built the first model on???

Thanks,

Amir

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Maybe can you share the script? Also looping Former Member in case he is aware of this.

Thanks

Antoine

Former Member
0 Kudos

#GENERATED_BY_KXEN

#

# KxShell Script

# generated on 2016-09-07 10:29:57

# by SAP Predictive Analytics version 2.4.0

#

set echo on

set utf8in on

default STORE_USER ""

default STORE_PWD ""

default DESC_USER ""

default DESC_PWD ""

# Declaring the global connector store

default CONN_STORE_TYPE "Kxen.FileStore"

default CONN_STORE_NAME "C:\Users\XXXXX\Documents\SAP Predictive Analytics Documents"

default CONN_STORE_USER $STORE_USER

default CONN_STORE_PWD $STORE_PWD

#Declaring the 'TRAINING' store and space

default TRAINING_STORE_TYPE "Kxen.ODBCStore"

default TRAINING_STORE_NAME "HANA"

default TRAINING_STORE_USER "XXXXX"

default TRAINING_STORE_PWD "XXXXXX"

default TRAINING_STORE_ALIAS myTrainingStore

# Declaring the connector store for the 'TRAINING' dataset

default TRAINING_CONN_STORE_TYPE $CONN_STORE_TYPE

default TRAINING_CONN_STORE_NAME $CONN_STORE_NAME

default TRAINING_CONN_STORE_USER $CONN_STORE_USER

default TRAINING_CONN_STORE_PWD $CONN_STORE_PWD

default TRAINING_CONN_STORE_ALIAS myTrainingConnStore

default TRAINING_SPACE "BNHP_UTILSDATATHON2"

default TRAINING_SEED 1960

# Declaring arguments collected from the Training data set.

# Prompt 1 : P_ACC(P_ACC)

default TRAINING_STORE_PROMPT_0 "9999999999999"

# Prompt 2 : P_ACT(P_ACT)

default TRAINING_STORE_PROMPT_1 "E"

default MODEL_SAVE_STORE_TYPE "Kxen.FileStore"

default MODEL_SAVE_STORE_NAME "C:\Users\XXXXX\Documents\SAP Predictive Analytics Documents"

default MODEL_SAVE_STORE_USER ""

default MODEL_SAVE_STORE_PWD ""

default MODEL_SAVE_NAME "ACC_TRANS_FORCAST $TRAINING_STORE_PROMPT_0 $TRAINING_STORE_PROMPT_1"

default MODEL_SAVE_SPACE "ACC_TRANS_FORCAST.kxen"

default MODEL_SAVE_COMMENT "The model 'ACC_TRANS_FORCAST $TRAINING_STORE_PROMPT_0 $TRAINING_STORE_PROMPT_1' has been saved"

createModel Kxen.SimpleModel m

m.getParameter ""

m.changeParameter Parameters/CutTrainingPolicy "sequential with no test"

if $FORCE_CODINGSTRATEGY ne "" then m.changeParameter Parameters/CodingStrategy "8.0.1"

m.setName "ACC_TRANS_FORCAST"

m.validateParameter

m.bind protocol Default p

p.getParameter ""

p.changeParameter "Parameters/StrangeValueLevel" "12"

p.changeParameter "Parameters/CopyTarget" "true"

p.changeParameter "Parameters/UseDateCoder" "true"

p.changeParameter "Parameters/ApplyInDataBase" "true"

p.changeParameter "Parameters/IDBAFallbackToRegularApply" "true"

p.changeParameter "Parameters/SoftMode" "false"

p.changeParameter "Parameters/WeightInformation" ""

p.validateParameter

delete p

m.pushTransformInProtocol Default Kxen.TimeSeries

-delete $TRAINING_STORE_ALIAS

m.openNewStore $TRAINING_STORE_TYPE $TRAINING_STORE_NAME $TRAINING_STORE_USER $TRAINING_STORE_PWD $TRAINING_STORE_ALIAS

$TRAINING_STORE_ALIAS.associateConnectorStore $TRAINING_CONN_STORE_TYPE $TRAINING_CONN_STORE_NAME $TRAINING_CONN_STORE_USER $TRAINING_CONN_STORE_PWD $TRAINING_CONN_STORE_ALIAS

m.newDataSet Training $TRAINING_SPACE

bind m DataSet Training t

t.getParameter ""

t.changeParameter Parameters/RandomSeed $TRAINING_SEED

t.changeParameter Parameters/RandomMax 1.0

t.changeParameter Parameters/RandomMin 0.0

t.changeParameter Parameters/SkippedRows 0

t.changeParameter Parameters/LastRow 22

t.changeParameter Parameters/Connector/ForwardArgumentsManagementScheme "BySpaceAlias"

t.changeParameter Parameters/Connector/Arguments/P_ACC/Value $TRAINING_STORE_PROMPT_0

t.changeParameter Parameters/Connector/Arguments/P_ACT/Value $TRAINING_STORE_PROMPT_1

t.changeParameter Parameters/Locale ""

t.validateParameter

delete t

bind m DataSet Training s

s.startDescription

s.addVariableDesc "MONTH1" string nominal 0 0 "" "" ""

s.addVariableDesc "ACCOUNT_ID" string nominal 1 0 "" "" ""

s.addVariableDesc "ACTIVITY_TYPE_CODE" string nominal 1 0 "" "" ""

s.addVariableDesc "TRANSACTION_AMT" number continuous 0 0 "" "" ""

s.addVariableDesc "COUNT_ACT" integer nominal 0 0 "" "" ""

s.addVariableDesc "UNIT_QUANTITY" integer nominal 0 0 "" "" ""

s.addVariableDesc "BTL_IND" integer nominal 0 0 "" "" ""

s.addVariableDesc "MOVING_IND" string nominal 0 0 "" "" ""

s.addVariableDesc "RESTRICTION_IND" string nominal 0 0 "" "" ""

s.addVariableDesc "NUM_RETURNED_CHEQUES" string nominal 0 0 "" "" ""

s.addVariableDesc "DR_IND" string nominal 0 0 "" "" ""

s.addVariableDesc "DUAL_CUST_EVENT" string nominal 0 0 "" "" ""

s.addVariableDesc "CRO_MODEL_PROBABILITY_PERC" string nominal 0 0 "" "" ""

s.addVariableDesc "ACTIVA" number nominal 0 0 "" "" ""

s.addVariableDesc "PASIVA" number continuous 0 0 "" "" ""

s.addVariableDesc "SALARY_RATE" string nominal 0 0 "" "" ""

s.addVariableDesc "UNUSED_CREDIT_LIMIT_AMT" number continuous 0 0 "" "" ""

s.addVariableDesc "TRAN_DATE" date continuous 1 1 "" "" ""

s.endDescription

delete s

m.bind TransformInProtocol Default 0 t

t.getParameter ""

t.changeParameter Parameters/DateColumnName TRAN_DATE

t.changeParameter Parameters/AutoFeedCount 1

t.changeParameter Parameters/MaxCyclics "450"

t.changeParameter Parameters/ProcessOutliers true

t.changeParameter Parameters/ForcePositiveForecast false

t.changeParameter Parameters/ModelsGenerationOption Default

t.changeParameter Parameters/ForecastsConnection true

t.changeParameter Parameters/LastRowWithForecastingInformation 23

t.bindParameter Parameters/PredictableExtras lList

lList.insert MONTH1 dummyPar_0

lList.insert COUNT_ACT dummyPar_1

lList.insert UNIT_QUANTITY dummyPar_2

lList.insert BTL_IND dummyPar_3

lList.insert MOVING_IND dummyPar_4

lList.insert RESTRICTION_IND dummyPar_5

lList.insert NUM_RETURNED_CHEQUES dummyPar_6

lList.insert DR_IND dummyPar_7

lList.insert DUAL_CUST_EVENT dummyPar_8

lList.insert CRO_MODEL_PROBABILITY_PERC dummyPar_9

lList.insert ACTIVA dummyPar_10

lList.insert PASIVA dummyPar_11

lList.insert SALARY_RATE dummyPar_12

lList.insert UNUSED_CREDIT_LIMIT_AMT dummyPar_13

delete dummyPar_0

delete dummyPar_1

delete dummyPar_2

delete dummyPar_3

delete dummyPar_4

delete dummyPar_5

delete dummyPar_6

delete dummyPar_7

delete dummyPar_8

delete dummyPar_9

delete dummyPar_10

delete dummyPar_11

delete dummyPar_12

delete dummyPar_13

delete lList

t.changeParameter Parameters/VariableSelection/PercentageContrib 0.95

t.changeParameter Parameters/VariableSelection/ActivateForEXPTrends true

t.changeParameter Parameters/VariableSelection/ActivateForAutoRegressiveModels false

t.validateParameter

delete t

m.checkMode learn

m.bind protocol Default p

p.getParameter ""

p.changeParameter "Variables/ACTIVITY_TYPE_CODE/Role" skip

p.changeParameter "Variables/ACTIVITY_TYPE_CODE/UserEnableCompress" true

p.changeParameter "Variables/TRANSACTION_AMT/Role" target

p.changeParameter "Variables/TRANSACTION_AMT/UserBandCount" 20

p.changeParameter "Variables/TRANSACTION_AMT/UserEnableCompress" true

p.changeParameter "Variables/MOVING_IND/Role" input

p.changeParameter "Variables/MOVING_IND/UserEnableCompress" true

p.changeParameter "Variables/ACCOUNT_ID/Role" skip

p.changeParameter "Variables/ACCOUNT_ID/UserEnableCompress" true

p.changeParameter "Variables/NUM_RETURNED_CHEQUES/Role" input

p.changeParameter "Variables/NUM_RETURNED_CHEQUES/UserEnableCompress" true

p.changeParameter "Variables/PASIVA/Role" input

p.changeParameter "Variables/PASIVA/UserBandCount" 20

p.changeParameter "Variables/PASIVA/UserEnableCompress" true

p.changeParameter "Variables/TRAN_DATE/Role" input

p.changeParameter "Variables/TRAN_DATE/UserBandCount" 20

p.changeParameter "Variables/TRAN_DATE/UserEnableCompress" true

p.changeParameter "Variables/ACTIVA/Role" input

p.changeParameter "Variables/ACTIVA/UserEnableCompress" true

p.changeParameter "Variables/UNUSED_CREDIT_LIMIT_AMT/Role" input

p.changeParameter "Variables/UNUSED_CREDIT_LIMIT_AMT/UserBandCount" 20

p.changeParameter "Variables/UNUSED_CREDIT_LIMIT_AMT/UserEnableCompress" true

p.changeParameter "Variables/MONTH1/Role" input

p.changeParameter "Variables/MONTH1/UserEnableCompress" true

p.changeParameter "Variables/COUNT_ACT/Role" input

p.changeParameter "Variables/COUNT_ACT/UserEnableCompress" true

p.changeParameter "Variables/SALARY_RATE/Role" input

p.changeParameter "Variables/SALARY_RATE/UserEnableCompress" true

p.changeParameter "Variables/RESTRICTION_IND/Role" input

p.changeParameter "Variables/RESTRICTION_IND/UserEnableCompress" true

p.changeParameter "Variables/CRO_MODEL_PROBABILITY_PERC/Role" input

p.changeParameter "Variables/CRO_MODEL_PROBABILITY_PERC/UserEnableCompress" true

p.changeParameter "Variables/DR_IND/Role" input

p.changeParameter "Variables/DR_IND/UserEnableCompress" true

p.changeParameter "Variables/BTL_IND/Role" input

p.changeParameter "Variables/BTL_IND/UserEnableCompress" true

p.changeParameter "Variables/UNIT_QUANTITY/Role" input

p.changeParameter "Variables/UNIT_QUANTITY/UserEnableCompress" true

p.changeParameter "Variables/DUAL_CUST_EVENT/Role" input

p.changeParameter "Variables/DUAL_CUST_EVENT/UserEnableCompress" true

p.validateParameter

delete p

m.sendMode learn

m.openNewStore $MODEL_SAVE_STORE_TYPE $MODEL_SAVE_STORE_NAME $MODEL_SAVE_STORE_USER $MODEL_SAVE_STORE_PWD

m.saveModel $MODEL_SAVE_SPACE $MODEL_SAVE_COMMENT $MODEL_SAVE_NAME

print Model ACC_TRANS_FORCAST has been saved.

delete m

exit

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

The two parameters you should look for are the below:

- t.changeParameter Parameters/LastRow 22 is the last row that contains fully filled training data. It means you have 22 data points for training the model.

- t.changeParameter Parameters/LastRowWithForecastingInformation 23 is the last row including the point to forecast. This one should be filled with the date at least and extra predictable variables if this applies.

I hope this clarifies.
How many data points do you have for learning, how many data points do you want to forecast?

Best regards

Antoine

Answers (0)