I have a csv dataset with 2 columns I want to train SVM classifier and then predict Y value when X value is given.
My Dataset format
X,Y
1.84166666681401,2
....
1.283333,4
Y array is (1,2,3,4) only
Python code is :
import numpy
from sklearn import svm
import pandas as pd
x = pd.read_csv('train.csv', usecols=['1.84166666681401'])
y = pd.read_csv('train.csv', usecols=['2'])
x=numpy.array(x)
y=numpy.array(y)
clf = svm.SVC(C=1,kernel="linear")
clf.fit(x,y)
print(clf.predict(0.7882234))
But I have error when run the code
Warning (from warnings module):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/validation.py", line 578
y = column_or_1d(y, warn=True)
DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
How to solve this ?