I am trying to develop a model using machine learning that reproduces a biological behavior. My goal is to do a regression of timeseries e.g from multiple input each time_step predict multiple output :

use x(t), x(t-1)... to predict y(t), y(t-1)...

and not forecasting :

use x(t), x(t-1) to predict x(t+1)

For this, I have :

  • as input: N [640*30] (time_steps * features) time series (execution cycle)
  • in output: N [640*1000] time series (result of the exceution cycle)

To feed my data to an ML/DL algorithm, I can either:

  • Reshape my data into (3D data)

[nb_instances, time_steps, features]

  • Remove the dimension nb instances and concatenate my data into

[nb_instances * time_steps, features]

With the 3D data, I have a hard time to introduce them in a classical ml algo (for example, sklearn models...). I know that I could use a DL algorithm but I would like to have/test a "low resource" solution first. I am not considering dimensionality reduction for constraint purposes.

Is there a way to feed 3D data to a classic ML algo from sklearn or another python library?

If I choose the second option (removing the nb_instances dimension), I will lose some information (like the execution cycle) but I will be able to use both ML and DL.

Which option is better? Is there another way to look at the problem?

  • $\begingroup$ I am having a hard time following your issue; therefore, I cannot improve/edit it. In essence, note that forecasting is a regression problem. $\endgroup$
    – Eduard
    Feb 7 at 19:16
  • $\begingroup$ In forcasting one want to predict next value of an input timeserie. Here (in regression) I want to predict new features. For example I have data from a supermaket stock : forcasting would be to predict next value for the stock of a product X where regression would be to predict a new feature not present in the input data like price of the product $\endgroup$
    – Ketchup
    Feb 8 at 7:19
  • $\begingroup$ You must understand that regression is for multivariate time series, while forecasting is (still regression) for univariate time series. Perhaps you have never viewed such a setting, as I have pointed out. So please edit your question and try to be as formal as possible, hoping to get an answer. PS: it is forecasting and not forcasting. $\endgroup$
    – Eduard
    Feb 8 at 9:31
  • $\begingroup$ Thanks for the input. In my problem Im not looking to predict future value based on their past (predict x(t+1) using x(t), x(t-1).... I am looking to predict y(t), y(t-1)... using x(t), x(t-1)... $\endgroup$
    – Ketchup
    Feb 8 at 9:45
  • $\begingroup$ To some extent, it is the same. It is simple coding. It depends on how you train the model for your task. For me, it does not make sense to predict $y(t-1)$ since you should only predict $y(t)$ using (the past values) $x(t),x(t-1),\ldots$. If my observation is correct, you can train a model to predict $y(t)$ using $x(t),x(t-1),\ldots$, then you can use that model, say, to predict $y(t+1)$ using $x(t+1),x(t),x(t-1),\ldots$. Moreover, you should pay attention to data leakage when dealing with time series (i.e., avoid poisoning input predictors with target values). $\endgroup$
    – Eduard
    Feb 8 at 9:53


Your Answer

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