Reputation: 799
User1190882 has helped fix the tranpose issue. I will open a new thread for the SKlearn issue.
columns_train = np.array([df['A'], df['B'], df['C'], df['D'], df['E'], df['F'], df['G']])
X = columns_train
Y = columns_target
X = np.transpose(X)
print np.shape(X)
print np.shape(Y)
X_train, X_test, Y_train, Y_test = train_test_split(X,Y,test_size = 0.2, random_state = 42)
clf = svm.LinearSVC()
clf.fit(X_train, Y_train)
print clf
File "C:\Python27\lib\site-packages\sklearn\utils\multiclass.py", line 172, in check_classification_targets
raise ValueError("Unknown label type: %r" % y_type)
ValueError: Unknown label type: 'continuous'
I am not sure what I can do to make this work after looking at other threads. Can you give me some advise please? Thanks
Upvotes: 2
Views: 231
Reputation: 6034
Answer to before editing question
What you are looking for is
X = np.transpose(X)
Answer after editing question
You get that continuous
error when your datatype of your variable Y
is of floating point type. In all classification type of problems, you have to maintain the label type as int
. Convert the datatype of variable Y to int
and then it should work fine.
Upvotes: 2