Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior in 3D matrices #448

Open
delacylab opened this issue Apr 25, 2023 · 0 comments
Open

Unexpected behavior in 3D matrices #448

delacylab opened this issue Apr 25, 2023 · 0 comments
Labels

Comments

@delacylab
Copy link

Describe the bug
Tslearn supports unequal time series by filling nans at the end. But this does not seem to work with 3D matrices where the dimension is greater than 1 as shown below.

To Reproduce
X, y = random_walk_blobs(n_ts_per_blob=10, sz=3, d=2, n_blobs=2) #(20, 3, 2) shape
X[19,2,1] = np.nan #Change last row, last timestep, last dimension to nan for row 19
clf = tslearn.svm.TimeSeriesSVC(C=1.0, gamma="auto", kernel="gak")
clf.fit(X,y)

ValueError: Input contains NaN, infinity or a value too large for dtype('float64')

Expected behavior
Nans are allowed at the end of matrices throughout tslearn examples and are used to fill unequal timeseries, so I am puzzled why this does not work.

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • tslearn version 0.5.3.2

Additional context
Experimenting has shown that I can only avoid the nan error if the row's entire timestep for all dimensions is nan like with:
X[19,2,:] = np.nan
That works. So it appears that for each row, a timestep's features have to all be nan or all be a real number where it seems like that shouldn't be the case.

@delacylab delacylab added the bug label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant