Skip to content

Commit

Permalink
Fix Python typehint with upgraded mypy. (#7513)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Dec 16, 2021
1 parent 70b12d8 commit 6f8a463
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python-package/xgboost/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ async def _predict_proba_async(
vstack = update_wrapper(
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
def predict_proba(
Expand Down
4 changes: 1 addition & 3 deletions python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,9 +1442,7 @@ def predict_proba(
iteration_range=iteration_range
)
# If model is loaded from a raw booster there's no `n_classes_`
return _cls_predict_proba(
getattr(self, "n_classes_", None), class_probs, np.vstack
)
return _cls_predict_proba(getattr(self, "n_classes_", 0), class_probs, np.vstack)


@xgboost_model_doc(
Expand Down

0 comments on commit 6f8a463

Please sign in to comment.