当我使用SVM分类时,有4000个数据项我有一个问题:
'<' not supported between instances of 'float' and 'str'
但是当我使用250个数据项时,一切都很好。
这是代码:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from numpy import ndarray
from sklearn import svm
from sklearn.model_selection import train_test_split
from matplotlib import style
style.use("ggplot")
bankdata = pd.read_csv("data/vector_label.csv")
X = bankdata.drop('label', axis=1)
y = bankdata['label']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20,random_state=109)
svclassifier = svm.SVC(kernel='linear')
svclassifier.fit(X_train, y_train)
有数据:
v1,v2,v3,v..,v100,label
-2.0491536259651184,-1.213379144668579,1.9480481743812559,50.15884351730347,POSITIF
我该怎么办?