{"id":3416,"date":"2023-08-31T10:59:21","date_gmt":"2023-08-31T10:59:21","guid":{"rendered":"https:\/\/neuraldesigner.com\/blog\/retail-store-sales-forecasting\/"},"modified":"2025-09-26T16:38:03","modified_gmt":"2025-09-26T14:38:03","slug":"retail-store-sales-forecasting","status":"publish","type":"blog","link":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/","title":{"rendered":"Forecast sales of a retail store using machine learning"},"content":{"rendered":"<p><a href=\"https:\/\/www.neuraldesigner.com\/solutions\/sales-forecasting\">Sales forecasting<\/a> is a crucial task for managing a store, and machine learning can help identify the factors that influence sales in a retail store and estimate future sales.<\/p>\n<p>In this post, we use historical sales data of a drugstore chain to predict its sales up to one week in advance.<\/p>\n<section>You can follow the step-by-step construction of this predictive model by downloading the free trial of the data science and machine learning platform\u00a0<a style=\"font-family: var( --e-global-typography-text-font-family ), Sans-serif; font-size: var( --e-global-typography-text-font-size ); font-weight: var( --e-global-typography-text-font-weight ); background-color: #ffffff;\" href=\"https:\/\/www.neuraldesigner.com\/\">Neural Designer<\/a>.<\/section>\n<section>\n<h3><span style=\"font-size: 16px;\">Contents<\/span><\/h3>\n<\/section>\n<section>\n<ol>\n<li><a href=\"#DataAnalysis\">Data analysis<\/a>.<\/li>\n<li><a href=\"#ModelTraining\">Model training<\/a>.<\/li>\n<li><a href=\"#TestingAnalysis\">Testing analysis<\/a>.<\/li>\n<li><a href=\"#ModelDeployment\">Model deployment<\/a>.<\/li>\n<li><a href=\"#Conclusions\">Conclusions<\/a>.<\/li>\n<\/ol>\n<\/section>\n<section>\n<h2>Data analysis<\/h2>\n<p>The first step\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">in the analysis is to examine the\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\" target=\"_blank\" rel=\"noopener\">dataset<\/a>, which contains <\/span>sales information from the drug stores.<\/p>\n<h3>Monthly sales<\/h3>\n<p>The following time series chart illustrates the monthly sales volume.<\/p>\n<p><img decoding=\"async\" style=\"width: 50%;\" src=\"https:\/\/www.neuraldesigner.com\/images\/MonthSales.webp\" alt=\"Sales per month in a retail store\" \/><\/p>\n<p>As we can see, the number of sales peaks in July and more so in December.<\/p>\n<p>The months with the fewest sales are January, May, and October.<\/p>\n<h3>Daily sales<\/h3>\n<p>The following chart shows the distribution of sales throughout the month.<\/p>\n<p><img decoding=\"async\" style=\"width: 50%;\" src=\"https:\/\/www.neuraldesigner.com\/images\/MonthDaySales.webp\" alt=\"Sales by day of month in a retail store\" \/><\/p>\n<p>In this case, the days at the beginning and end of the month have higher activity.<\/p>\n<p>Around the middle of the month, a smaller peak occurs.<\/p>\n<h3>Weekly sales<\/h3>\n<p>It is also essential to examine the sales numbers by weekday.<\/p>\n<p>The following time series chart shows the sales in these shops from Monday (1) to Sunday (7).<\/p>\n<p><img decoding=\"async\" style=\"width: 50%;\" src=\"https:\/\/www.neuraldesigner.com\/images\/WeekdaySales.webp\" alt=\"Sales by weekday in a retail store\" \/><\/p>\n<p>Monday is the preferred day for customers to make purchases in these retail shops.<\/p>\n<p>During the rest of the week, the sales decrease from Monday to Thursday and increase on Friday.<\/p>\n<p>On Sunday, there is a sharp decline in sales.<\/p>\n<p>This is because most of the shops in this drugstore chain are closed on this day.<\/p>\n<h2>Variables<\/h2>\n<p>The next step is to select and prepare the\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#Variables\">variables<\/a> we will use.<\/p>\n<p>The following list shows the\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#InputVariables\">input variables<\/a>, also known as predictands, and the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#TargetVariables\">target variables<\/a>, also referred to as predictors.<\/p>\n<h3>Calendar variables<\/h3>\n<ul>\n<li>Day of the month.<\/li>\n<li>Month.<\/li>\n<li>Day of the week.<\/li>\n<\/ul>\n<h3>Event variables<\/h3>\n<ul>\n<li>Promotion.<\/li>\n<li>State holidays.<\/li>\n<li>School holidays.<\/li>\n<\/ul>\n<h3>Historical data variables<\/h3>\n<ul>\n<li>Sales of the 7 previous days.<\/li>\n<li>Promotions of the 7 previous days.<\/li>\n<\/ul>\n<h3>Target variables<\/h3>\n<ul>\n<li>Sales of the next seven days.<\/li>\n<\/ul>\n<p>In total, there are 20 inputs and 7 targets.<\/p>\n<\/section>\n<section>\n<h2>Model training<\/h2>\n<p>After defining the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#Variables\">variables<\/a> we will use for the analysis, we will use <a href=\"https:\/\/www.neuraldesigner.com\/free-trial\">Neural Designer<\/a> to build the predictive model for the sales of the stores.<\/p>\n<p>The following image shows a representation of the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\">neural network<\/a> used for predictive analysis.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/Sales_neural_network.webp\" alt=\"Neural network to forecast sales in retail stores\" \/><\/p>\n<p>The information on the previous week&#8217;s date, promos, holidays, and sales enters the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\">neural network<\/a> through the left layer.<\/p>\n<p>Then, it is analyzed by <a href=\"https:\/\/www.neuraldesigner.com\/blog\/perceptron-the-main-component-of-neural-networks\">perceptrons<\/a> in the middle layer to find the patterns that determine the number of sales given by the last layer.<\/p>\n<p>Now, the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\">neural network<\/a> is ready to be trained using the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#QuasiNewtonMethod\">Quasi-Newton algorithm<\/a>.<\/p>\n<p>For more information on this and other optimization algorithms, refer\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/blog\/5_algorithms_to_train_a_neural_network\" target=\"_blank\" rel=\"noopener\">to &#8220;5 Algorithms to Train a Neural Network<\/a>.&#8221;<\/p>\n<\/section>\n<section>\n<h2>Testing analysis<\/h2>\n<p>Before using the model to forecast sales, the final step is to determine its predictive power on an independent dataset that has not been used for training.<\/p>\n<p>The following chart shows the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#LinearRegressionAnalysis\">linear regression analysis<\/a> between the scaled output of the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\">neural network<\/a> and the corresponding scaled targets.<\/p>\n<p><img decoding=\"async\" style=\"width: 50%;\" src=\"https:\/\/www.neuraldesigner.com\/images\/Sales_regression_chart.webp\" alt=\"Regression to forecast sales in retail stores\" \/><\/p>\n<p>The previous <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#LinearRegressionAnalysis\">linear regression analysis<\/a> gives us a correlation coefficient of 0.976 and a slope close to 1.<\/p>\n<p>This indicates that the model is performing well for this dataset.<\/p>\n<p>Consequently, the model is ready to be moved to the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment\">deployment phase<\/a>.<\/p>\n<\/section>\n<section>\n<h2>Model deployment<\/h2>\n<p>Once we have tested the model, we can predict the shop&#8217;s sales one week in advance.<\/p>\n<p>We introduce the data from the current week as input and obtain the expected sales for each day of the following week.<\/p>\n<p>In the following chart, there is a comparison between the predicted sales applying a promotion or not.<\/p>\n<p>The blue line represents the number of sales the model predicts without a promotion, and the orange line represents the number of sales with a promotion.<\/p>\n<p>We can see a significant increase.<\/p>\n<p><img decoding=\"async\" style=\"width: 50%;\" src=\"https:\/\/www.neuraldesigner.com\/images\/WeekdaySalesPrediction.webp\" alt=\"Retail store sales predictions\" \/><\/p>\n<p>As we can see, following Monday is when most sales are expected.<\/p>\n<p>During the rest of the week, the number of sales is expected to remain stable, but it is anticipated to decrease on Sunday, as most stores will be closed.<\/p>\n<\/section>\n<section>\n<h2>Conclusions<\/h2>\n<p>In this post, we have developed a <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment\">predictive model<\/a> that can help retailers forecast their future sales.<\/p>\n<p>Using this model, retailers can plan the number of products they need.<\/p>\n<p>As a consequence, the system will allow them to increase their profits.<\/p>\n<\/section>\n<section>\n<h2>References<\/h2>\n<ul>\n<li>The data used for this example can be downloaded from <a href=\"https:\/\/www.kaggle.com\/c\/rossmann-store-sales\/data\" target=\"_blank\" rel=\"noopener\">Kaggle<\/a>. It has been processed with Python to obtain the desired results. You can download the processed dataset <a href=\"https:\/\/www.neuraldesigner.com\/files\/datasets\/rossmann_stores_sales.csv\">here<\/a>.<\/li>\n<\/ul>\n<\/section>\n<section>\n<h2>Related posts<\/h2>\n<\/section>\n","protected":false},"author":22,"featured_media":2269,"template":"","categories":[],"tags":[42],"class_list":["post-3416","blog","type-blog","status-publish","has-post-thumbnail","hentry","tag-retail"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Forecast sales of a retail store using machine learning<\/title>\n<meta name=\"description\" content=\"Build a machine learning model to forecast sales in a retail store and discover the factors that influence sales.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sales prediction model for a retail store using machine learning\" \/>\n<meta property=\"og:description\" content=\"Here, we predict the number of sales of a retail store one week in advance using advanced analytics.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/\" \/>\n<meta property=\"og:site_name\" content=\"Neural Designer\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-26T14:38:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Sales prediction model for a retail store using machine learning\" \/>\n<meta name=\"twitter:description\" content=\"Here, we predict the number of sales of a retail store one week in advance using advanced analytics.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp\" \/>\n<meta name=\"twitter:site\" content=\"@NeuralDesigner\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/\",\"name\":\"Forecast sales of a retail store using machine learning\",\"isPartOf\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp\",\"datePublished\":\"2023-08-31T10:59:21+00:00\",\"dateModified\":\"2025-09-26T14:38:03+00:00\",\"description\":\"Build a machine learning model to forecast sales in a retail store and discover the factors that influence sales.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.neuraldesigner.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog\",\"item\":\"https:\/\/www.neuraldesigner.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Forecast sales of a retail store using machine learning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"name\":\"Neural Designer\",\"description\":\"Explanable AI Platform\",\"publisher\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.neuraldesigner.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\",\"name\":\"Neural Designer\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"width\":1024,\"height\":223,\"caption\":\"Neural Designer\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NeuralDesigner\",\"https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Forecast sales of a retail store using machine learning","description":"Build a machine learning model to forecast sales in a retail store and discover the factors that influence sales.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/","og_locale":"en_US","og_type":"article","og_title":"Sales prediction model for a retail store using machine learning","og_description":"Here, we predict the number of sales of a retail store one week in advance using advanced analytics.","og_url":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/","og_site_name":"Neural Designer","article_modified_time":"2025-09-26T14:38:03+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_title":"Sales prediction model for a retail store using machine learning","twitter_description":"Here, we predict the number of sales of a retail store one week in advance using advanced analytics.","twitter_image":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp","twitter_site":"@NeuralDesigner","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/","url":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/","name":"Forecast sales of a retail store using machine learning","isPartOf":{"@id":"https:\/\/www.neuraldesigner.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage"},"thumbnailUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp","datePublished":"2023-08-31T10:59:21+00:00","dateModified":"2025-09-26T14:38:03+00:00","description":"Build a machine learning model to forecast sales in a retail store and discover the factors that influence sales.","breadcrumb":{"@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#primaryimage","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/drug-store.webp","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.neuraldesigner.com\/blog\/retail-store-sales-forecasting\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.neuraldesigner.com\/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https:\/\/www.neuraldesigner.com\/blog\/"},{"@type":"ListItem","position":3,"name":"Forecast sales of a retail store using machine learning"}]},{"@type":"WebSite","@id":"https:\/\/www.neuraldesigner.com\/#website","url":"https:\/\/www.neuraldesigner.com\/","name":"Neural Designer","description":"Explanable AI Platform","publisher":{"@id":"https:\/\/www.neuraldesigner.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.neuraldesigner.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.neuraldesigner.com\/#organization","name":"Neural Designer","url":"https:\/\/www.neuraldesigner.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","width":1024,"height":223,"caption":"Neural Designer"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NeuralDesigner","https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/blog\/3416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/users\/22"}],"version-history":[{"count":0,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/blog\/3416\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media\/2269"}],"wp:attachment":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media?parent=3416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/categories?post=3416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/tags?post=3416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}