I need to forecast two non-correlated time-series (non-stationary). A sample is presented below:


The above is the input (two attributes) and the output (prediction) is composed of two targets (the same as input) for instance,


However, current regression techniques only consider a single attribute (class) forecasting but two or more. I've checked the following site https://machinelearningmastery.com/multi-output-regression-models-with-python/ for multi-target regression or predictive clustering trees. Unfortunately, I don't know how to adapt my data to those techniques. Ideally, I would like to predict multiple steps.

Any idea?

  • $\begingroup$ if they are independent it is better considered then as two separate time series and forecast accordingly. $\endgroup$
    – raghu
    Mar 17 at 8:30
  • $\begingroup$ well, they are latitude and longitude values, in this case is also recommended to forecast separately or using MTR/PCT? in that last case, how can I adapt my data to those examples? $\endgroup$ Mar 17 at 9:53

In general, multi output models is not that different. I.e.

  1. As Raghu mentioned in commentary, you could train separate model for each output. There is even helper module in sklearn for that (MultiOutputRegressor)
  2. DecisionTreeRegressor from sklearn allows multiple outputs out-of-the box
  3. Any neural network framework allows any number of outputs

In your particular case there are two much bigger factors.

  1. It's timeseries. Timeseries requires whole another set of models then other data, i.e ANOVA, RNN or transformers.
  2. You data is not well scaled. The reason is that the change between points is insignificant in comparison with their absolute values. You need to deal with it -- but exact solution would depend on your particular task. You could try to substract the mean value on train set or predict the difference, not absolute value.

Edit: here is simple example

import numpy as np
raw = np.array([

X = raw[:-1]
y = raw[1:]
from sklearn.linear_model import LinearRegression
model = LinearRegression()
# Train the model
model.fit(X, y)
# Try to predict next step
# The predicted value [414051933,  21776806] and the true value would be [414051935,21776785], not so far

Next you could normalize the values, use few previous steps as a features, use more complex algorithm then linear regression, and make train/eval split for better model evaluation.

  • $\begingroup$ My problem is how to set the algorithms presented in the link above. My data is X however, I don't know what to use as y. $\endgroup$ Mar 17 at 22:35
  • $\begingroup$ You need to deal with time series, it's core challenge here. You could try following: 1. Predict step n+1 from few previous steps. I.e. you have 5 steps, that's mean you have ten features and you could use any basic algorithm to predict values on step 6 (just apply regression/tree from you link). You could move the 'window' to generate to points, i.e. predict step 7 by 2-6, predict step 8 by 3-7 and so on. 2. Use dedicated algorithms for the time series. There is a lot of tutorials, courses and even books in the wild on the topic. $\endgroup$ Mar 18 at 10:27
  • $\begingroup$ Thanks for the advice, I've using ML since 2012, however, this context is new to me. I've done forecasting before. In previous cases, I had a set (y) of classes, here, I don't have classes. I've search and read a lot unsuccesfully. I don't pretend to get the solution here, just how to adapt my problem to current approaches. $\endgroup$ Mar 18 at 12:46
  • $\begingroup$ If you had classes, then you had classification problem (to predict class). In this case you have regression problem (to predict value). Algorithm from the link you provided should be doing fine. Simple baseline would be just to predict the next step from the current - I added example to the answer. $\endgroup$ Mar 19 at 13:47
  • $\begingroup$ Great! I got it know. I was confused on how to treat my data. I guess if I want to predict more than one step ahead, I should use the same "training" but feeding multiple times the prediction $\endgroup$ Mar 19 at 15:31

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.