0
$\begingroup$

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

414049364,21773560
414049656,21773926
414049938,21774287
414050204,21774638
414050453,21774975
414050682,21775296
414050895,21775597
414051093,21775874
414051278,21776125
414051453,21776344
414051620,21776530
414051780,21776678
414051935,21776785
414052089,21776849
414052242,21776865

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

414052252,21776765

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?

$\endgroup$
2
  • $\begingroup$ if they are independent it is better considered then as two separate time series and forecast accordingly. $\endgroup$
    – raghu
    Commented Mar 17, 2021 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$ Commented Mar 17, 2021 at 9:53

1 Answer 1

1
$\begingroup$

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([
[414049364,21773560],
[414049656,21773926],
[414049938,21774287],
[414050204,21774638],
[414050453,21774975],
[414050682,21775296],
[414050895,21775597],
[414051093,21775874],
[414051278,21776125],
[414051453,21776344],
[414051620,21776530],
[414051780,21776678],
[414051935,21776785],
[414052089,21776849],
[414052242,21776865]
])

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
model.predict([[414051780,21776678]])
# 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.

$\endgroup$
5
  • $\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$ Commented Mar 17, 2021 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$ Commented Mar 18, 2021 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$ Commented Mar 18, 2021 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$ Commented Mar 19, 2021 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$ Commented Mar 19, 2021 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .