Python Forum
Bad input shape for SVC
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bad input shape for SVC
#1
Hi everyone,

I am trying to test a support vector machine classifier on text data for a kernel I found. I found a kernel that uses a neural network on the data just fine but I cannot use a SVC. The link to the kernel is below:

https://www.kaggle.com/yufengdev/bbc-tex...gorization

The code for my SVC is

from sklearn.svm import SVC
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
k_fold = KFold(n_splits=5, shuffle=True, random_state=0)

clf = SVC()
scoring = 'accuracy'
score = cross_val_score(clf, x_train, y_train, cv=k_fold, n_jobs=1, scoring=scoring)
print(score)
The error I get is:

ValueError: bad input shape (1424, 5)

Does anyone know why I am getting this error and how I can resolve this problem?

Thanks
Reply


Messages In This Thread
Bad input shape for SVC - by Scott - Dec-07-2019, 06:35 AM
RE: Bad input shape for SVC - by scidam - Dec-07-2019, 08:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Issues with Shape/Reshape for CNN moddy10 0 1,479 Oct-12-2021, 03:54 PM
Last Post: moddy10
  Making a Basic Keras Model - Input Shape and Parameters MattKahn13 0 2,130 Aug-16-2020, 04:36 PM
Last Post: MattKahn13
  cannot reshape array of size 0 into shape Roro 2 6,298 Jun-14-2020, 11:28 AM
Last Post: Roro
  ValueError: could not broadcast input array from shape (75) into shape (25) route2sabya 0 6,503 Mar-14-2019, 01:14 PM
Last Post: route2sabya

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020