TypeError:必须是str,而不是使用Boruta的ValueError

时间:2018-07-23 14:10:19

标签: python

我正在尝试对包含大约5K属性的数据进行特征提取,并且我没有大约4.5K的记录。我正在尝试使用python 3.x进行特征工程以减少变量。 熊猫数据框df包含我的原始数据。因此我使用了以下代码

x=df.drop(['ID','target'],axis=1).values
y=df['target'].values
rfc=RandomForestClassifier(n_estimators=200,n_jobs=4,class_weight='balanced',max_depth=6)  
boruta_selector=BorutaPy(rfc,n_estimators='auto',verbose=2)
boruta_selector.fit(x,y)

但是我收到错误消息,因为TypeError:必须是str,而不是ValueError 我仔细检查了我的数据,找不到任何Valueerror。我所有的属性都包含数值。您能帮我解决这个问题吗?

下面是错误回溯

Traceback (most recent call last):

  File "<ipython-input-89-80afa99c8401>", line 1, in <module>
    boruta_selector.fit(x,y)

  File "C:\Users\ChristinaHughes\Anaconda3\lib\site-packages\boruta\boruta_py.py", line 201, in fit
    return self._fit(X, y)

  File "C:\Users\ChristinaHughes\Anaconda3\lib\site-packages\boruta\boruta_py.py", line 285, in _fit
    cur_imp = self._add_shadows_get_imps(X, y, dec_reg)

  File "C:\Users\ChristinaHughes\Anaconda3\lib\site-packages\boruta\boruta_py.py", line 408, in _add_shadows_get_imps
    imp = self._get_imp(np.hstack((x_cur, x_sha)), y)

  File "C:\Users\ChristinaHughes\Anaconda3\lib\site-packages\boruta\boruta_py.py", line 383, in _get_imp
    'estimator cannot be fitted to your data.\n' + e)

TypeError: must be str, not ValueError

我还更新了我的boruta软件包。请参考所附的屏幕截图。但仍然出现相同的错误 enter image description here

0 个答案:

没有答案
相关问题