Fix Python typehint with upgraded mypy. (#7513)

This commit is contained in:
Jiaming Yuan 2021-12-16 23:08:08 +08:00 committed by GitHub
parent 70b12d898a
commit 6f8a4633b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -1859,7 +1859,7 @@ class DaskXGBClassifier(DaskScikitLearnBase, XGBClassifierBase):
vstack = update_wrapper( vstack = update_wrapper(
partial(da.vstack, allow_unknown_chunksizes=True), da.vstack partial(da.vstack, allow_unknown_chunksizes=True), da.vstack
) )
return _cls_predict_proba(getattr(self, "n_classes_", None), predts, vstack) return _cls_predict_proba(getattr(self, "n_classes_", 0), predts, vstack)
# pylint: disable=missing-function-docstring # pylint: disable=missing-function-docstring
def predict_proba( def predict_proba(

View File

@ -1442,9 +1442,7 @@ class XGBClassifier(XGBModel, XGBClassifierBase):
iteration_range=iteration_range iteration_range=iteration_range
) )
# If model is loaded from a raw booster there's no `n_classes_` # If model is loaded from a raw booster there's no `n_classes_`
return _cls_predict_proba( return _cls_predict_proba(getattr(self, "n_classes_", 0), class_probs, np.vstack)
getattr(self, "n_classes_", None), class_probs, np.vstack
)
@xgboost_model_doc( @xgboost_model_doc(