<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Inderpartap Singh Cheema</title>
    <description>The latest articles on DEV Community by Inderpartap Singh Cheema (@inderpartap).</description>
    <link>https://dev.to/inderpartap</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F393247%2F8c9fda1e-56cd-4c46-822b-f11664a33643.png</url>
      <title>DEV Community: Inderpartap Singh Cheema</title>
      <link>https://dev.to/inderpartap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/inderpartap"/>
    <language>en</language>
    <item>
      <title>Impact of weather on fashion retailers</title>
      <dc:creator>Inderpartap Singh Cheema</dc:creator>
      <pubDate>Sat, 23 May 2020 00:22:15 +0000</pubDate>
      <link>https://dev.to/inderpartap/impact-of-weather-on-fashion-retailers-4fgn</link>
      <guid>https://dev.to/inderpartap/impact-of-weather-on-fashion-retailers-4fgn</guid>
      <description>&lt;h2&gt;
  
  
  &lt;a href="http://inderpartap.github.io/trendcast.html"&gt;Trendcast&lt;/a&gt; - Demand Forecast for Fashion Retailers
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Exploring the Impact of Weather on Short-time Demand Forecast for Fashion Retailers.&lt;br&gt; &lt;br&gt;
Our &lt;code&gt;Dashboard&lt;/code&gt; predicts the inventory requirements with the help of &lt;code&gt;past sales&lt;/code&gt; and real-time &lt;code&gt;weather forecast&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Watch the project video here -&lt;/p&gt;

&lt;p&gt;
    &lt;a href="https://www.youtube.com/watch?v=9ela0BQeP9M" alt="Youtube Video"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XinXd_S9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.youtube.com/vi/9ela0BQeP9M/0.jpg"&gt;
    &lt;/a&gt;
    &lt;/p&gt;
&lt;h3&gt;
  
  
  The Pipeline -
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bg1Wuudn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cisv512ajo5dhx17qnda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bg1Wuudn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cisv512ajo5dhx17qnda.png" alt="Pipeline"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Data Collection:
&lt;/h4&gt;

&lt;p&gt;The pipeline incorporates datasets from two sources to solve the problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Retail Data: A historic time-series dataset containing six years of retail sales transactions. The dataset was hierarchical in nature containing: Date of purchase → Province → City → Category → Department → Class → Style → Quantity of items sold and Total sales.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Weather Data: I fetched the weather-related information like min temperature, max temperature, precipitation, snow depth, wind speed, etc, for corresponding dates and cities in the retail data from Meteostat using their Historical Weather API. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Extraction, Transformation and Loading [ETL]:
&lt;/h4&gt;

&lt;p&gt;Data integration was performed at two levels, city and date. After combining the two data sources, the following ETL steps were performed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Weather features with more than 80% null values were dropped since interpolating them would lead to incorrect and biased data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other missing data in weather was filled with interpolation using the nearest matching assuming that the weather would not vary a lot in small time-frames.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Missing data in the retail sales records after integration was filled with zeroes assuming there were no sales that particular day.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Exploratory Data Analysis [EDA]:
&lt;/h4&gt;

&lt;p&gt;For the initial EDA, AWS Quicksight was used to have an initial overview of the dataset. After this, I explored the distribution of the features to measure the skewness, cardinality and frequency distribution of the unique features in the feature vector.&lt;br&gt;
After basic EDA, I tried to find multiple feature interactions with each other for which I made a heatmap visualizing the correlation of features using Matplotlib and Seaborn.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XNcty0_E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zrjys3wo2pp4j95fi39d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XNcty0_E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zrjys3wo2pp4j95fi39d.png" alt="EDA plots"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Data Modeling:
&lt;/h4&gt;

&lt;p&gt;A Stacked Ensemble was created which is a technique where data is trained on base learners and then predictions from those models are fed into a meta-model which then predicts the final values.&lt;br&gt;
In this implementation, I used random forest, extra trees, AdaBoost and gradient boosted trees regressor as our base learners or level-0 models. XGBoost was used as the meta-model or level-1 model which was trained on the predictions of level-0 (base learners).&lt;br&gt;
I was able to achieve an RMSE of 0.08 and MAE of 0.11 with this approach.&lt;/p&gt;
&lt;h4&gt;
  
  
  Visualization
&lt;/h4&gt;

&lt;p&gt;Once the model files were generated, Flask was used to create a front-end dashboard for the end-user. The user has the ability to choose the City and the Department for which he wants to view the predictions. The application then identifies the date of the latest transaction from the dataset and then calls the weather API to get the weather information for the upcoming week. This information is then fed into the appropriate model and the predictions are displayed on the dashboard using ApexCharts.js.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s0IWDabA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xuq1ylouo4gphvqaqk3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s0IWDabA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xuq1ylouo4gphvqaqk3z.png" alt="Frontend"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Future Notes
&lt;/h4&gt;

&lt;p&gt;This project showed that the weather does have a modest impact on retail sales for some cities and classes of departments. Future analysis could work on modelling on the granular level of data such as style and class, which would give even more accurate forecasts regarding the items needed to stock for the coming week. In this project we focused on an ablation study, to analyze the impact of weather. A statistical approach to understand the causality of weather such as the Granger-Causality test could also be applied. The forecast horizon could also be extended for reliable predictions in future studies.&lt;/p&gt;
&lt;h3&gt;
  
  
  Project source -
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vWogaON8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-28d89282e0daa1e2496205e2f218a44c755b0dd6536bbadf5ed5a44a7ca54716.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/inderpartap"&gt;
        inderpartap
      &lt;/a&gt; / &lt;a href="https://github.com/inderpartap/trendcast"&gt;
        trendcast
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      From supply-chain to marketing, weather-related changes have impacted how retailers do business. This project helps fashion retailers better manage their inventories through our short-term demand prediction including weather as an influencing factor.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Welcome to Trendcast 👋
&lt;/h1&gt;
&lt;p&gt;
    &lt;a href="https://www.python.org/" alt="Made with Python" rel="nofollow"&gt;
        &lt;img src="https://camo.githubusercontent.com/5392ad6fb7875a2520001270f08309896b6cb25d/687474703a2f2f466f7254686542616467652e636f6d2f696d616765732f6261646765732f6d6164652d776974682d707974686f6e2e737667"&gt;
    &lt;/a&gt;
    &lt;br&gt;
        &lt;a href="https://github.com/inderpartap/trendcast" alt="Trendcast Repo Size"&gt;
            &lt;img src="https://camo.githubusercontent.com/7ee81795a3d08fce7b1cc1d38df6ffed264ae1bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f696e6465727061727461702f7472656e6463617374"&gt;
        &lt;/a&gt;
    &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Exploring the Impact of Weather on Short-time Demand Forecast for Fashion
Retailers.&lt;br&gt; Our &lt;code&gt;Dashboard&lt;/code&gt; will predict your inventory requirements with
the help of &lt;code&gt;past sales&lt;/code&gt; and real-time &lt;code&gt;weather forecast&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
    &lt;a href="https://www.youtube.com/watch?v=9ela0BQeP9M" alt="Youtube Video" rel="nofollow"&gt;
        &lt;img src="https://camo.githubusercontent.com/a7b050774bccd3928adadb00c436c3bdfb6cf2d0/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f39656c613042516550394d2f302e6a7067"&gt;
    &lt;/a&gt;
    &lt;/p&gt;
&lt;h2&gt;
✨ Demo&lt;/h2&gt;
&lt;p&gt;Go to the app folder and run:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;python app.py&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make sure to install the requirements before you start the flask app.&lt;/p&gt;
&lt;h2&gt;
🚀 Development Setup&lt;/h2&gt;
&lt;p&gt;Clone the repository:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;git clone https://github.com/inderpartap/trendcast.git&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Install the application requirements in a linux environment:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;pip install requirements.txt&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make sure to add a retail dataset in the data folder to start working.&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;Columns used &lt;span class="pl-k"&gt;in&lt;/span&gt; our the dataset are (date, province, city, category, department, class, article, totalSales, totalQuantity)&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That's it. You can now start contributing to the project.&lt;/p&gt;
&lt;h2&gt;
Code Contributors&lt;/h2&gt;
&lt;p&gt;Thanks to the following people who have contributed to this project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/inderpartap"&gt;@inderpartap&lt;/a&gt; 🎨 💻
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/najq"&gt;@najq&lt;/a&gt; 📹 💻
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/pallavibharadwaj"&gt;@pallavibharadwaj&lt;/a&gt; 📆 💻
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/THEMrinaal"&gt;@THEMrinaal&lt;/a&gt; 🔣 💻
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
🤝 Contributing&lt;/h2&gt;
&lt;p&gt;Contributions, issues and feature requests are welcome…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/inderpartap/trendcast"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>githubsdp</category>
      <category>octograd2020</category>
    </item>
  </channel>
</rss>
