# Predicting future order dates and order amounts for customers with online retail data

Using the online retail II dataset (https://archive.ics.uci.edu/ml/datasets/Online+Retail+II), I'm trying to predict when each customer will place subsequent orders, and if possible, the monetary value of those orders. This will be a proof of concept for a real online retail store, in which I'll have access to even more data/features.

This current dataset contains the following attributes:

• InvoiceNo: Invoice number. Nominal. A 6-digit integral number uniquely assigned to each transaction. If this code starts with the letter 'c', it indicates a cancellation.
• StockCode: Product (item) code. Nominal. A 5-digit integral number uniquely assigned to each distinct product.
• Description: Product (item) name. Nominal.
• Quantity: The quantities of each product (item) per transaction. Numeric.
• InvoiceDate: Invoice date and time. Numeric. The day and time when a transaction was generated.
• UnitPrice: Unit price. Numeric. Product price per unit in sterling.
• CustomerID: Customer number. Nominal. A 5-digit integral number uniquely assigned to each customer.
• Country: Country name. Nominal. The name of the country where a customer resides.

My current intuition is to model the data as a daily time series that would output which customers are likely to order for the day and the value of those orders (if possible?). The output would either be a sparse, one-hot encoded matrix of shape num_customers X num_customers, or a more dense vector of size num_customers (which could have thousands of customers). I'm not quite sure how, or even if the model would be able to also output the amount of the order. This model will likely be fed into an LSTM network or similar. I suppose this would be considered a multivariate time series forecast (still learning here)?

From this, I'm hoping to be able to run the prediction for each day in the following year to forecast the next order date, customer value and churn risk

Since this would be an attempt to model human behavior as a time series, without a direct correlation from one day to the next (in contrast to predicting daily temperature or a stock price), and with so many variables, I'm also worried it would just come off as unpredictable noise.

1. Anyway, am I on the right track? (any insights would be greatly appreciated)
2. Should this be broken into multiple models, and if so, how many?
3. Does anyone have any tips, or know good articles or tutorials that could point me in the right direction?
4. What are the merits of the one-hot encoded matrix, vs the multi-hot encoded vector (not sure if that's the proper name)?

Thanks!

1. I can generally understand what you are trying to do. However, a few considerations you should bear in mind:

1.1. Given that you are trying to make time series predictions for all customers, then you are most likely interested in a panel data modelling solution - i.e. one that takes into account the fact that the data is both cross-sectional (at one point in time) and time series (across several time periods). The alternative is simply running a separate time series for each customer, which could prove to be highly inefficient.

1.2. This would be considered a multivariate time series forecast - provided that price is in fact dependent on variables other than itself, i.e. quantity, country, etc. Are you planning on incorporating these as explanatory variables into a time series model?

2. Hard to say how many models should be used off the bat, but I might be inclined to construct a single panel data model for this case - you could always construct it on a subset of the data as a proof of concept and then work from there. Construction of multiple LSTM models would appear too much effort for too little reward (in terms of forecast accuracy).

3. I would be inclined to take a look at linearmodels - it is a Python library designed for working with panel data.

4. These techniques are used for representing categorical data - you might find the following answer useful.

Hope this helps, and please let me know if I can offer any further clarity on the above.