0

这是我的代码:

mice=MICE(n_imputations=1, verbose=False, model=RandomForestRegressor())
df=pd.DataFrame(data=mice.complete(d), columns=d.columns, index=d.index)

一旦我将 scikit 估计器放入模型 = 中,它就会出错。它还与 XGBoost 存在错误。

这是错误消息:

TypeError                                 Traceback (most recent call last)
<ipython-input-39-ad0d319d3712> in <module>()
      4 mice=MICE(n_imputations=1, verbose=False, model=RandomForestRegressor())
      5 d=data[country].select_dtypes(include=[np.float]).as_matrix()
----> 6 df=pd.DataFrame(data=mice.complete(d), columns=d.columns, index=d.index)
      7 #df.plot(figsize=(10, 6))

/Users/Nicolas/anaconda2/lib/python2.7/site-packages/fancyimpute/mice.pyc in complete(self, X)
    332             print("[MICE] Completing matrix with shape %s" % (X.shape,))
    333         X_completed = np.array(X.copy())
--> 334         imputed_arrays, missing_mask = self.multiple_imputations(X)
    335         # average the imputed values for each feature
    336         average_imputated_values = imputed_arrays.mean(axis=0)

/Users/Nicolas/anaconda2/lib/python2.7/site-packages/fancyimpute/mice.pyc in multiple_imputations(self, X)
    323                 missing_mask=missing_mask,
    324                 observed_mask=observed_mask,
--> 325                 visit_indices=visit_indices)
    326             if m >= self.n_burn_in:
    327                 results_list.append(X_filled[missing_mask])

/Users/Nicolas/anaconda2/lib/python2.7/site-packages/fancyimpute/mice.pyc in perform_imputation_round(self, X_filled, missing_mask, observed_mask, visit_indices)
    200                     X_other_cols_observed,
    201                     column_values_observed,
--> 202                     inverse_covariance=None)
    203 
    204                 # Now we choose the row method (PMM) or the column method.

TypeError: fit() got an unexpected keyword argument 'inverse_covariance'
4

0 回答 0