zealberth / lssvr

Least Squares Support Vector Regression
MIT License
57 stars 21 forks source link

fit() got an unexpected keyword argument 'kernel' #1

Closed fakhrulfa closed 4 years ago

fakhrulfa commented 5 years ago

Hai!

I get an issue when i trying to use this packages when i run : model = LSSVR() model.fit(X_train, y_train, kernel='linear') y_hat = model.predict(X_test) y_hat = model.predict(X_test) print('LSSVR\nMSE', mean_squared_error(y_test, y_hat)) print('R2 ',model.score(X_test, y_test))

i got an error like this :

TypeError Traceback (most recent call last)

in 1 model = LSSVR() ----> 2 model.fit(X_train, y_train, kernel='linear') 3 y_hat = model.predict(X_test) 4 y_hat = model.predict(X_test) 5 print('LSSVR\nMSE', mean_squared_error(y_test, y_hat)) TypeError: fit() got an unexpected keyword argument 'kernel' how can i solve it? thanks.
ashok-arjun commented 4 years ago

The files are not updated. You should pass the kernel, C and gamma(if it is an RBF kernel) into the LSSVR itself.

model = LSSVR(kernel='linear', C = 1.0) model.fit(X_train, y_train) y_hat = model.predict(X_test)

zealberth commented 4 years ago

I'm sorry, I forgot about this issue. So, @aiarjun is right, I made a mistake in the example file. You must pass the params into the LSSVR(). Also, you can use the GridSearchCV() and pass a dictionary with parameters.