tslearn icon indicating copy to clipboard operation
tslearn copied to clipboard

Is it possible to add categorical data to time-series classification

Open orenpapers opened this issue 4 years ago • 1 comments

I have a dataset, however each time-series has additional category features. Is it possible to take them into account when making classification? For example:

from tslearn.utils import to_time_series_dataset
X = to_time_series_dataset([[1, 2, 3, 4], [1, 2, 3], [2, 5, 6, 7, 8, 9]])
y = [0, 0, 1]
features_vec = ['a','c','q']
X = X.add_features_data(features_vec) #the first time-series has the category 'a', the second 'c' and the third 'q'
from tslearn.neighbors import KNeighborsTimeSeriesClassifier
knn = KNeighborsTimeSeriesClassifier(n_neighbors=2)
knn.fit(X, y)

orenpapers avatar Nov 02 '20 18:11 orenpapers

Hi @orko19

This is a very good question. In fact, this module is dedicated to temporal-only data but sure there are use cases in which part of the features are temporal while other information comes from static features and models that would use both would be helpful. Unfortunately, this is not implemented in tslearn and is not really in our roadmap at the moment.

Best regards, Romain

rtavenar avatar Nov 06 '20 16:11 rtavenar