# Is it possible to train a RNN using multiple time series?

I have multiple time series (about 200) of soil moisture behavior after saturation in different soil types. They are all the same length and nearly the same shape, differing only in their ultimate value and rate of soil moisture decline due to the effects of different soil properties.

What I need is an RNN model that can predict the time series with only one sequence as input. This RNN must be able to detect, at least internally, which of the 200 training sequences the input sequence corresponds to and then predict the next values. Is something like this possible? What I tried was to concatenate all the time series into one and I trained an RNN with 3 layers and different numbers of hidden units, but I didn't get good results. Should I increase the complexity of the model or try a new approach?

Yes, you can use a Multivariate RNN.

### Multivariate RNN

In this architecture multiple sequential features (i.e., a number of sequneces) as an input to your recurrent layers.

Taking pytorch as a reference, you can see that the input of LSTM object is a tensor of shape $$input = (L, H_{in})$$ where $$L$$ is the length of your sequences whereas $$H_{in}$$ is the number of input features* (i.e., a number of sequences). I attach below a couple of resources in case they are helpful:

Hope it helps!

* Input can also have $$(L, N, H_{in})$$ for $$N$$ batches.

• Sorry, I think I was not clear enough. The model must have only one sequence as input, not multiple ones. I have 200 sequences but only for training and each sequence represents the same magnitude but with different soil parameters. Only with the first values of a sequence as input, the model must predict the following values of it. Internally, it must recognize which of the 200 sequences it belongs to in order to predict the correct behavior. Oct 26, 2022 at 13:48
• Hello nw, you would normally train your model using a TRAINSET consisting of multiple datapoints/time-series. For inference, you can use one or multiple datapoints to make a prediction and that would be up to the user. Oct 26, 2022 at 14:46