-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT Param validation: decorate all estimators with _fit_context #26473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c170f0c
528372a
a216ac2
d008661
fcb0609
b10a1d8
aefb1ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
from .utils.validation import _num_features | ||
from .utils.validation import _check_feature_names_in | ||
from .utils.validation import _generate_get_feature_names_out | ||
from .utils.validation import check_is_fitted | ||
from .utils.validation import _is_fitted, check_is_fitted | ||
from .utils._metadata_requests import _MetadataRequester | ||
from .utils.validation import _get_feature_names | ||
from .utils._estimator_html_repr import estimator_html_repr | ||
|
@@ -1131,7 +1131,13 @@ def decorator(fit_method): | |
@functools.wraps(fit_method) | ||
def wrapper(estimator, *args, **kwargs): | ||
global_skip_validation = get_config()["skip_parameter_validation"] | ||
if not global_skip_validation: | ||
|
||
# we don't want to validate again for each call to partial_fit | ||
partial_fit_and_fitted = ( | ||
fit_method.__name__ == "partial_fit" and _is_fitted(estimator) | ||
) | ||
|
||
if not global_skip_validation and not partial_fit_and_fitted: | ||
Comment on lines
+1135
to
+1140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about computing |
||
estimator._validate_params() | ||
|
||
with config_context( | ||
|
Uh oh!
There was an error while loading. Please reload this page.