在python中学习新模型时出现以下错误
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/user/Project/ThesisFinal/FrameWork/eval.py", line 46, in evaluate
clf.fit ( train,trainLabel.iloc[:,0] )
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/forest.py", line 316, in fit
random_state=random_state)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/base.py", line 130, in _make_estimator
_set_random_states(estimator, random_state)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/base.py", line 52, in _set_random_states
for key in sorted(estimator.get_params(deep=True)):
File "/usr/local/lib/python3.5/dist-packages/sklearn/base.py", line 241, in get_params
warnings.filters.pop(0)
IndexError: pop from empty list
以下是产生错误的代码部分:
train= pd.read_csv (
"%s/%s/LabelDataSet.csv" % (dirpath,dirname),encoding='utf-8')
test= pd.read_csv (
"%s/%s/TestDataSet.csv" % (dirpath,dirname),encoding='utf-8')
traincl=list(train.columns.values)
testcl=list(test.columns.values)
los=list(set(traincl)-set(testcl))
d = dict.fromkeys ( los,0 )
test.assign ( **d )
test.columns = test.columns.astype ( int )
test.sort_index ( axis=1,inplace=True )
clf = RandomForestClassifier ( n_estimators=100 )
clf.fit ( train,trainLabel.iloc[:,0] )
问题是什么,我该如何解决?