-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Param validation for Dictvectorizer #23820
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
Param validation for Dictvectorizer #23820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @SangamSwadiK. You forgot to remove the estimator from the common test blacklist :)
Please also call _validate_params
in fit_transform
.
@@ -97,6 +97,13 @@ class DictVectorizer(TransformerMixin, BaseEstimator): | |||
array([[0., 0., 4.]]) | |||
""" | |||
|
|||
_parameter_constraints = { | |||
"dtype": [type], # TODO: TypeOptions constraint, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When any dtype is valid, we'd rather delegate validation to numpy since dtype can be exressed in many different ways, as discussed in #23579
"dtype": [type], # TODO: TypeOptions constraint, | |
"dtype": "no_validation" # validation delegated to numpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Micky774 does this PR has your +1 now ? |
Yes, looks good now, +1. |
Merging. Thanks @SangamSwadiK for the PR and @Micky774 for the review. |
Reference Issues/PRs
Issue: #23462 (make estimators use _validate_params)
What does this implement/fix? Explain your changes.
Adds parameter validation to DictVectorizer.
Any other comments?
Added #Todo for parameter dtype