我已经安装了所有要求并成功运行了本地服务器,但是当我尝试运行此4th_umpire(The cricket match predictor using Random Forest algo项目的预测部分时,出现以下错误:-
在这里,我要提供错误图像中提到的代码的错误部分。
def _transform(self, X, handle_unknown='error'):
X_list, n_samples, n_features = self._check_X(X)
X_int = np.zeros((n_samples, n_features), dtype=np.int)
X_mask = np.ones((n_samples, n_features), dtype=np.bool)
if n_features != len(self.categories_):
raise ValueError(
"The number of features in X is different to the number of "
"features of the fitted data. The fitted data had {} features "
"and the X has {} features."
.format(len(self.categories_,), n_features)
)
异常行是如果n_features!= len(self.categories _):,尽管我已经检查过OneHotEncoder部分,对我来说似乎还可以。