# Time-series data with multiple factories

I'm currently tackling a problem of the following type:

Using machine learning to predict the output of factories given ten years of data (once a year every year). I have about 25 features including some qualitative (e.g. country, produce) and around 10,000 rows.

My problem is that I'm not sure how to tackle the time series whilst also including the different companies. If I only had one year, I'd treat the problem as a regression, but I'm not sure what to do with the time series. I was thinking of just adding them as features (e.g. "Employees in 2014", "Employees in 2013" etc.) but that seems like a bad idea as it removes the time element. How do people usually deal with this sort of thing? And what sort of regressor would people recommend I use for this kind of data?

There's also a problem that some factories are newer than others, so I only have a few years of data. Obviously, I could just use the factories that I have 10 years for, but I'd rather not.

As you state that your goal is prediction, a Recurrent Neural Network---or other time series model---would be well suited to this task.

I was thinking of just adding them as features (e.g. "Employees in 2014", "Employees in 2013" etc.) but that seems like a bad idea as it removes the time element.

The RNN explicitly models the time element; at each time step, the prediction is

$$y^{(t)}=Wx^{(t)}+Uh^{(t-1)}$$

Where $x^{(t)}$ are the input features and $h^{(t-1)}$ is the previous hidden state, so the prediction is a function of the current features in addition to the representation of the past.

And what sort of regressor would people recommend I use for this kind of data?

A least squares cost function can be used.

There's also a problem that some factories are newer than others, so I only have a few years of data. Obviously, I could just use the factories that I have 10 years for, but I'd rather not.

RNNs can process variable-lengh sequences. So, it could learn how to predict for a company with 10 observations or 3 or anything else.

I have about 25 features including some qualitative (e.g. country, produce)

RNNs learn a good representation of the data, so they essentially do feature extraction for you. This makes it easier to input combinations of (scaled) categorical and continuous features.