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

Regression not working for arrays longer than 405 elements (overflow in matrix) #450

Open
JanNalivaika opened this issue May 3, 2023 · 1 comment
Labels

Comments

@JanNalivaika
Copy link

JanNalivaika commented May 3, 2023

I am trying to do some regression on time series on different length.
But I'm having issues with lengths longer than 406 elements

The error message is:
ValueError: Input X contains NaN.
SVR does not accept missing values encoded as NaN natively.

Function: "njit_gak" has an overflow issue

To Reproduce
####################################################################
import numpy as np
from tslearn.utils import to_time_series_dataset
from tslearn.svm import TimeSeriesSVR
from numpy import random
from tslearn.preprocessing import TimeSeriesScalerMinMax

def fun():
x = np.arange(500) # Length of array here
y = x**2*random.rand()/2000+ np.sin(x) + np.cos(x)

return abs(y)

input = []
output = []
for reps in range(3):

y = fun()
input.append(list(y))
output.append(np.sqrt(np.min(y)))

X = to_time_series_dataset(input)
X1 = TimeSeriesScalerMinMax().fit_transform(X)

clf = TimeSeriesSVR(C=1.0, kernel="gak")

y_reg = output
clf.fit(X1, y_reg)
###################################################################
Does anyone have the same issue?

Thank you very much!

@NimaSarajpoor
Copy link

NimaSarajpoor commented Jul 4, 2023

@JanNalivaika
Two notes:

  • Try to edit your question by ensuring that the code is enclosed by three back-ticks ```. I think it is not in the correct format. For instance def func() and its next couple of lines should have been in the code box. But, they are not.

  • Does abs(y) return what you want to? Or, did you mean np.abs? If it is the former, then try print(y) and see if that is what you want. If it is the latter and you meant np.abs, then try to review your bug report one more time and revise any other parts if necessary.

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

2 participants