estimators.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:pines 作者: dmitru 项目源码 文件源码
def _validate_X_predict(self, X, check_input):
        """Validate X whenever one tries to predict, apply, predict_proba"""
        if self._tree is None:
            raise NotFittedError("Estimator not fitted, "
                                 "call `fit` before exploiting the model.")

        if check_input:
            X = check_array(X, dtype='f')

        n_features = X.shape[1]
        if self._n_features != n_features:
            raise ValueError("Number of features of the model must "
                             " match the input. Model n_features is %s and "
                             " input n_features is %s "
                             % (self._n_features, n_features))

        return X
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号