我以前的sklearn版本是0.13,现在我将其更新为0.14.1。我的代码现在不起作用(它在更新之前运行良好)。谁知道原因?这是我的代码和结果。
print 'Reading train data...'
dataset=genfromtxt(open(r'Data/train.csv','r'),delimiter=',',dtype=int,skip_header=1)
train_data=[i[1:] for i in dataset]
label=[i[0] for i in dataset]
print 'Training...'
clf=svm.SVC(kernel='poly',degree=9)
clf.fit(train_data,label)
pickle.dump(clf,open(model,'w'))
结果如下:
Reading train data...
Training...
Traceback (most recent call last):
File "svm_train.py", line 35, in <module>
main()
File "svm_train.py", line 23, in main
clf.fit(train_data,label)
File "D:\Anaconda\lib\site-packages\sklearn\svm\base.py", line 178, in fit
fit(X, y, sample_weight, solver_type, kernel, random_seed=seed)
File "D:\Anaconda\lib\site-packages\sklearn\svm\base.py", line 233, in _dense_fit
max_iter=self.max_iter, random_seed=random_seed)
File "libsvm.pyx", line 53, in sklearn.svm.libsvm.fit (sklearn\svm\libsvm.c:1388)
TypeError: fit() got an unexpected keyword argument 'random_seed'
另外,我的python环境是anaconda python。