0
$\begingroup$

I have timeseries data that comes from a few locations. Location is not thought to be major factor, and although it might have some influence, details of locations aren't precise enough to be meaningful.

Thus I have e.g. X_loc1_feat1(t),...,X_loc1_featN(t), X_loc2_feat1(t), ..., X_loc2_featN(t), ... , ... , X_locM_featN(t).

And I have 1 target I want to predict:

y_loc1_target1(t), ..., y_locM_target1(t).

How should one split train/val/test for timeseries over multiple locations in this case?

Assuming my data is 2001-2010 should I e.g. split train 2000-2008, val 2009, test 2010, for each location and X_test = 'np.concat(X_test_2010_loc1, X_test_2010_loc2, ...)' for example?

(With one timeseries we could do something like walk-forward validation, but this seems to not quite as easily conceptually fit over many locations?)

How do we approach multiple 'similar' timeseries in machine learning training?

$\endgroup$

1 Answer 1

1
$\begingroup$

Well, you can add an auxiliary feature for your time series containing the location information.

This is sometimes called an exogenous parameter.

It is quite simple to do that in both sklearn or tensorflow. There are several models of course (even SARIMAX), but this is another story and really depends on your situation constraints.

Have a look here for an example of a library allowing you to do so, https://www.cienciadedatos.net/documentos/py27-time-series-forecasting-python-scikitlearn.html

$\endgroup$
3
  • $\begingroup$ Thanks! So for this I preference one timeseries as the 'true' timeseries, and then "In time series, the exogenous variable is a parallel time series that are not modeled directly but is used as a weighted input to the model. ... the main series to be forecasted is an endogenous variable." I have two issues with this: 1) I want ultimately to have one model that takes data from one location to predict the target at one location (just use all data for training), 2) I am unclear how exog vars could be used for N locations (not 1 endo, 1 exo) in this approach to train using many locations? $\endgroup$
    – Socorro
    Jul 26 at 17:23
  • $\begingroup$ the exogenous variable will be the location (categorical) that takes n possible values. If you have enough data and always to a train series (x[t], locA[t]) you associate the "label" series with the same value of location, the model should be good enough to understand that the predicted location is the same it gets as input. $\endgroup$
    – Oscar
    Jul 27 at 9:39
  • $\begingroup$ Sorry, I don't quite understand. The final model I'd like to predict is just a 'general' location-blind relationship between input/training data, X[t] and target y[t], where for training there are few timeseries over geographic location. Importantly my final prediction won't likely be able to take in/provide future location information or have the same locations as used for training (although location isn't really much of a factor, more a mathematical one in the sense of many parallel training/target timeseries). I'm not sure what you mean by the model would understand the location/input? $\endgroup$
    – Socorro
    Jul 28 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.