	{"id":66571,"date":"2022-03-28T14:51:11","date_gmt":"2022-03-28T13:51:11","guid":{"rendered":"https:\/\/www.artefact.com\/?post_type=news&#038;p=66571"},"modified":"2024-09-20T17:45:48","modified_gmt":"2024-09-20T16:45:48","slug":"is-facebook-prophet-suited-for-doing-good-predictions-in-a-real-world-project","status":"publish","type":"blog","link":"https:\/\/www.artefact.com\/zh\/blog\/is-facebook-prophet-suited-for-doing-good-predictions-in-a-real-world-project\/","title":{"rendered":"Facebook \u5148\u77e5\u662f\u5426\u9002\u5408\u5728\u771f\u5b9e\u4e16\u754c\u9879\u76ee\u4e2d\u505a\u597d\u9884\u6d4b\uff1f"},"content":{"rendered":"<p><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling article-author\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-background-color:#ffffff;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_2 1_2 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:50%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:50%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-title title fusion-title-1 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Author<\/h2><\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27150%27%20height%3D%270%27%20viewBox%3D%270%200%20150%200%27%3E%3Crect%20width%3D%27150%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/hugo-vasselin.jpeg\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left article-author-image\" style=\"width: 150px; border-radius: 54% 46% 77% 23% \/ 74% 40% 60% 26%; overflow: hidden;\" width=\"150\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-2 fusion-sep-none fusion-title-text fusion-title-size-three article-author-name-title\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Hugo Vasselin<\/h3><\/div><div class=\"fusion-text fusion-text-1 article-author-description\" style=\"--awb-text-transform:none;\"><p>Senior Data Scientist at Artefact<\/p>\n<\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_2 1_2 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:50%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:50%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-title title fusion-title-3 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Author<\/h2><\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27150%27%20height%3D%270%27%20viewBox%3D%270%200%20150%200%27%3E%3Crect%20width%3D%27150%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/jules-bertrand.jpeg\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left article-author-image\" style=\"width: 150px; border-radius: 54% 46% 77% 23% \/ 74% 40% 60% 26%; overflow: hidden;\" width=\"150\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-4 fusion-sep-none fusion-title-text fusion-title-size-three article-author-name-title\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Jules Bertrand<\/h3><\/div><div class=\"fusion-text fusion-text-2 article-author-description\" style=\"--awb-text-transform:none;\"><p>Data scientist at Artefact<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-2 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-margin-top:40px;--awb-margin-bottom:40px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-center fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-2 fusion_builder_column_1_1 1_1 fusion-flex-column fusion-flex-align-self-center fusion-column-inner-bg-wrapper\" style=\"--awb-padding-top:20px;--awb-padding-right:20px;--awb-padding-bottom:20px;--awb-padding-left:20px;--awb-overflow:hidden;--awb-inner-bg-size:cover;--awb-border-color:rgba(10,17,40,0.1);--awb-border-top:1px;--awb-border-right:1px;--awb-border-bottom:1px;--awb-border-left:1px;--awb-border-style:solid;--awb-border-radius:4px 4px 4px 4px;--awb-inner-bg-border-radius:4px 4px 4px 4px;--awb-inner-bg-overflow:hidden;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><span class=\"fusion-column-inner-bg hover-type-none\"><a class=\"fusion-column-anchor\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/is-facebook-prophet-suited-for-doing-good-predictions-in-a-real-world-project-44be1fe4ce91\" rel=\"noopener noreferrer\" target=\"_blank\"><span class=\"fusion-column-inner-bg-image\"><\/span><\/a><\/span><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-center fusion-content-layout-row fusion-flex-align-items-center\"><div class=\"fusion-text fusion-text-3\"><p><u>Read our article on<\/u><\/p>\n<\/div><div class=\"fusion-image-element\" style=\"--awb-margin-right:20px;--awb-margin-left:20px;--awb-max-width:150px;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><span class=\" fusion-imageframe imageframe-none imageframe-1 hover-type-none\"><img decoding=\"async\" width=\"4000\" height=\"992\" title=\"Medium Blog\" src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png\" alt class=\"lazyload img-responsive wp-image-60582\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%274000%27%20height%3D%27992%27%20viewBox%3D%270%200%204000%20992%27%3E%3Crect%20width%3D%274000%27%20height%3D%27992%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-srcset=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-200x50.png 200w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-400x99.png 400w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-600x149.png 600w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-800x198.png 800w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-1200x298.png 1200w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png 4000w\" data-sizes=\"auto\" data-orig-sizes=\"(max-width: 640px) 100vw, 4000px\" \/><\/span><\/div><div class=\"fusion-text fusion-text-4\"><p>.<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-3 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-3 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-text fusion-text-5 description\" style=\"--awb-text-transform:none;\"><p>This guide will help you figure whether Prophet is appropriate or not for your forecasting project, by giving you a critical opinion based on a real project lens. We tested it on 3 main dimensions: feature engineering and modelling, interpretability, and maintenance.<\/p>\n<\/div><\/div><\/div><\/div><\/div><article class=\"fusion-fullwidth fullwidth-box fusion-builder-row-4 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-4 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-text fusion-text-6\" style=\"--awb-text-transform:none;\"><p>We tested Prophet in a real-world project, on 3 main aspects: feature engineering, interpretability, and use in production &amp; maintenance and here are our conclusions:<\/p>\n<\/div><div class=\"fusion-title title fusion-title-5 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Feature engineering and modelling:<\/h3><\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-1 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">A native handling of trend and seasonality features, that makes Prophet a good baseline model if the time series follows business cycles.<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">However if your signal is noisy, fine-tuning the model\u2019s performance can be a hassle.<\/div><\/li><\/ul><div class=\"fusion-title title fusion-title-6 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Interpretability:<\/h3><\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-2 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Thanks to its native breakdown of the forecast into time components, the model\u2019s decisions are easy to interpret<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Nevertheless it\u2019s not precise enough to be used to measure the impact of an external event<\/div><\/li><\/ul><div class=\"fusion-title title fusion-title-7 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Stability of the results \/ Maintenance:<\/h3><\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-3 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Prophet provides an interpretable model with good performance in a very short time<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">However if you care about stability and forecast accuracy, consider using another kind of algorithm, such as tree-based models.<\/div><\/li><\/ul><div class=\"fusion-title title fusion-title-8 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Introduction<\/h2><\/div><div class=\"fusion-text fusion-text-7\" style=\"--awb-text-transform:none;\"><p>Recently,\u00a0<a class=\"au ni\" href=\"https:\/\/www.microprediction.com\/blog\/prophet\" target=\"_blank\" rel=\"noopener ugc nofollow\">an article<\/a>\u00a0pointed out that\u00a0<a class=\"au ni\" href=\"https:\/\/facebook.github.io\/prophet\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Facebook Prophet<\/a>\u00a0was performing poorly on some edge cases. Indeed, this package is so popular that it tends to be considered as THE go-to tool for every forecasting use case. This launched a debate within the community and\u00a0<a class=\"au ni\" href=\"https:\/\/twitter.com\/seanjtaylor\/status\/1410447403153457152\" target=\"_blank\" rel=\"noopener ugc nofollow\">even its creator reacted<\/a>.<br \/>\nThere is a lot of literature on how to make a single forecast with Prophet. But there is a lack of empirical feedback on how it behaves in production, when you need to provide forecasts on a daily basis. We have tested and proven this tool for 6 months on a real business project. Here are some takeaways.<\/p>\n<\/div><div class=\"fusion-text fusion-text-8\" style=\"--awb-text-transform:none;\"><p>We used Prophet to forecast call arrivals in <a href=\"https:\/\/www.artefact.com\/news\/powering-your-call-centre-with-artificial-intelligence\/\">call centers<\/a> for one of the biggest Telecom companies in Europe, to optimise the quality of customer service.<\/p>\n<p>We applied the\u00a0<a class=\"au ni\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/the-path-to-developing-a-high-performance-demand-forecasting-model-part-1-e977889d4595\" rel=\"noopener\" target=\"_blank\">GLADS framework<\/a>\u00a0to draft our data approach:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-4 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><strong>Target<\/strong>: number of incoming calls<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><strong>Granularity<\/strong>: day \/ geographic zone \/ agent skills level (eg. cell phone technical assistance).<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><strong>Horizon<\/strong>:\u00a05 months (M+5)<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><strong>Frequency:<\/strong> daily refresh<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>SKU:<\/strong>\u00a0agent skills<\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-9\" style=\"--awb-text-transform:none;\"><p>An important constraint was the need for\u00a0<strong>interpretability<\/strong>\u00a0of results. Indeed, our predictions are consumed by human planners whose goal is to maintain a SLA (X% of calls must be answered in a given period) while minimising costs. Their work consists of 3 missions:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-5 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><strong>Analysing<\/strong>\u00a0and understanding the main call drivers and their evolution<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>Forecasting <\/strong>call volumes using their business knowledge<\/p>\n<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>Allocating<\/strong><strong class=\"kq ja\"> \u2014\u00a0<\/strong>Adjusting the supply of call centre agents according to demand prediction.<\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-10\" style=\"--awb-text-transform:none;\"><p>Main\u00a0<strong>call drivers<\/strong> differ depending on SKUs.\u00a0For example, Commercial assistance drivers include:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-6 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Number of clients<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Marketing events and campaign pruning<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Level of quality of service (snowball effect)<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p>Holidays<\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-11\" style=\"--awb-text-transform:none;\"><p>Our time series have strong seasonalities, and follow economic cycles. They are not stationary. In this case, Prophet is an appropriate choice. We chose to test it, as well as other ML algorithms\u00a0<a class=\"au ni\" href=\"https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0148296320306160\" target=\"_blank\" rel=\"noopener ugc nofollow\">frequently used for this task<\/a>.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27587%27%20height%3D%270%27%20viewBox%3D%270%200%20587%200%27%3E%3Crect%20width%3D%27587%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo1.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 587px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"587\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-9 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Feature engineering and modelling<\/h2><\/div><div class=\"fusion-text fusion-text-12\" style=\"--awb-text-transform:none;\"><p>Prophet has many undeniable advantages that are especially useful for a business-oriented forecasting project, and which fully justify its popularity.<\/p>\n<p>One of them is its\u00a0<strong>ease of use. <\/strong>Only a few lines of code and\u00a0<strong>almost no feature engineering<\/strong>\u00a0are needed to have a good baseline. To learn more about how it works and how to use it, read\u00a0<a class=\"au ni\" href=\"https:\/\/twitter.com\/seanjtaylor\/status\/1123278380369973248\" target=\"_blank\" rel=\"noopener ugc nofollow\">this Twitter thread<\/a>\u00a0from its creator, as well as\u00a0<a class=\"au ni\" href=\"https:\/\/structural-time-series.fastforwardlabs.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">this excellent blog post<\/a>\u00a0(with\u00a0<a class=\"au ni\" href=\"https:\/\/github.com\/fastforwardlabs\/structural-time-series\" target=\"_blank\" rel=\"noopener ugc nofollow\">code<\/a>).<\/p>\n<\/div><div class=\"fusion-text fusion-text-13\" style=\"--awb-text-transform:none;\"><p><strong>Time features, <\/strong>such as trend and seasonality<strong class=\"kq ja\">\u00a0<\/strong>are created natively \u2014 Exit the rolling means, lags, and other tricky features required by machine learning (ML) tree-based models.<\/p>\n<p>However it can be quite a hassle to fine-tune if multiple events disturb the signal.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-10 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Trend<\/h2><\/div><div class=\"fusion-text fusion-text-14\" style=\"--awb-text-transform:none;\"><p>A great advantage compared to autoregressive models (eg. ARIMA) is that Prophet\u00a0<strong>doesn\u2019t require stationary time series<\/strong>: a trend component is generated natively.<\/p>\n<p>For these reasons, Prophet\u00a0<strong>works quite well for middle-term predictions<\/strong>\u00a0(we tried it at M+5 horizon), even though the confidence interval is quite large.<\/p>\n<\/div><div class=\"fusion-text fusion-text-15\" style=\"--awb-text-transform:none;\"><p>Trend can be correctly estimated\u00a0<strong>without any external data<\/strong>\u00a0(such as the number of customers). This is quite powerful, because when you predict call arrivals, you don\u2019t know how many customers you will have in 5 months, so you cannot use this feature.<br \/>\nFor instance, this plot shows the number of Fiber-Optic Internet (FIO) customers over time (a growing market for our telecom company), compared to the trend component learned by Prophet on call volumes. There is a strong correlation (Pearson coeff.: 0.988) between the volume of calls and the number of clients. So the model\u00a0<strong>learns the trend well<\/strong>, and only from the time-series itself.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27520%27%20height%3D%270%27%20viewBox%3D%270%200%20520%200%27%3E%3Crect%20width%3D%27520%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo2.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 520px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"520\" height=\"auto\" \/><div class=\"fusion-text fusion-text-16\" style=\"--awb-text-transform:none;\"><p>We identified some tips and tricks to make the trend a real benefit in your Prophet based forecasting.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-11 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\"><em>Trend: Watch your changepoints<\/em><\/h3><\/div><div class=\"fusion-text fusion-text-17\" style=\"--awb-text-transform:none;\"><p id=\"ded0\" class=\"pw-post-body-paragraph ko kp iz kq b kr ks ka kt ku kv kd kw kx ky kz la lb lc ld le lf lg lh li lj is gb\" data-selectable-paragraph=\"\">One of the strengths of Prophet is also a weakness for the stability of the results and the performance: The\u00a0<strong>trend component tends to explain the vast majority of the prediction<\/strong><strong class=\"kq ja\"> \u2014\u00a0<\/strong>around 90% for our case study. Thus, if the trend is not well estimated, performance will dramatically drop and you can lose over 20 points of MAPE by over or under predicting over time. You have multiple parameters to help Prophet adjust the trend, including the `changepoint_prior_scale` and the `changepoint_range`<\/p>\n<\/div><div class=\"fusion-text fusion-text-18\" style=\"--awb-text-transform:none;\"><p id=\"4add\" class=\"pw-post-body-paragraph ko kp iz kq b kr ks ka kt ku kv kd kw kx ky kz la lb lc ld le lf lg lh li lj is gb\" data-selectable-paragraph=\"\"><strong>Finding the right changepoint_prior_scale value is essential<\/strong>, because this parameter sets the flexibility of the trend. The higher it is, the more flexible the trend. Our strategy is to grid search this parameter with these values (in a logarithmic scale): [0.001, 0.01, 0.1, 0.5]. Having relatively small values will generally lead to better generalisation.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-12 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\"><em>Trend: Make the most out of the most recent data<\/em><\/h3><\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27636%27%20height%3D%270%27%20viewBox%3D%270%200%20636%200%27%3E%3Crect%20width%3D%27636%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo3.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 636px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"636\" height=\"auto\" \/><div class=\"fusion-text fusion-text-19\" style=\"--awb-text-transform:none;\"><p>Next point of attention: by default Prophet takes into account<strong>only the first 80% of the history <\/strong>to\u00a0<a class=\"au ni\" href=\"https:\/\/facebook.github.io\/prophet\/docs\/trend_changepoints.html\" target=\"_blank\" rel=\"noopener ugc nofollow\">approximate the trend<\/a>\u00a0by specifying 25 potential changepoints. We found that increasing this value of 80% by changing the changepoint_range parameter was improving performance. Indeed this will also take into account the latest data, which are more important to explain the level of calls in our case. For instance in this graph you can see that 2021 data is important because it has a decreasing trend. We chose to take into account the whole training set except the last 7 days instead of 80%.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-13 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\"><em>Trend: Clean your outliers<\/em><\/h3><\/div><div class=\"fusion-text fusion-text-20\" style=\"--awb-text-transform:none;\"><p>Another thing to consider is the <strong>sensitivity to outliers<\/strong>. The official documentation\u00a0<a class=\"au ni\" href=\"https:\/\/facebook.github.io\/prophet\/docs\/outliers.html\" target=\"_blank\" rel=\"noopener ugc nofollow\">recommends removing them<\/a>: \u201cProphet is able to handle the outliers in the history, but only by fitting them with trend changes\u201d.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27636%27%20height%3D%270%27%20viewBox%3D%270%200%20636%200%27%3E%3Crect%20width%3D%27636%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo4.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 636px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"636\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-14 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Seasonalities<\/h2><\/div><div class=\"fusion-text fusion-text-21\" style=\"--awb-text-transform:none;\"><p><strong>Seasonality components,<\/strong>\u00a0such as daily and yearly, are estimated with Fourier series. Because our time series have strong seasonal business cycles, we found that Prophet works quite well.<\/p>\n<p>But when we deep dive a bit, we found that\u00a0<strong>weekly seasonality modelling\u00a0is limited<\/strong>. Our time-series had very low Saturdays compared to the rest of the week (and no values on Sundays). We spent a lot of time and had a lot of trouble trying to improve our predictions on this particular day of the week.<\/p>\n<\/div><div class=\"fusion-text fusion-text-22\" style=\"--awb-text-transform:none;\"><p>We Finally had to use a workaround:\u00a0<strong>stacking two models, including our Prophet model and a statistical model<\/strong>\u00a0computing predictions based on the average weight of week days over the last 6 weeks. And this despite having tried to change all parameters in Prophet\u2019s weekly seasonality.<\/p>\n<p>Our understanding: On a 7-days-period seasonality (6 in our case without Sundays), Increasing the Fourier order is not that useful, because the interval between 0 and 2pi is only divided in a few segments (6 or 7). And a low Fourier order means that <strong>it cannot fit extreme values and rapid changes<\/strong>\u00a0in seasonality, like Saturdays in the example above.<\/p>\n<p>Some other tricks to fine-tune seasonalities:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-7 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Fits better with a multiplicative mode<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Add custom seasonalities<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Change Fourrier\u2019s order<\/div><\/li><\/ul><div class=\"fusion-title title fusion-title-15 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Events and extra regressors<\/h2><\/div><div class=\"fusion-text fusion-text-23\" style=\"--awb-text-transform:none;\"><p>For\u00a0<strong>events\u00a0and extra-regressors\u00a0<\/strong>as well Prophet can be handy.<\/p>\n<p>You can\u00a0<strong>add extra-<a class=\"au ni\" href=\"https:\/\/nbviewer.org\/github\/nicolasfauchereau\/Auckland_Cycling\/blob\/master\/notebooks\/Auckland_cycling_and_weather.ipynb\" target=\"_blank\" rel=\"noopener ugc nofollow\">regressors<\/a><\/strong>, either continuous or categorical, by providing another time-series (values and dates) to the model with the\u00a0<em class=\"lk\">add_regressor<\/em>\u00a0method. Events are managed as categorical regressors (value is either 0 \u2014 the event is not happening on that day or hour \u2014 or 1 \u2014 the event is happening).<\/p>\n<\/div><div class=\"fusion-text fusion-text-24\" style=\"--awb-text-transform:none;\"><p>Adding new events is easy: you only need to provide Prophet with a dataframe that contains the dates and names of events.<br \/>\nIt worked quite well with holidays, vacations, and other events. And it tends to\u00a0<strong>give better results than the tree-based models<\/strong>.<\/p>\n<p>On top of that, Prophet is using the Python\u00a0<em><a class=\"au ni\" href=\"https:\/\/pypi.org\/project\/holidays\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">holidays<\/a><\/em>\u00a0package to allow you to only use the id of the country (USA or FRA) to add related holidays as a feature.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27686%27%20height%3D%270%27%20viewBox%3D%270%200%20686%200%27%3E%3Crect%20width%3D%27686%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo5.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 686px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"686\" height=\"auto\" \/><div class=\"fusion-text fusion-text-25\" style=\"--awb-text-transform:none;\"><p>As with many other time series prediction algorithms, it is often\u00a0<strong>difficult to know whether a recurring event is already included in prophet\u2019s seasonality\u00a0<\/strong>or whether it needs to be flagged manually to help the algorithm. A simple example is the Christmas and New Year period: same period, roughly same effect, every year. A tricky one is french spring holidays. In France, around April, there are two-weeks school holidays with moving dates from year to year, and divided by geographical area (not all of France goes on holiday at the same time).<\/p>\n<\/div><div class=\"fusion-text fusion-text-26\" style=\"--awb-text-transform:none;\"><p>While the yearly seasonality is low during this period, the effect of a \u201cspring holiday\u201d event is positive on call volumes predictions. And the model performs better with this event. So the effect of this event is inconsistent with other holidays and with the seasonality we observe, but there is an effect on model training and predictions that improves performance\u2026 Should we add it or not?<br \/>\nWe observed\u00a0<strong>similar issues with various public holidays<\/strong>\u00a0that are moving around every year, and we sometimes had to stack Prophet with a statistical model to better fit holidays\u2019 effects. However, we do not have any consistent solution to offer.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-16 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\"><p id=\"3eb3\" class=\"pw-post-body-paragraph ko kp iz kq b kr ks ka kt ku kv kd kw kx ky kz la lb lc ld le lf lg lh li lj is gb\" data-selectable-paragraph=\"\"><em>Feature crosses are time-consuming and often over-engineered<\/em><\/p><\/h3><\/div><div class=\"fusion-text fusion-text-27\" style=\"--awb-text-transform:none;\"><p>As Prophet is a roughly linear model in\u00a0<strong>the way it handles extra-features and events, feature cross is not automatic.<\/strong>\u00a0Meaning that Prophet cannot infer that a combination of values of different features will lead to an exponentially higher or lower impact on prediction, whereas it is something that tree-based algorithms and Deep Learning can infer very well.<\/p>\n<\/div><div class=\"fusion-text fusion-text-28\" style=\"--awb-text-transform:none;\"><p>Example: let\u2019s say that you have an impact on your time-series at Business Day + 1 after a holiday (<em>HBD+1<\/em>). Then providing Prophet with an event \u201c<em>HBD+1<\/em>\u201d will allow it to better fit this effect. But here, the impact depends largely on whether the day\u00a0<em>HBD+1<\/em>\u00a0is on a Monday, Saturday etc. And It is not linear nor multiplicative. Hence you\u2019ll have to add all the features \u201c<em>HBD+1_monday<\/em>\u201d, \u201c<em>HBD+<\/em><em>1_tuesday<\/em>\u201d,\u2026<\/p>\n<p>When crossing features, their number grows exponentially and it is going to cost you both\u00a0<strong>time to compute them, a loss of interpretability, and probably a drop in performance<\/strong>if you add too many of these features.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-17 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Interpretability<\/h2><\/div><div class=\"fusion-text fusion-text-29\" style=\"--awb-text-transform:none;\"><p>One of the key advantages of Prophet over other models is its interpretability.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27538%27%20height%3D%270%27%20viewBox%3D%270%200%20538%200%27%3E%3Crect%20width%3D%27538%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo6.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 538px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"538\" height=\"auto\" \/><div class=\"fusion-text fusion-text-30\" style=\"--awb-text-transform:none;\"><p><em>The\u00a0native decomposition of the forecast into trend, seasonalities, events and extra-regressors components\u00a0is meaningful for low-tech profiles.<\/em><\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27568%27%20height%3D%270%27%20viewBox%3D%270%200%20568%200%27%3E%3Crect%20width%3D%27568%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2022\/03\/article-hugo7.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 568px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"568\" height=\"auto\" \/><div class=\"fusion-text fusion-text-31\" style=\"--awb-text-transform:none;\"><p><strong>Prophet is an additive model<\/strong>\u00a0: the sum of each component equals the prediction. Each component importance is expressed\u00a0<strong>directly in the target unit<\/strong>(unlike\u00a0<a class=\"au ni\" href=\"https:\/\/christophm.github.io\/interpretable-ml-book\/shap.html\" target=\"_blank\" rel=\"noopener ugc nofollow\">SHAP values<\/a>). And it provides both local and global explainability.<\/p>\n<p>Consequently, it is really\u00a0<strong>easy to plot the prediction \/ impact of each component on the forecast<\/strong>. If you choose to switch to a multiplicative mode, where every component is expressed as a percentage of the trend, you will have a little more work to do, but it remains very easy to plot.<\/p>\n<\/div><div class=\"fusion-text fusion-text-32\" style=\"--awb-text-transform:none;\"><p>Unfortunately all these components\u00a0<strong>only provide about 10% of the prediction,<\/strong>\u00a0the remaining\u00a0<strong>90% being predicted in the trend<\/strong>\u2026 which is almost unexplainable. It will be your job to try to explain the trend using external regressors that you cannot use as features for Prophet, such as customer base growth, contact rates, and changes in customer behaviours for our case study. To do so, you need to have the actual values associated with each one of these features: hence it is only possible to analyse your trend when you look back to the predictions made in the past.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-18 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Performance and maintainability in production<\/h2><\/div><div class=\"fusion-title title fusion-title-19 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Performance<\/h3><\/div><div class=\"fusion-text fusion-text-33\" style=\"--awb-text-transform:none;\"><p>Prophet has very quickly good performance,\u00a0<strong>compared to the development time<\/strong>. In other words, it offers a good baseline quickly, as you don\u2019t have to craft time features.<\/p>\n<p>Prophet makes it possible to forecast time series with\u00a0<strong>almost no feature engineering <\/strong>and a\u00a0<strong>good level of performance<\/strong>, in record time.<\/p>\n<p><strong>It trains fast<\/strong>: it takes less than 1 minute per model, with cross-validation, on a dataset with ~3 years of data on a macbook Air with M1 chip and 8 Go of memory.<\/p>\n<\/div><div class=\"fusion-text fusion-text-34\" style=\"--awb-text-transform:none;\"><p>In production as new data comes in you need to re-fit your model. A way to speed-up the training is to warm-start the fit, using the model parameters of the earlier model. You can also use this feature to accelerate the cross-validation process. Check the section \u201cUpdating fitted models\u201d\u00a0<a class=\"au ni\" href=\"https:\/\/facebook.github.io\/prophet\/docs\/additional_topics.html\" target=\"_blank\" rel=\"noopener ugc nofollow\">on the documentation<\/a>\u00a0to go further.<\/p>\n<p>Prophet needs at least two years of data to compute yearly seasonality, but we recommend\u00a0<strong>having at least 3 years of historic data<\/strong>\u00a0to have good performances.<\/p>\n<\/div><div class=\"fusion-text fusion-text-35\" style=\"--awb-text-transform:none;\"><p>We achieved a performance of ~15%\u00a0<a class=\"au ni\" href=\"https:\/\/en.wikipedia.org\/wiki\/Mean_absolute_percentage_error\" target=\"_blank\" rel=\"noopener ugc nofollow\">MAPE<\/a>\u00a0after a few iterations.\u00a0<strong>Fine-tuning results however was quite challenging\u00a0<\/strong>and it was hard to bread this ceiling. We had to develop some custom corrections on the output to achieve a ~10% MAPE.<\/p>\n<p>In our project Prophet and XGboost have similar performance metrics in the M+1 and M+2 horizons. However, the performances in M+3 and M+4 tend to degrade more on Prophet compared to XGboost. This is because the trend wasn\u2019t correctly estimated. While it doesn\u2019t impact short-term predictions, long term forecasts are heavily affected by the trend direction, as it keeps growing or decreasing over time, which leads to over\/under prediction. Using another approach for long-term forecasts is probably safer.<\/p>\n<\/div><div class=\"fusion-text fusion-text-36\" style=\"--awb-text-transform:none;\"><p>Interestingly,\u00a0<strong>sometimes adding more historical data can be counterproductive<\/strong>\u00a0and lead to a drop in forecast accuracy. Prophet does not allow to put more weight on the most recent observations, so more data can lead to a decrease of forecast accuracy.<br \/>\nHere the tip would be to conduct experiments with several lengths of historical data and select the one that yields the better results.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-20 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Stability of the results<\/h3><\/div><div class=\"fusion-text fusion-text-37\" style=\"--awb-text-transform:none;\"><p>Despite some undeniable advantages, Prophet is not a plug-and-play model. It requires some time to fine-tune it to boost performance. Some weaknesses make it hard to rely on its stability in production.<br \/>\nTo assess how often we would need to re-train the model, we compared 2 strategies. We generated forecast on different months and measured the results:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-8 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Fine-tune the model hyperparameters every month (with a grid search + a temporal cross-validation for picking the best combinaison)<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p>Use the same hyper-parameters for all the forecasts<\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-38\" style=\"--awb-text-transform:none;\"><p>Re-training the model every month had better results. In conclusion, despite the temporal cross-validation the hyperparameters were not stable across time. For XGboost you don\u2019t have to do such retraining frequently. However, these results should be treated with caution, as the volumes were impacted by the COVID crisis at the time we made this benchmark. Here again our intuition to explain the result was that the trend is hard to estimate correctly.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-21 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Scalability<\/h3><\/div><div class=\"fusion-text fusion-text-39\" style=\"--awb-text-transform:none;\"><p>One of the drawbacks of this univariate model is that you need\u00a0<strong>one model per SKU<\/strong>, compared to tree-based approaches where you can use the same model for many products.<\/p>\n<p>Usually it leads to better performances,\u00a0<a class=\"au ni\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/time-series-forecasting-how-did-we-put-our-first-sales-forecasting-solution-for-croissants-into-93f9ed45bb49\" rel=\"noopener\" target=\"_blank\">as Pierre-Yves Mousset pointed out<\/a>\u00a0on his project. However, having many models can be an engineering challenge and a nightmare to maintain.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-22 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Conclusion<\/h2><\/div><div class=\"fusion-text fusion-text-40\" style=\"--awb-text-transform:none;\"><p>Prophet ease-of-use made it a very good baseline model when your timeseries easily breakdowns into simple temporal components. However if your signal is noisy, fine-tuning the model\u2019s performance can be a hassle.<\/p>\n<p>Thanks to its native breakdown of the forecast into time components, the model decisions are easy to interpret. Nevertheless it\u2019s not precise enough to be used to measure the impact of an external event, because you never know if the effect of the event is already taken into account in the native time components.<\/p>\n<\/div><div class=\"fusion-text fusion-text-41\" style=\"--awb-text-transform:none;\"><p>If your timeseries follows some business cycles, you can obtain very decent performance quickly, without intensive feature engineering. However the trend component is not always well estimated, and this can create significant performance drifts. For this reason, this model can require careful monitoring and frequent human interventions.<\/p>\n<p>If you want to provide some explainability and build a decent model easily and quickly, Prophet is an option to consider. However if you care about stability and forecast accuracy, consider using another kind of algorithm, such as tree-based models,\u00a0<a class=\"au ni\" href=\"https:\/\/github.com\/uber\/orbit\" target=\"_blank\" rel=\"noopener ugc nofollow\">Orbit<\/a>\u00a0or\u00a0<a class=\"au ni\" href=\"https:\/\/arxiv.org\/abs\/1704.04110\" target=\"_blank\" rel=\"noopener ugc nofollow\">DeepAR<\/a>.<\/p>\n<\/div><\/div><\/div><\/div><\/article><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-5 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-margin-top:40px;--awb-margin-bottom:40px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-center fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-5 fusion_builder_column_1_1 1_1 fusion-flex-column fusion-flex-align-self-center\" style=\"--awb-padding-top:40px;--awb-padding-right:40px;--awb-padding-bottom:40px;--awb-padding-left:40px;--awb-overflow:hidden;--awb-bg-position:left center;--awb-bg-size:cover;--awb-border-color:rgba(10,17,40,0.1);--awb-border-style:solid;--awb-border-radius:4px 4px 4px 4px;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper lazyload fusion-column-has-shadow fusion-flex-justify-content-center fusion-content-layout-column fusion-column-has-bg-image\" data-bg-url=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/background.jpg\" data-bg=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/background.jpg\"><div class=\"fusion-image-element\" style=\"text-align:center;--awb-margin-right:20px;--awb-margin-left:20px;--awb-max-width:150px;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><span class=\" fusion-imageframe imageframe-none imageframe-2 hover-type-none\"><img decoding=\"async\" width=\"72\" height=\"41\" title=\"medium\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2772%27%20height%3D%2741%27%20viewBox%3D%270%200%2072%2041%27%3E%3Crect%20width%3D%2772%27%20height%3D%2741%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/medium.png\" alt class=\"lazyload img-responsive wp-image-60927\"\/><\/span><\/div><div class=\"fusion-title title fusion-title-23 fusion-sep-none fusion-title-center fusion-title-text fusion-title-size-three\" style=\"--awb-margin-top:20px;--awb-margin-bottom:0px;--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-center fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Medium Blog by Artefact.<\/h3><\/div><div class=\"fusion-text fusion-text-42\" style=\"--awb-content-alignment:center;\"><p>This article was initially published on <strong>Medium.com<\/strong>.<br \/>\nFollow us on our Medium Blog !<\/p>\n<\/div><div style=\"text-align:center;\"><a class=\"fusion-button button-flat button-medium button-default fusion-button-default button-1 fusion-button-default-span fusion-button-default-type\" target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/is-facebook-prophet-suited-for-doing-good-predictions-in-a-real-world-project-44be1fe4ce91\"><span class=\"fusion-button-text awb-button__text awb-button__text--default\">Read Our Article<\/span><\/a><\/div><\/div><\/div><\/div><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6307\u5357\u5c06\u5e2e\u52a9\u60a8\u4e86\u89e3 Facebook \u5148\u77e5\u662f\u5426\u9002\u5408\u60a8\u7684\u9884\u6d4b\u9879\u76ee\u3002.<\/p>","protected":false},"featured_media":68683,"parent":0,"template":"","meta":{"_acf_changed":false,"ep_exclude_from_search":false},"blog-category":[21939],"blog-language":[2991],"class_list":["post-66571","blog","type-blog","status-publish","has-post-thumbnail","hentry","blog-category-medium","blog-language-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/blog\/66571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/types\/blog"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/media\/68683"}],"wp:attachment":[{"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/media?parent=66571"}],"wp:term":[{"taxonomy":"blog-category","embeddable":true,"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/blog-category?post=66571"},{"taxonomy":"blog-language","embeddable":true,"href":"https:\/\/www.artefact.com\/zh\/wp-json\/wp\/v2\/blog-language?post=66571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}