Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stubs/sklearn/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ from ._config import get_config as get_config
from ._typing import ArrayLike, Float, Int, MatrixLike
from .metrics import accuracy_score as accuracy_score, r2_score as r2_score
from .utils._estimator_html_repr import estimator_html_repr as estimator_html_repr
from .utils._metadata_requests import _MetadataRequester
from .utils._param_validation import validate_parameter_constraints as validate_parameter_constraints
from .utils._set_output import _SetOutputMixin
from .utils.validation import check_array as check_array, check_is_fitted as check_is_fitted, check_X_y as check_X_y
Expand All @@ -24,7 +25,7 @@ from .utils.validation import check_array as check_array, check_is_fitted as che

def clone(estimator: BaseEstimator | Iterable[BaseEstimator], *, safe: bool = True) -> Any: ...

class BaseEstimator:
class BaseEstimator(_MetadataRequester):
def get_params(self, deep: bool = True) -> dict: ...
def set_params(self, **params) -> Self: ...
def __repr__(self, N_CHAR_MAX: int = 700) -> str: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/sklearn/utils/_metadata_requests.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class RequestMethod:

class _MetadataRequester:
def __init_subclass__(cls, **kwargs): ...
def get_metadata_routing(self): ...
def get_metadata_routing(self) -> MetadataRequest: ...
# This code is never run in runtime, but it's here for type checking.
# Type checkers fail to understand that the `set_{method}_request`
# methods are dynamically generated, and they complain that they are
Expand Down
Loading