Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Data Science in Fashion - Exploring Demand Fore...

Data Science in Fashion - Exploring Demand Forecasting

Demand forecasting is key for the retailing industry. This is especially true in the fashion industry where product demand is volatile and the life cycle is short. In this talk I will describe the Demand Forecasting Problem in the context of a brick-and-mortar retailer. I will discuss commonly used techniques, including evaluation metrics, feature and target transformations and commonly used predictors. Finally, I will conclude with a short discussion on the challenges of successfully implementing a demand forecasting solution beyond the technical details.

Miguel Cabrera

October 26, 2019
Tweet

More Decks by Miguel Cabrera

Other Decks in Technology

Transcript

  1. Data Science in Retail - Exploring Demand Forecasting Miguel Cabrera


    Senior Data Scientist at NewYorker @mfcabrera Photo by Daniel Seßler on Unsplash
  2. 5 THE AGENDA FOR TODAY I N T R O

    D U C T I O N M O D E L S P R A C T I C E B a s i c c o n c e p t s W h a t m o d e l s c a n h e l p u s s o l v e t h i s p r o b l e m C o m m o n t e c h n i q u e s a n d p a t t e r n t o t a c k l e t h i s p r o b l e m R E Q U I R E M E N T S W h a t d o w e n e e d t o t a ke i n t o a c c o u n t
  3. 7 DEMAND
 FORECASTING Demand Forecasting refers to predicting future demand

    (or sales), assuming that the factors which affected demand in the past and are affecting the present and will still have an influence in the future. [1] Sales Date Jan Feb Mar April May Jun Jul Aug Sep Oct Nov Dec Jan H I S T O R I C A L P R E D I C T I O N S 2 0 1 8 2 0 1 9 Date Sales Feb 2018 3500 Mar 2018 3000 April 2018 2000 May 2018 500 Jun 2018 500 … … T 1000 T+1 ?? T+2 ?? T+3 ?? … ?? T+n ??
  4. 8 APPLICATIONS P R O D U C T I

    O N 
 P L A N N I N G R E P L E N I S H M E N T D I S C O U N T 
 & 
 P R O M O T I O N S F I N A N C I A L 
 P L A N N I N G
  5. 9 CONSTRAINTS ‣ Strong relationship between garments and weather make

    sales seasonal and prone to unpredictability ‣ Sales are disturbed by exogenous variables like end-of-season sales, promotions, competition, marketing and purchasing power of consumers. ‣ Fashion trends create volatility in consumer demands, the design and style have to be up to date ‣ High product variety. Many colours alternatives and various sizes. ‣ Most of the items are not renewed for the next collection and even basic products might change slightly due to fashion trends. ‣ Consumers are very unfaithful and generally their selection is based on the price of the product.
  6. 11 Image Source: Thomassey, S. (2014). Sales Forecasting in Apparel

    and Fashion Industry: A Review. In Intelligent Fashion Forecasting Systems: Models and Applications (pp. 9–27). https://doi.org/ 10.1007/978-3-642-39869-8_2 MULTI-HORIZON M a n y d e c i s i o n s a r e b a s e d o n s a l e s f o r e c a s t i n g a n d s h o u l d b e c o n s i d e r e d i n a s u f f i c i e n t t i m e b a s e d o n l e a d t i m e s
  7. 12 SEASONALITY P R O D U C T S

    A R E V E R Y S E N S I T I V E T O S E A S O N A L VA R I AT I O N S
  8. 13 EXOGENOUS VARIABLES ‣Item Features and Fashion trends ‣Retailing strategy

    (stores, location, location in store). ‣Marketing strategy ‣Macroeconomic phenomena ‣Calendar information (Holidays, special dates) ‣Competition ‣Weather
  9. 15 REQUIREMENTS - IMPLICATIONS Multiple products Multiple time series Different

    product lifecycles Highly non-stationary sales Different horizons Multi-horizon predictions
  10. 16 MODELING APPROACHES T I M E S E R

    I E S M O D E L S M A C H I N E L E A R N I N G D E E P L E A R N I N G T O O L S AVA I L A B L E • (S)ARIMA • (G)ARCH • VAR • FB Prophet • Linear Regression • SVM • Gaussian Process • Tree Based Models • Random Forests • XGBoost • Catboost • LightGBM • MLP • RNN • LSTM • SEQ2SEQ
  11. 17 MODELING APPROACHES M O D E L S C

    O R E CA R D Characteristic / Requirement Score Highly non-stationary Multiple time series Multi-horizon forecast Model interpretability Model Capability Computational Efficiency
  12. 18 ARIMA B A S I C C O N

    C E PT S Auto-Regressive Integrated Moving Average AR(p) MA(q) Past Values Past Errors ARIMA(p, d, q) SARIMA(p, d, q)x(Q,D,P,m)
  13. 20 ARIMA E XA M P L E • Study

    ACF/PACF charts and determine the parameter or use an automated algorithm. • Seasonal pattern (Strong correlation between and ) • Algorithm found: SARIMAX(1, 1, 1)x(0, 1, 1)^12
  14. 21 TIME SERIES MODELS L I M I TAT I

    O N S Characteristic / Requirement Score Highly non-stationary Limited Multiple time series Limited Multi-horizon forecast Yes Model interpretability High Model Capability Low Computational Efficiency High Sample plots of fashion product sales
  15. 22 MACHINE LEARNING M A C H I N E

    L E A R N I N G M O D E L S A R E M O R E F L E XI B L E ‣Additional features in the model. ‣No assumption about the demand distribution. ‣One single model can handle many or all products. ‣Feature Engineering is very important.
  16. 23 MACHINE LEARNING - FEATURES F E AT U R

    E E N G I N E E R I N G I S A N I M P O R TA N T S T E P I N T H E M A C H I N E L E A R N I N G A P P R O A C H Sales Data Product Attributes Time Location category, brand, color, 
 size, style, identifier Time Series, moving averages, statistics, lagged features, stock Day of week, month of year, number of week, season Holiday, weather, macroeconomic information S O U R C E E XT R A C T I O N E N C O D I N G Numerical One Hot Encoding Feature Hashing Embeddings FEATURES
  17. 24 MACHINE LEARNING - FEATURES F E AT U R

    E E N G I N E E R I N G I S A N I M P O R TA N T S T E P I N T H E M A C H I N E L E A R N I N G A P P R O A C H S O U R C E E N C O D I N G
  18. 25 MACHINE LEARNING - MODELS S O M E O

    F M O D E L S I N T H E Z O O L I N E A R R E G R E S S I O N T R E E B A S E D S U P P O R T V E C T O R R E G R E S S I O N Estimate the independent variable as the linear expression of the features. ‣ Least Squares ‣ Ridge / Lasso ‣ Elastic Net ‣ ARIMA + X Use decision trees to learn the characteristics of the data to make predictions ‣ Regression Tree ‣ Random Forest ‣ Gradient Boosting ‣ Catboost ‣ LightGBM ‣ XGBoost Minimise the error within the support vector threshold using a non-Linear kernel to model non- linear relationships. ‣ NuSVR ‣ LibLinear ‣ LibSVM ‣ SKLearn
  19. 26 MACHINE LEARNING L I M I TAT I O

    N S Characteristic / Requirement Score Highly non-stationary Yes Multiple time series Yes Multi-horizon forecast Yes Model interpretability Medium Model Capability Medium Computational Efficiency Medium ‣ Requires expert knowledge ‣ Time consuming feature engineering required ‣ Some features are difficult to capture
  20. 27 DEEP LEARNING - MODELS S O M E O

    F M O D E L S I N T H E Z O O M U LT I L AY E R 
 P E R C E PT R O N L O N G S H O R T 
 T E R M M E M O R Y S E Q 2 S E Q Fully connected multilayer artificial neural network. A type of recurrent neural network used for sequence learning. Cell states updated by gates. Used for speech recognition, language models, translation, etc. Encoder decoder architecture.
 
 It uses two RNN that will work together trying to predict the next state sequence from the previous sequence. Image credits: https://github.com/ledell/sldm4-h2o/ https://smerity.com/articles/2016/google_nmt_arch.html
  21. 28 DEEP LEARNING F E AT U R E E

    N G I N E E R I N G : E N T I T Y E M B E D D I N G F O R CAT E G O R I CA L VA R I A B L E S Source: Cheng Guo and Felix Berkhahn. 2016. Entity embeddings of categorical variables. arXiv preprint arXiv:1604.06737 (2016). The learned German state embedding mapped to a 2D space with t-SNE.
  22. 29 DEEP LEARNING L I M I TAT I O

    N S Characteristic / Requirement Score Highly non-stationary Yes Multiple time series Yes Multi-horizon forecast Yes Model interpretability Low Model Capability High Computational Efficiency Low ‣ Very flexible approach ‣ Automated feature learning is more limited due to the lack of unlabelled data. ‣ Some feature engineering is still necessary. ‣ Poor model interpretability
  23. 30 MODELS - SUMMARY T I M E S E

    R I E S M O D E L S M A C H I N E L E A R N I N G D E E P L E A R N I N G ‣ Good model interpretability ‣ Limited model complexity to handle non-linear data ‣ Difficult to model multiple time series ‣ Difficult to integrate shared features across different time series ‣ Flexible ‣ Can incorporate many features across the time series ‣ A lot of feature engineering required ‣ Very flexible ‣ Automated feature learning via embeddings ‣ Still some degree of feature engineering necessary ‣ Poor model interpretability
  24. 32 EVALUATION AND METRICS K P I v s L

    O S S F U N C T I O N S Metric Formula Notes MAE (mean absolute error) Intuitive MAPE (mean absolute percentage error) Independent of the scale of measurement SMAPE (symmetric mean absolute percentage errror) Avoid Asymmetry of MAPE MSE (Mean squared error) Penalize extreme errors MSLE (Mean Squared Logarithmic loss) Large errors are not more significantly penalised than small ones Quantile Loss Measure distribution RMSPE (Root Mean Squared Percentage Error) Independent of the scale of measurement 1 N ∑ i ̂ yi − yi 1 N ∑ i ̂ yi − yi yi 1 n n ∑ i=1 ( yi − ̂ yi yi ) 2 1 N ∑ i 2 ̂ yi − yi yi + ̂ yi 1 N ∑ i ( ̂ yi − yi )2 1 N ∑ i q( ̂ yi − yi )+ + (1 − q)( ̂ yi − yi )+ 1 N ∑ i log(yi + 1) − log( ̂ yi + 1)
  25. 33 CROSSVALIDATION T I M E S E R I

    E S B R I N G S S O M E R E S T R I C T I O N S Left image source: Hyndman, R.J., & Athanasopoulos, G. (2019) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3.
  26. 34 USEFUL PREDICTORS S O M E T O O

    L S F R O M T O O L B OX ‣ Trend or Sequence ‣ Seasonal Variables ‣ Intervention Variables x1,t = t
  27. 35 USEFUL PREDICTORS S O M E T O O

    L S F R O M T O O L B OX ‣ Trend or Sequence ‣ Seasonal Variables ‣ Intervention Variables
  28. 36 USEFUL PREDICTORS S O M E T O O

    L S F R O M T O O L B OX ‣ Trend or Sequence ‣ Seasonal Variables ‣ Intervention Variables
  29. 37 SUMMARY ‣ Demand Forecasting in fashion retail is challenging

    as the forecasting system need to deal with the certain specific characteristics: fashion trends, seasonality, influence of many external variables. ‣ Machine Learning, in particular Gradient Boosting seem to offer a good compromise between model capacity and interpretability. ‣ Feature Engineering is key, and it is still necessary when using Deep Learning. ‣ Avoid feature leaking by using a robust time series cross-validation approach. ‣ Try to match your metric to the business requirements. Business understandable metrics are necessary to explain the quality of the forecasts to the stakeholders.
  30. REFERENCES • [1] Choi, T. M., Hui, C. L., &

    Yu, Y. (2014). Intelligent fashion forecasting systems: Models and applications. Intelligent Fashion Forecasting Systems: Models and Applications (pp. 1–194). Springer Berlin Heidelberg. https:// doi.org/10.1007/978-3-642-39869-8 • [2] Hyndman, R.J., & Athanasopoulos, G. (2018) Forecasting: principles and practice, 2nd edition, OTexts: Melbourne, Australia. OTexts.com/fpp2. Accessed on 01.10.2019 • [3] H&M, a Fashion Giant, Has a Problem: $4.3 Billion in Unsold Clothes. https://www.nytimes.com/2018/03/27/business/hm-clothes-stock-sales.html • [4] Thomassey, S. (2014). Sales Forecasting in Apparel and Fashion Industry: A Review. In Intelligent Fashion Forecasting Systems: Models and Applications (pp. 9–27). Berlin, Heidelberg: Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-642-39869-8_2 • [5] Box, G. E. P., & Jenkins, G. M. (1970). Time series analysis: Forecasting and control. San Francisco: Holden-Day • [6] Autoregressive integrated moving average (ARIMA). https://en.wikipedia. org/wiki/Autoregressive_integrated_moving_average. Accessed: 2019-05-02 • [ 7] Cheng Guo and Felix Berkhahn. 2016. Entity embeddings of categorical variables. arXiv preprint arXiv:1604.06737 (2016). • [8] Shen, Yuan, Wu and Pei - Data Science in Retail-as-a-Service Worshop. KDD 2019. London. 38
  31. IMAGE CREDITS • Photo Credit: https://www.flickr.com/photos/157635012@N07/48105526576 Artem Beliaikin on via

    Compfight CC 2.0 • Ship Freight by ProSymbols from the Noun Project • warehouse by ProSymbols from the Noun Project • Store by AomAm from the Noun Project • Neural Network by Knut M. Synstad from the Noun Project • Tunic Dress by Vectors Market from the Noun Project • sales by Kantor Tegalsari from the Noun Project • time series by tom from the Noun Project • fashion by Smalllike from the Noun Project • Time by Anna Sophie from the Noun Project • linear regression by Becris from the Noun Project • Random Forest by Becris from the Noun Project • SVM by sachin modgekar from the Noun Project • production by Orin zuu from the Noun Project • Auto by Graphic Tigers from the Noun Project • Factory by Graphic Tigers from the Noun Project • Express Delivery by Vectors Market from the Noun Project • Stand Out by BomSymbols from the Noun Project • Photo Credit: https://www.flickr.com/photos/157635012@N07/47981346167/ by Artem Beliaikin on Flickr via Compfight CC 2.0 • Photo Credit: „https://www.flickr.com/photos/157635012@N07/48014587002/ Artem Beliaikin</a> Flickr via Compfight CC 2.0 • regression analysis by Vectors Market from the Noun Project • Research Experiment by Vectors Market from the Noun Project • weather by Alice Design from the Noun Project • Shirt by Ben Davis from the Noun Project • fashion by Eat Bread Studio from the Noun Project • renew by david from the Noun Project • price by Adrien Coquet from the Noun Project • requirements by ProSymbols from the Noun Project • marketing by Gregor Cresnar from the Noun Project • macroeconomic by priyanka from the Noun Project • competition by Gregor Cresnar from the Noun Project 39