0

I am trying to implement svc for predicting a continuous variable:

print("X_train_dtm type ", type(X_train_dtm))
print("y_train type ", type(y_train))
svc = svm.SVC(kernel='linear', C=C).fit(X_train_dtm, y_train)

However I am getting the following output and error:

X_train_dtm type  <class 'scipy.sparse.csr.csr_matrix'>
y_train type  <class 'pandas.core.series.Series'>

raise ValueError("Unknown label type: %r" % y)

ValueError: Unknown label type: 72      0.526
350     0.253
457     0.763
2       0.340
1044   -0.223
241    -0.364
979     0.357
892    -0.384
969    -0.114
761    -0.285
866     0.516
559     0.295
73      0.328
117    -0.130

I tried quite a few things but not able to fix it.

Bellerofont
  • 1,081
  • 18
  • 17
  • 16
Bonson
  • 1,418
  • 4
  • 18
  • 38

1 Answers1

0

SVC stands for C-Support Vector Classification. The algorithm is a classification algorithm and cannot predict continues data. Instead you should use regression algorithms. You can check SVR algorithm which also uses support vector machines or other regression algorithms (Linear Regression, Lasso, Random Forest Regression and many others).

Good luck!

AndreyF
  • 1,798
  • 1
  • 14
  • 25