Skip to content

Instantly share code, notes, and snippets.

@ledmaster
Last active September 24, 2024 15:14
Show Gist options
  • Save ledmaster/031e531ea35494d2357926405532e254 to your computer and use it in GitHub Desktop.
Save ledmaster/031e531ea35494d2357926405532e254 to your computer and use it in GitHub Desktop.
How To Predict Multiple Time Series With Scikit-Learn (With a Sales Forecasting Example)
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You got a lot of time series and want to predict the next step (or steps). What should you do now? Train a model for each series? Is there a way to fit a model for all the series together? Which is better?\n",
"\n",
"I have seen many data scientists think about approaching this problem by creating a single model for each product. Although this is one of the possible solutions, it's not likely to be the best. \n",
"\n",
"Here I will demonstrate how to train a single model to predict multiple time series at the same time. This technique usually creates powerful models that help teams win machine learning competitions and can be used in your project.\n",
"\n",
"<h1>Individual Models vs Big Model for Everything</h1>\n",
"\n",
"In machine learning, more data usually means better predictions. If you try to create one model for each series, you will have some trouble with series that have little to no data. When you concatenate all your series into a single dataset, to train a single model, you are using a lot more data. This may help the model perform better!\n",
"\n",
"Considering more than one series at a time, the model will be able to learn more subtle patterns that repeat across series. The product becomes a variable in our model.\n",
"\n",
"First, let's import our basic tools:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"%matplotlib inline\n",
"\n",
"from sklearn.metrics import mean_squared_log_error\n",
"from sklearn.ensemble import RandomForestRegressor\n",
"from lightgbm import LGBMRegressor"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h1>Preparing the Data</h1>\n",
"\n",
"The data was obtained from the [UCI Repository](https://archive.ics.uci.edu/ml/datasets/Sales_Transactions_Dataset_Weekly). \n",
"\n",
"Here we will try to forecast sales for 811 products. Our dataset has records of sales for 52 weeks for each of the products.\n",
"\n",
"This means we have, originally, 811 time series with 52 data points each. Here I take only the Product Code and non-normalized weekly sales for each product.\n",
"\n",
"This is what the data looks like:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Product_Code</th>\n",
" <th>W0</th>\n",
" <th>W1</th>\n",
" <th>W2</th>\n",
" <th>W3</th>\n",
" <th>W4</th>\n",
" <th>W5</th>\n",
" <th>W6</th>\n",
" <th>W7</th>\n",
" <th>W8</th>\n",
" <th>...</th>\n",
" <th>W42</th>\n",
" <th>W43</th>\n",
" <th>W44</th>\n",
" <th>W45</th>\n",
" <th>W46</th>\n",
" <th>W47</th>\n",
" <th>W48</th>\n",
" <th>W49</th>\n",
" <th>W50</th>\n",
" <th>W51</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>P1</td>\n",
" <td>11</td>\n",
" <td>12</td>\n",
" <td>10</td>\n",
" <td>8</td>\n",
" <td>13</td>\n",
" <td>12</td>\n",
" <td>14</td>\n",
" <td>21</td>\n",
" <td>6</td>\n",
" <td>...</td>\n",
" <td>4</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>10</td>\n",
" <td>12</td>\n",
" <td>3</td>\n",
" <td>7</td>\n",
" <td>6</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>P2</td>\n",
" <td>7</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>7</td>\n",
" <td>1</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>...</td>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>P3</td>\n",
" <td>7</td>\n",
" <td>11</td>\n",
" <td>8</td>\n",
" <td>9</td>\n",
" <td>10</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" <td>13</td>\n",
" <td>12</td>\n",
" <td>...</td>\n",
" <td>6</td>\n",
" <td>14</td>\n",
" <td>5</td>\n",
" <td>5</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>14</td>\n",
" <td>8</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>P4</td>\n",
" <td>12</td>\n",
" <td>8</td>\n",
" <td>13</td>\n",
" <td>5</td>\n",
" <td>9</td>\n",
" <td>6</td>\n",
" <td>9</td>\n",
" <td>13</td>\n",
" <td>13</td>\n",
" <td>...</td>\n",
" <td>9</td>\n",
" <td>10</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>6</td>\n",
" <td>8</td>\n",
" <td>14</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>P5</td>\n",
" <td>8</td>\n",
" <td>5</td>\n",
" <td>13</td>\n",
" <td>11</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>9</td>\n",
" <td>14</td>\n",
" <td>9</td>\n",
" <td>...</td>\n",
" <td>7</td>\n",
" <td>11</td>\n",
" <td>7</td>\n",
" <td>12</td>\n",
" <td>6</td>\n",
" <td>6</td>\n",
" <td>5</td>\n",
" <td>11</td>\n",
" <td>8</td>\n",
" <td>9</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 53 columns</p>\n",
"</div>"
],
"text/plain": [
" Product_Code W0 W1 W2 W3 W4 W5 W6 W7 W8 ... W42 W43 W44 W45 \\\n",
"0 P1 11 12 10 8 13 12 14 21 6 ... 4 7 8 10 \n",
"1 P2 7 6 3 2 7 1 6 3 3 ... 2 4 5 1 \n",
"2 P3 7 11 8 9 10 8 7 13 12 ... 6 14 5 5 \n",
"3 P4 12 8 13 5 9 6 9 13 13 ... 9 10 3 4 \n",
"4 P5 8 5 13 11 6 7 9 14 9 ... 7 11 7 12 \n",
"\n",
" W46 W47 W48 W49 W50 W51 \n",
"0 12 3 7 6 5 10 \n",
"1 1 4 5 1 6 0 \n",
"2 7 8 14 8 8 7 \n",
"3 6 8 14 8 7 8 \n",
"4 6 6 5 11 8 9 \n",
"\n",
"[5 rows x 53 columns]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = pd.read_csv('Sales_Transactions_Dataset_Weekly.csv')\n",
"data = data.filter(regex=r'Product|W')\n",
"data.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"At this point, many data scientists would try to fit a model for each product. And while this can work well, we may have problems due to having only 52 data points for each model, which is really low!\n",
"\n",
"As machine learning models tend to improve with more data, why not try to concatenate all the series and train a single model with much more data?\n",
"\n",
"To do this we have to \"melt\" the data. This simply means transforming the data in a way that each line becomes: **Product Code, Week, Sales**\n",
"\n",
"To make our lives easier, I decided to remove the letters from the product and week code."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Product_Code</th>\n",
" <th>Week</th>\n",
" <th>Sales</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>8</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Product_Code Week Sales\n",
"0 1 0 11\n",
"1 2 0 7\n",
"2 3 0 7\n",
"3 4 0 12\n",
"4 5 0 8"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"melt = data.melt(id_vars='Product_Code', var_name='Week', value_name='Sales')\n",
"\n",
"melt['Product_Code'] = melt['Product_Code'].str.extract('(\\d+)', expand=False).astype(int)\n",
"melt['Week'] = melt['Week'].str.extract('(\\d+)', expand=False).astype(int)\n",
"\n",
"melt = melt.sort_values(['Week', 'Product_Code'])\n",
"melt.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we have **42172 rows** to train our model."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic Feature Engineering\n",
"\n",
"We need to have variables to send to our model and get the predictions. For now, besides the product code and the week, I will create two features that usually help a lot with time series: lags and differences.\n",
"\n",
"**Last Week Sales**: this is simply the amount of sales that a product had in the previous week \n",
"**Last Week Diff**: the difference between the amount of sales in the previous week and the week before it (t-1 - t-2)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Product_Code</th>\n",
" <th>Week</th>\n",
" <th>Sales</th>\n",
" <th>Last_Week_Sales</th>\n",
" <th>Last_Week_Diff</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1622</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>10</td>\n",
" <td>12.0</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1623</th>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>6.0</td>\n",
" <td>-1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1624</th>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>8</td>\n",
" <td>11.0</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1625</th>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>13</td>\n",
" <td>8.0</td>\n",
" <td>-4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1626</th>\n",
" <td>5</td>\n",
" <td>2</td>\n",
" <td>13</td>\n",
" <td>5.0</td>\n",
" <td>-3.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Product_Code Week Sales Last_Week_Sales Last_Week_Diff\n",
"1622 1 2 10 12.0 1.0\n",
"1623 2 2 3 6.0 -1.0\n",
"1624 3 2 8 11.0 4.0\n",
"1625 4 2 13 8.0 -4.0\n",
"1626 5 2 13 5.0 -3.0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"melt2 = melt.copy()\n",
"melt2['Last_Week_Sales'] = melt2.groupby(['Product_Code'])['Sales'].shift()\n",
"melt2['Last_Week_Diff'] = melt2.groupby(['Product_Code'])['Last_Week_Sales'].diff()\n",
"melt2 = melt2.dropna()\n",
"melt2.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evaluating the Result\n",
"\n",
"To know if our model is good we need to have an evaluation metric. A metric I really like for sales forecasting is the Root Mean Squared Log Error.\n",
"\n",
"This is our well-known RMSE applied to the log of the target and the prediction output.\n",
"\n",
"It works as an approximation to the percentage error between our predictions and the target, which is a nice way to understand the errors our model is making."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def rmsle(ytrue, ypred):\n",
" return np.sqrt(mean_squared_log_error(ytrue, ypred))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Setting a Baseline and a Validation Split\n",
"\n",
"Let's say that in real life your model will run every Sunday night, so that early on Monday the managers can make decisions based on the predictions for the next week.\n",
"\n",
"To see if our model will work in this scenario, weeks it has not seen before, I will use a sliding window validation. This means that we are going to simulate training the model in all the weeks up to the one we want to predict, and evaluate our score in the new week.\n",
"\n",
"And, to avoid having a very good model in a small amount of weeks simply due to luck, I will use every week from 40 to 52, repeating the process for one at a time, and compute the score.\n",
"\n",
"As this is only a demonstration of the method, to keep it simple I am not separating a test set. In your projects, always keep some periods out of your validation to evaluate your model when you finish developing it. **This is very important**, and helps you be more secure about your model performing well when deployed.\n",
"\n",
"To make sure the model is worth using I like to set a baseline score that it has to beat. In this case, a reasonably strong baseline is using the last week amount of sales as a prediction for the sales this week."
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.51952\n",
"Week 41 - Error 0.51691\n",
"Week 42 - Error 0.51026\n",
"Week 43 - Error 0.50792\n",
"Week 44 - Error 0.53409\n",
"Week 45 - Error 0.52347\n",
"Week 46 - Error 0.50018\n",
"Week 47 - Error 0.49138\n",
"Week 48 - Error 0.50585\n",
"Week 49 - Error 0.50547\n",
"Week 50 - Error 0.52220\n",
"Week 51 - Error 0.55242\n",
"Mean Error = 0.51581\n"
]
}
],
"source": [
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt2[melt2['Week'] < week]\n",
" val = melt2[melt2['Week'] == week]\n",
" \n",
" p = val['Last_Week_Sales'].values\n",
" \n",
" error = rmsle(val['Sales'].values, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we know that our model has to have a better error than about 0.51. This would be approximately 50% error in each prediction, which seems huge! But is it really?\n",
"\n",
"If we look at the distribution of sales in the dataset, we see that a lot of items sell very little amounts. So we should expect the error to look \"high\"."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x11ac50160>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAEyCAYAAABQ2xz2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHV9JREFUeJzt3X+w3XV95/Hna0EtNVVA9E6a0A3ORLcoLcodZMetcyMK\nER2hO3UXhpVo6aQ60NEZdlbsdgdXywzdLbqFunTTkhWmlMiKNlnE0pT1ru2MKGCpAZESMNVINlkN\nAlGGTtz3/nG+tz3mfpMbcu/N/dx7no+ZM+d73ufz/X4/5z25zIvvj3NSVUiSJGnh/ZOFnoAkSZIG\nDGaSJEmNMJhJkiQ1wmAmSZLUCIOZJElSIwxmkiRJjTCYSZIkNcJgJkmS1AiDmSRJUiOOXegJHKmT\nTjqpVq1aNa/7+OEPf8iLX/zied3HYmRfprMn/ezLdPakn32Zzp70W6x9uf/++79XVS+fadyiDWar\nVq3ivvvum9d9TE5OMjExMa/7WIzsy3T2pJ99mc6e9LMv09mTfou1L0n+7nDGeSpTkiSpE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QbXmY1kb5L8AoOLcI9h8D98t1XVR5O8ksHRohOB\nvwb+TVU9t3AzXRhJJoB/W1XvGPWedJ//c93LY4E/qaqrk7yMEf37mZLkdAY3irwQeBx4L93fEyPa\nlyQ/zeCa71dW1VNdbUn/WzGYSZIkNcJTmZIkSY0wmEmSJDXCYCZJktQIg5kkSVIjDGaSJEmNMJhJ\nkiQ1wmAmSZLUiP8PDSGyopdbkPgAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x11ac6a470>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"melt2['Sales'].hist(bins=20, figsize=(10,5))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Creating the Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we have a baseline, let's try to beat it!\n",
"\n",
"As a first model, let's train a Random Forest. Besides being a strong model with structured data (like the one we have), we usually can already get a very good result by just setting a high number of trees.\n",
"\n",
"I usually tell data scientists that a Random Forest is a very good model to use in a lazy day. You only set the number of trees to the maximum your computer can run and get a good model (hopefully).\n",
"\n",
"I will keep the Week as a feature although our model will have never seen the new week value. It may be that after week 35, for example, we have more sales for a product. This type of effect can be captured by the model.\n",
"\n",
"As decision trees can handle categorical features well even in ordinal encoding, I left them in this format.\n",
"\n",
"Anyway, be careful with these types of features."
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.46242\n",
"Week 41 - Error 0.45964\n",
"Week 42 - Error 0.46166\n",
"Week 43 - Error 0.46655\n",
"Week 44 - Error 0.47122\n",
"Week 45 - Error 0.43100\n",
"Week 46 - Error 0.47183\n",
"Week 47 - Error 0.44945\n",
"Week 48 - Error 0.46080\n",
"Week 49 - Error 0.44696\n",
"Week 50 - Error 0.47465\n",
"Week 51 - Error 0.48651\n",
"Mean Error = 0.46189\n"
]
}
],
"source": [
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt2[melt2['Week'] < week]\n",
" val = melt2[melt2['Week'] == week]\n",
" \n",
" xtr, xts = train.drop(['Sales'], axis=1), val.drop(['Sales'], axis=1)\n",
" ytr, yts = train['Sales'].values, val['Sales'].values\n",
" \n",
" mdl = RandomForestRegressor(n_estimators=1000, n_jobs=-1, random_state=0)\n",
" mdl.fit(xtr, ytr)\n",
" \n",
" p = mdl.predict(xts)\n",
" \n",
" error = rmsle(yts, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Nice!\n",
"\n",
"Applying the Random Forest to our initial variables we got a good reduction of the error (about 10%). This is a very good way to start.\n",
"\n",
"Now, let's try to add some features from more weeks in the past. First, let's add the lag and the difference of sales for the week before the previous."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Product_Code</th>\n",
" <th>Week</th>\n",
" <th>Sales</th>\n",
" <th>Last_Week_Sales</th>\n",
" <th>Last_Week_Diff</th>\n",
" <th>Last-1_Week_Sales</th>\n",
" <th>Last-1_Week_Diff</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2433</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>8</td>\n",
" <td>10.0</td>\n",
" <td>-2.0</td>\n",
" <td>12.0</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2434</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>3.0</td>\n",
" <td>-3.0</td>\n",
" <td>6.0</td>\n",
" <td>-1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2435</th>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>9</td>\n",
" <td>8.0</td>\n",
" <td>-3.0</td>\n",
" <td>11.0</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2436</th>\n",
" <td>4</td>\n",
" <td>3</td>\n",
" <td>5</td>\n",
" <td>13.0</td>\n",
" <td>5.0</td>\n",
" <td>8.0</td>\n",
" <td>-4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2437</th>\n",
" <td>5</td>\n",
" <td>3</td>\n",
" <td>11</td>\n",
" <td>13.0</td>\n",
" <td>8.0</td>\n",
" <td>5.0</td>\n",
" <td>-3.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Product_Code Week Sales Last_Week_Sales Last_Week_Diff \\\n",
"2433 1 3 8 10.0 -2.0 \n",
"2434 2 3 2 3.0 -3.0 \n",
"2435 3 3 9 8.0 -3.0 \n",
"2436 4 3 5 13.0 5.0 \n",
"2437 5 3 11 13.0 8.0 \n",
"\n",
" Last-1_Week_Sales Last-1_Week_Diff \n",
"2433 12.0 1.0 \n",
"2434 6.0 -1.0 \n",
"2435 11.0 4.0 \n",
"2436 8.0 -4.0 \n",
"2437 5.0 -3.0 "
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"melt3 = melt.copy()\n",
"melt3['Last_Week_Sales'] = melt3.groupby(['Product_Code'])['Sales'].shift()\n",
"melt3['Last_Week_Diff'] = melt3.groupby(['Product_Code'])['Last_Week_Sales'].diff()\n",
"melt3['Last-1_Week_Sales'] = melt3.groupby(['Product_Code'])['Sales'].shift(2)\n",
"melt3['Last-1_Week_Diff'] = melt3.groupby(['Product_Code'])['Last-1_Week_Sales'].diff()\n",
"melt3 = melt3.dropna()\n",
"melt3.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Again, we train a model, now using the old variables plus the two new."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.44389\n",
"Week 41 - Error 0.45812\n",
"Week 42 - Error 0.43652\n",
"Week 43 - Error 0.44033\n",
"Week 44 - Error 0.46318\n",
"Week 45 - Error 0.42361\n",
"Week 46 - Error 0.45752\n",
"Week 47 - Error 0.44533\n",
"Week 48 - Error 0.44598\n",
"Week 49 - Error 0.43538\n",
"Week 50 - Error 0.47349\n",
"Week 51 - Error 0.46487\n",
"Mean Error = 0.44902\n"
]
}
],
"source": [
"\n",
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt3[melt3['Week'] < week]\n",
" val = melt3[melt3['Week'] == week]\n",
" \n",
" xtr, xts = train.drop(['Sales'], axis=1), val.drop(['Sales'], axis=1)\n",
" ytr, yts = train['Sales'].values, val['Sales'].values\n",
" \n",
" mdl = RandomForestRegressor(n_estimators=1000, n_jobs=-1, random_state=0)\n",
" mdl.fit(xtr, ytr)\n",
" \n",
" p = mdl.predict(xts)\n",
" \n",
" error = rmsle(yts, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Great! Another reduction!\n",
"\n",
"Can you guess my next idea?\n",
"\n",
"Let's try a model with one more lag and difference, of course!"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Product_Code</th>\n",
" <th>Week</th>\n",
" <th>Sales</th>\n",
" <th>Last_Week_Sales</th>\n",
" <th>Last_Week_Diff</th>\n",
" <th>Last-1_Week_Sales</th>\n",
" <th>Last-1_Week_Diff</th>\n",
" <th>Last-2_Week_Sales</th>\n",
" <th>Last-2_Week_Diff</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>3244</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>13</td>\n",
" <td>8.0</td>\n",
" <td>-2.0</td>\n",
" <td>10.0</td>\n",
" <td>-2.0</td>\n",
" <td>12.0</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3245</th>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>7</td>\n",
" <td>2.0</td>\n",
" <td>-1.0</td>\n",
" <td>3.0</td>\n",
" <td>-3.0</td>\n",
" <td>6.0</td>\n",
" <td>-1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3246</th>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>10</td>\n",
" <td>9.0</td>\n",
" <td>1.0</td>\n",
" <td>8.0</td>\n",
" <td>-3.0</td>\n",
" <td>11.0</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3247</th>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" <td>9</td>\n",
" <td>5.0</td>\n",
" <td>-8.0</td>\n",
" <td>13.0</td>\n",
" <td>5.0</td>\n",
" <td>8.0</td>\n",
" <td>-4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3248</th>\n",
" <td>5</td>\n",
" <td>4</td>\n",
" <td>6</td>\n",
" <td>11.0</td>\n",
" <td>-2.0</td>\n",
" <td>13.0</td>\n",
" <td>8.0</td>\n",
" <td>5.0</td>\n",
" <td>-3.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Product_Code Week Sales Last_Week_Sales Last_Week_Diff \\\n",
"3244 1 4 13 8.0 -2.0 \n",
"3245 2 4 7 2.0 -1.0 \n",
"3246 3 4 10 9.0 1.0 \n",
"3247 4 4 9 5.0 -8.0 \n",
"3248 5 4 6 11.0 -2.0 \n",
"\n",
" Last-1_Week_Sales Last-1_Week_Diff Last-2_Week_Sales Last-2_Week_Diff \n",
"3244 10.0 -2.0 12.0 1.0 \n",
"3245 3.0 -3.0 6.0 -1.0 \n",
"3246 8.0 -3.0 11.0 4.0 \n",
"3247 13.0 5.0 8.0 -4.0 \n",
"3248 13.0 8.0 5.0 -3.0 "
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"melt4 = melt.copy()\n",
"melt4['Last_Week_Sales'] = melt4.groupby(['Product_Code'])['Sales'].shift()\n",
"melt4['Last_Week_Diff'] = melt4.groupby(['Product_Code'])['Last_Week_Sales'].diff()\n",
"melt4['Last-1_Week_Sales'] = melt4.groupby(['Product_Code'])['Sales'].shift(2)\n",
"melt4['Last-1_Week_Diff'] = melt4.groupby(['Product_Code'])['Last-1_Week_Sales'].diff()\n",
"melt4['Last-2_Week_Sales'] = melt4.groupby(['Product_Code'])['Sales'].shift(3)\n",
"melt4['Last-2_Week_Diff'] = melt4.groupby(['Product_Code'])['Last-2_Week_Sales'].diff()\n",
"melt4 = melt4.dropna()\n",
"melt4.head()"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.43096\n",
"Week 41 - Error 0.43894\n",
"Week 42 - Error 0.42754\n",
"Week 43 - Error 0.41965\n",
"Week 44 - Error 0.44807\n",
"Week 45 - Error 0.40729\n",
"Week 46 - Error 0.43950\n",
"Week 47 - Error 0.43334\n",
"Week 48 - Error 0.43856\n",
"Week 49 - Error 0.43049\n",
"Week 50 - Error 0.45920\n",
"Week 51 - Error 0.45356\n",
"Mean Error = 0.43559\n"
]
}
],
"source": [
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt4[melt4['Week'] < week]\n",
" val = melt4[melt4['Week'] == week]\n",
" \n",
" xtr, xts = train.drop(['Sales'], axis=1), val.drop(['Sales'], axis=1)\n",
" ytr, yts = train['Sales'].values, val['Sales'].values\n",
" \n",
" mdl = RandomForestRegressor(n_estimators=1000, n_jobs=-1, random_state=0)\n",
" mdl.fit(xtr, ytr)\n",
" \n",
" p = mdl.predict(xts)\n",
" \n",
" error = rmsle(yts, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As expected, the error is reduced.\n",
"\n",
"I will stop the lag and difference creation here, as I am getting repetitive with this, but feel free to try more lags, differences, and even other features to see when they stop improving."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Changing the Loss Function (and Target Distribution)\n",
"\n",
"We are evaluating our results using the log of our predictions and target, but we are training using them in their original form, so we are optimizing the model using the MSE instead of the MSLE. \n",
"\n",
"Usually you get an improvement by using the same function to evaluate and optimize your model. In this case we can do this by simply taking the log of our target variable before passing it to the fit model. \n",
"\n",
"Sometimes it's not possible to optimize the evaluation function directly. In this case, look for an approximation. We can say we are already using an approximation here (of the percentage error).\n",
"\n",
"By taking the log of the target we get the added bonus that its distribution will look closer to a normal distribution. This usually helps the model learn better."
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.41679\n",
"Week 41 - Error 0.42251\n",
"Week 42 - Error 0.41238\n",
"Week 43 - Error 0.40354\n",
"Week 44 - Error 0.43317\n",
"Week 45 - Error 0.39745\n",
"Week 46 - Error 0.42623\n",
"Week 47 - Error 0.41229\n",
"Week 48 - Error 0.43018\n",
"Week 49 - Error 0.43758\n",
"Week 50 - Error 0.44610\n",
"Week 51 - Error 0.47289\n",
"Mean Error = 0.42593\n"
]
}
],
"source": [
"\n",
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt4[melt4['Week'] < week]\n",
" val = melt4[melt4['Week'] == week]\n",
" \n",
" xtr, xts = train.drop(['Sales'], axis=1), val.drop(['Sales'], axis=1)\n",
" ytr, yts = train['Sales'].values, val['Sales'].values\n",
" \n",
" mdl = RandomForestRegressor(n_estimators=1000, n_jobs=-1, random_state=0)\n",
" mdl.fit(xtr, np.log1p(ytr))\n",
" \n",
" p = np.expm1(mdl.predict(xts))\n",
" \n",
" error = rmsle(yts, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Yes! Lower error!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A Better Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Anyone that ever stumbled over a machine learning competition solution may know about the love of competitors for Gradient Boosted Trees. I am guilty of this too!\n",
"\n",
"It's very common to have the best results with this type of model, which is an ensemble of trees like a Random Forest, but the method that it uses to create and combine the trees is different. Worth understanding.\n",
"\n",
"This is a very good scenario for us to try this model and see if we can reduce the error even more!\n",
"\n",
"There are many parameters we can tune for this model, but I will simply put 1000 trees with a small learning rate. If you want to improve the prediction, you can try tuning it and leave a comment about the improvement you got."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Week 40 - Error 0.40960\n",
"Week 41 - Error 0.39913\n",
"Week 42 - Error 0.39525\n",
"Week 43 - Error 0.39711\n",
"Week 44 - Error 0.42211\n",
"Week 45 - Error 0.37741\n",
"Week 46 - Error 0.40374\n",
"Week 47 - Error 0.39017\n",
"Week 48 - Error 0.39724\n",
"Week 49 - Error 0.40813\n",
"Week 50 - Error 0.42336\n",
"Week 51 - Error 0.45235\n",
"Mean Error = 0.40630\n"
]
}
],
"source": [
"mean_error = []\n",
"for week in range(40,52):\n",
" train = melt4[melt4['Week'] < week]\n",
" val = melt4[melt4['Week'] == week]\n",
" \n",
" xtr, xts = train.drop(['Sales'], axis=1), val.drop(['Sales'], axis=1)\n",
" ytr, yts = train['Sales'].values, val['Sales'].values\n",
" \n",
" mdl = LGBMRegressor(n_estimators=1000, learning_rate=0.01)\n",
" mdl.fit(xtr, np.log1p(ytr))\n",
" \n",
" p = np.expm1(mdl.predict(xts))\n",
" \n",
" error = rmsle(yts, p)\n",
" print('Week %d - Error %.5f' % (week, error))\n",
" mean_error.append(error)\n",
"print('Mean Error = %.5f' % np.mean(mean_error))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Very good! \n",
"\n",
"This model gave us a sizeable improvement, we are almost below the 0.40 barrier. Let's take a look at our predictions for Week 52."
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/mnestevao/anaconda3/lib/python3.5/site-packages/pandas/core/indexing.py:517: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
" self.obj[item] = s\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x11c796f60>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA3sAAAJcCAYAAABAE73ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3X903Pdd5/vX+1tPRyJSa3UclNSyWoO84QYsRHdaIoq9\n3Rayu1Dsniu4C/cGwTmEwr2HvbSw12J7drMld2GpgHRPzt4LlMC2DlDoWqzN7aE03ZSuk21cGAdZ\n3qakHlDxyMRqPJXoTJGm434/9w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"output_type": "display_data"
}
],
"source": [
"val.loc[:, 'Prediction'] = np.round(p)\n",
"val.plot.scatter(x='Prediction', y='Sales', figsize=(15,10), title='Prediction vs Sales', \n",
" ylim=(0,40), xlim=(0,40))"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"Our model is doing reasonably well for items that have sales under about 25 units. \n",
"\n",
"But we can see a \"cluster\" of products that have about 30 sales a day where our model underpredicts. We should definitely investigate this group, understand why this is happening, and see if we can fix it.\n",
"\n",
"Are we missing information? Maybe these are products bought in bulk? Or the units are different (pounds vs ounces)?\n",
"\n",
"Now, to get predictions for each time serie, your just need put the product code, week and compute the new features.\n",
"\n",
"Remember our baseline at RMSLE 0.51581? We improved it to 0.4063, which means a **21% error reduction!**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Improving the Solution\n",
"\n",
"Some ideas you can try to improve this solution:\n",
"\n",
"- Investigate products with sales over 25 units.\n",
"- Try more features (lags, differences) not only at the product level, but at the global.\n",
"- Try using LightGBM native support for categorical features with Product Code.\n",
"- Try tuning the model hyperparameters.\n",
"- Try a neural network and ensemble with GBM.\n",
"\n",
"Remember to let us know how your experiments went by leaving a comment!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [Root]",
"language": "python",
"name": "Python [Root]"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@sahikatia
Copy link

thank you very much for your clear explanation on this subject. I will test it and see if I can add a more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment