TimeSeriesKMeans with more dimensions tslearn (more features/series)

51 views Asked by At

I want to use TimeSeriesKMeans with dtw using tslearn to combine series that are similar (longitudinal variables), but I saw only with one series for row. I would like to know how to add another serie not only one (e.g, sleep along time, exercise along time). In this forum, this was asked and the answer was that it is possible but it did not explain how to set up the dataframe to manage that.

So I wonder how I can extend my code to add another serie.

df = pd.read_csv('sleepalongtime.csv') 
df  
  =df.drop('Var1',axis=1)
#Important otherwise fails df = df.dropna()
 
formatted_dataset = to_time_series_dataset(df.values)
print(formatted_dataset)
 
results:
 
[[4.]   [1.]   [0.]   [0.]   [0.]]
 
[[6.]   [3.]   [4.]   [4.]   [5.]]]

Any help is aprreciated. Thanks

0

There are 0 answers