-
Notifications
You must be signed in to change notification settings - Fork 28
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
API design with penalty and datafit jitted inside fit #44
Conversation
@PABannier thanks! I have merged my design proposal into the existing code. It seems to be working OK. For now I did it only for L1 and Quadratic. It should be straightforward to extend to other datafits and penalties. Something needs to be fixed to handle |
Looks very clean to me. The kind of PR that removes a lot of hurdles at once. |
I was surprised at first that fit does not call I think in the end we can/should just call |
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 liked the design. Big appreciation @mathurinm!
Before we proceed forward, we need to enhance spec_to_float32
to handle non-float attributes (e.g. spec of QuadraticGroup
). Indeed, in this case, it returns a wrong spec (cf. debug_script).
Co-authored-by: Badr MOUFAD <65614794+Badr-MOUFAD@users.noreply.github.com>
skglm/datafits/base.py
Outdated
Datafit : datafit class, inheriting from BaseDatafit | ||
A datafit class, to be compiled. | ||
klass : class | ||
Un instantiated Datafit or Penalty. |
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 understand what is meant here, can you explain?
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 is to indicate that Datafit
, resp Penalty
, is passed and not Datafit()
, resp Penalty()
.
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.
Last thing to do is to add get_spec
and params_to_dict
to BaseDatafit and BasePenalty, to add docstring explaining what these methods do. then LGTM!
This attempts to simplify the API of datafits by jit complying classes when fitting models.
Currently, we have a distinct jit class for each type (e.g.
Quadratic
,Quadratic_32
)