scikit-learn-contrib / skglm

Fast and modular sklearn replacement for generalized linear models

Home Page:http://contrib.scikit-learn.org/skglm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API simplify BaseDatafit and BasePenalty

mathurinm opened this issue · comments

They suffer from several issues:

  • They are intended to serve as reference code for implementation of a new penalty/datafit, but writing a new penalty is very different given the solver that you have in mind.
  • They do not inherit from abc.ABC (jitclass can't), so the @AbstractMethod is ignored
  • Block penalties inherit from it, so they have a prox_1d attribute, making solver compatibility checks hard in #137 (and in reality, they don't implement it: see point above)

Suggestion: remove the solver-specific attributes from BaseDatafit and BasePenalty. Rewrite the add_penalty tutorial to make it clear that this penalty is intended for the AndersonCD solver only

One question this does not solve: how do we let a user know which attributes must a penalty implement to be compatible with a solver, and what are their signatures?

WDYT @PABannier @QB3 ?