You are on page 1of 29

VIRTUAL

With SAP Analytics Cloud - Smart Predict

This Webinar
-
will begin shortly…
ML & SAP Analytics Cloud
Vriddhi Shetty, Data Scientist
Dec 8 2020
In this session..

Understanding the Building the


models models

© 2019 SAP SE OR AN SAP AFFILIATE COMPANY. ALL RIGHTS RESERVED.


What is SAP Analytics Cloud? Unified experience for planning, BI & Predictive analytics

Business Intelligence Planning Predictive Application Design

Data Preparation Sharing Forecasting Custom Apps


Storytelling Simulation Automated Insights SDK Extensions

Digital Boardroom Mobile SAP Analytics Hub

SAP Analytics Cloud

On Premise Hybrid Cloud

Live data connectivity enables SaaS for everyone

© SAP SE or an SAP affiliate company. All rights reserved. 4


What kind of “predictive” models can you build in SAP Analytics Cloud?

Classification Regression Time series forecasting

“Supervised Learning”

5
© SAP SE or an SAP affiliate company. All rights reserved. 5
Introduction to
Regression &
Classification
Answering the question – Who will?

Responders
Customers who answer to our campaigns

Customers who buy the offered products

Customers who will churn

Customers who don‘t pay their bills (in due time)


Non-responders
Employees who will quit (attrition)
Model
Opportunities that will turn into deals

Contracts that will not be renewed

Claims that are fraudulent

This is called Classification in Predictive Analytics


Churners Non-churners
© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 7
Example: Contact the Customers with the highest Propensity to buy
Our Customers: Who are the ones most likely to buy?

Call Center Challenge:


Contact the customers who are most
likely to buy the offered product.

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 8


Learn From the Past – Who bought during our last marketing campaigns?

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 9


Learn from the past – Find a rule that separates the two groups

Train a predictive model with data


from the past (buyers are known) to CLASSIFICATION RULE
find the classification rule to separate
the two groups

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 10


Learn from the past - Choose the best Model
TRAIN VALIDATE
The data
CLASSIFICATION RULE
Any information to help to separate the groups.
– Time spent on our shopping portal
– Number of abandonend shopping carts
– Age, Gender
– Martial status
– Sales current year
– Sales previous year
– Change of sales between years
– Number of contacts/visits
– Payment history
– Outstanding payments
– …

Train on one part of the historic data.


Validate the result on the other part.
© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 11
Learn From the Past – Apply the rule on potential customers

The rule is applied to potential customers and


assigns a probability to each customer that
stands for the likelihood that this customer will
buy the offered product.

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 12


Look into the future: Use the result of the Prediction

Call Center Action:


Start at the top!
Contact the customers with the highest probability.

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 13


Classification / Regression: What is the Difference?

Classification is about calculating the probability Regression is about estimating a number.


that an event will happen.
- How much will my customers spend?
- Who among my customers is likely to answer
to my campaign? - The target variable is continuous

- The target variable is nominal

Model

y = mx + b

Target variable (y)


Churners Non-churners

Explanatory Variable (x)

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 14


Answering the question – How many?

Number of customers who will buy a service

Number of insurance claims that will be submitted

Number of shoppers who will pass a billboard

Total Revenue that will be closed this quarter

Number of employees who will churn

Amount of medical bill that will be incurred

Number of items that could be damaged

How many spam mails will be recieved

This is called Regression in Predictive Analytics

© 2019 SAP SE or an SAP affiliate company. All rights reserved. ǀ INTERNAL 15


Hands on
Regression &
Classification
Introduction to
time series
When time is key and you need to look ahead…

Estimate over time Time Series

Travel expenses

Sales pipeline

Stock level

Cashflow

Number of customers in a shop

Ozone level in a city

Passengers at an airport gate

In Predictive Analytics this is called Time Series

© SAP SE or an SAP affiliate company. All rights reserved. 18


Time series forecasting - how to start

Time dependent Seasonality trends Candidate influencers


Basic assumption of linear Variations specific to a particular Other variables that influence
regression does not hold time frame the target

Before modelling, consider…

01 Horizon
© SAP SE or an SAP affiliate company. All rights reserved.
02 Scale 03 Aggregation 04 Sorting 19
Step 01 The Trend

• Is the trend
increasing or
decreasing?

• Result of influences
Three stochastic methods Five deterministic methods
such as population
growth, price
inflation and 1. Lag 1: Trendt = Yt-1 1. Trendt = A0 + A1Time
general economic
changes. 2. Lag 2: Trendt = Yt-2 2. Trendt = A0 + A1Time + A2Time2 + A3Sqrt(Time)

3. Double Differencing: 3. Trendt = A0+ A1Time + B1 X1 + B2 X2 + …


Trendt = Yt-1 + (Yt-1 – Yt-2)
= 2Yt-1 – Yt-2 4. Trendt = A0 + A1Time + A2Time2 + A3Sqrt(Time) +
B1 X1 + B2 X2 + …

5. Trendt = B1 X1 + B2 X2 + …
© SAP SE or an SAP affiliate company. All rights reserved. 20
Step 02 The Periodicity

• Patterns in the
signal that reoccur
over time (cyclic
and seasonal)

• Detected after the


trend is subtracted
from the signal Encoding of signals for

1. Periodicity: Natural events that repeat, based on period

2. Seasonality: Based on calendar events (eg. Month, Week, Quarter)

3. Candidate influencers: Only ordinal & continuous variables, not nominal

© SAP SE or an SAP affiliate company. All rights reserved. 21


Step 03 The Fluctuation

• Dependency of the
signal value at time
t on its previous
values

• Model the
remaining signal
after removing An auto-regressive model is then computed on what’s left of the signal:
trends and periods Xt = a0 Xt-1 + a2 Xt-2 + a3 Xt-3 + … + ap Xt-p + e …
(signal – trend –
periods) Where p is called the order of the auto-regressive model (default p=100)

Many Auto-Regressive models (AR) are developed over different time periods.
The ones that stay in competition are those that could improve the modelling
performance of the previous steps.

© SAP SE or an SAP affiliate company. All rights reserved. 22


Step 04 The Residuals

• The part of the


signal that cannot
be explained by the
other
3 components

• White noise, purely • It results from short term fluctuations in the series which are neither
random effects
systematic nor predictable
• In a highly irregular series, these fluctuations can dominate movements,
which will mask the trend and seasonality
• After trying several model combination, the final selected model is the one
whose residuals are the closest possible to white noise
• Residuals should be as small as possible and distributed evenly around 0

© SAP SE or an SAP affiliate company. All rights reserved. 23


Lastly, combine models & iterate to find best model

1. Compute a set of candidate


trends (8) • For each of the eight detected trends, the signal
Yt is detrended to produced Yt – Trendt
• For each candidate cycles, Cyclet
2. Detect a periodic component 1. Measure link between Yt – Trendt and Cyclet
on each detrended signal (8)
2. If this improves the forecast then analysis is
repeated on Trendt + Cyclet
3. Add autoregressive models 3. Else reject Cyclet
on signal residues (up to 8)

4. Select the best model


among the combinations

Best model selection


Note:
1. MAE: Mean Absolute Error (used by SAC)

2. MAPE: Mean Absolute Percentage Error (for


user reference)
01 Measure of MAE 02 Model complexity 03 Horizon

© SAP SE or an SAP affiliate company. All rights reserved. 24


Hands on Time
Series Forecasting
Additional reading
Mathematical explanation from KXEN
https://www.researchgate.net/publication/265292025_Industrial_Mining_of_Massive_Data_Sets

The APL library


https://blogs.sap.com/2020/08/13/introducing-the-automated-predictive-library-apl-for-sac-and-hana/x

Regression in detail
https://blogs.sap.com/2020/08/13/regression-in-sap-analytics-cloud-in-detail/

Classification in detail
https://blogs.sap.com/2020/06/19/classification-in-sap-analytics-cloud-in-detail/

Time series forecasting in detail


https://www.sapanalytics.cloud/time-series-forecasting-smart-predict/

Candidate influencers in time series


https://blogs.sap.com/2019/11/06/candidate-influencers-in-sap-analytics-cloud-smart-predict/

Understanding model results


https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-
US/928e30d8c40947eda2f546e743742838.html
© SAP SE or an SAP affiliate company. All rights reserved. 26
All models are
wrong, but some
are useful.

George E. P. Box
British statistician
(1919-2013)

Source: https://en.wikipedia.org/wiki/All_models_are_wrong
© SAP SE or an SAP affiliate company. All rights reserved. 27
Build things that matter!
Vriddhi Shetty | vriddhi.shetty@sap.com
© SAP SE OR AN SAP AFFILIATE COMPANY. ALL RIGHTS RESERVED.

© SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for
errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying
such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned
therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platforms, directions, and functionality are all
subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to
deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are
cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the trademarks of their respective companies.

See www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.

© SAP SE or an SAP affiliate company. All rights reserved. 29

You might also like