I have independent multiple time series datasets with same features. They are drilling proccesses in bone. Each dataset is a measurement. Is there a way to store all the datasets into a Matrix or tensor and train the model with all the datasets at once ?

I looked at the internet and did not find anything that is describing my problem.

I found this solution ? is this correct ?

import numpy as np 
stacked_data = np.stack((dataset1, dataset2, ..., datasetn), axis=1)
stacked_labels = np.concatenate((labels1, labels2, ..., labelsn), axis=0)

Here, np.stack stacks the datasets along a new axis (i.e., axis 1), resulting in a tensor with shape (total_number_of_time_steps, n, number_of_features). The first axis corresponds to the time dimension across all datasets, the second axis corresponds to the dataset dimension, and the third axis corresponds to the feature dimension.

At the end i would call

model.fit(stacked_data, stacked_labels, epochs=10, batch_size=32)

is this method a legit way ?

  • $\begingroup$ If your method works for the data, then yes, it can be a good way to do it. $\endgroup$ Commented Apr 7, 2023 at 13:51
  • $\begingroup$ so this would mean that the first input for the model would be the first time stamp of all datasets right ? $\endgroup$
    – heyoka955
    Commented Apr 7, 2023 at 15:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.