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: refactor what `initialize` does

mathurinm opened this issue · comments

Currently, it's impossible to check if a datafit computes Lipschitz constants without calling its initialize method, which is costly.

As discussed IRL with @Badr-MOUFAD, we can solve this by:

  • doing only what needs to be done regardless of the solver in datafit.initialize() (eg B computation in Cox)
  • having dedicated methods such as Quadratic.compute_lipschitz, which compute it (and store it ? Probably not needed), as we currently do for Quadratic.init_global_lipschitz.

Each solver can then check easily that a datafit/penalty implements all required methods and then calls them to compute whatever quantities it requires to perform optimization.