-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(core): implement get_params()
API for steps
#145
feat(core): implement get_params()
API for steps
#145
Conversation
@@ -135,6 +135,11 @@ def __init__( | |||
self.expr = expr | |||
self.named_exprs = named_exprs | |||
|
|||
@classmethod | |||
def _get_param_names(cls) -> list[str]: |
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.
I don't love that I have to override this, but I guess it's better to do this for now (rather than change the API to require specifying expressions in a dictionary).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
+ Coverage 85.24% 85.53% +0.29%
==========================================
Files 27 27
Lines 1938 1964 +26
==========================================
+ Hits 1652 1680 +28
+ Misses 286 284 -2 ☔ View full report in Codecov by Sentry. |
ibis_ml/core.py
Outdated
# `hasattr()` always returns `True` for deferred objects | ||
and not isinstance(value, (type, Deferred)) |
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.
Alternatively, I guess can just get rid of this whole if
block? A Step
can't be nested in another Step
—at least for now.
Probably better...
Lines 366–7 aren't currently being hit, and I don't see any reasonable way it would be hit.
if p.kind == p.VAR_POSITIONAL: | ||
raise RuntimeError( | ||
"scikit-learn estimators should always " | ||
"specify their parameters in the signature" | ||
" of their __init__ (no varargs)." | ||
f" {cls} with constructor {init_signature} doesn't " | ||
" follow this convention." | ||
) |
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.
This validation won't get hit unless you don't override _get_param_names
for a step with varargs in the constructor (e.g. Mutate
or MutateAt
. I suppose I can add a test for malformed custom step?
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.
It looks great to me. Feel free to merge it on your own.
08deb9d
to
6c8c815
Compare
5e8c761
to
0387595
Compare
Description of changes
For example, from the example notebook:
will yield:
Further down
pipe.get_params()
would also work:Issues closed
Partially addresses #135
Will probably leave it open until address
set_params()
, too