AttributeError at /pre_pred/

送分小仙女□ 提交于 2020-01-24 00:53:07

问题


I've installed all the requirements and successful in running the local server but when I tried to run the prediction part of this 4th_umpire(The cricket match predictor using Random Forest algo project I'm getting the following error:-

Here I'm presenting the error part of the code as mentioned in the error image.

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)
        )

The exception line is if n_features != len(self.categories_): although I've checked that OneHotEncoder part and it seems ok to me.

来源:https://stackoverflow.com/questions/58960534/attributeerror-at-pre-pred

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!