scikit-learn-contrib / lightning

Large-scale linear classification, regression and ranking in Python
https://contrib.scikit-learn.org/lightning/
1.73k stars 214 forks source link

Nonnegative penalties actually allowed in CDRegressors #150

Closed arose13 closed 3 years ago

arose13 commented 3 years ago

The docs say that the allowed penalties are...

penalty : str, 'l2', 'l1', 'l1/l2', 'nnl1', 'nnl2'
        The penalty to be used.

        - l2: ridge
        - l1: lasso
        - l1/l2: group lasso
        - nnl1: non-negative constraints + l1 penalty
        - nnl2: non-negative constraints + l2 penalty

But nnl1 and nnl2 do not work. This appears to be because the penalty object itself is not implemented.

Unless there is some reason why this is not implemented in the Regressor? If not I'd love to contribute a PR for this.

mblondel commented 3 years ago

Indeed, the docstring seems wrong. Could you send a PR for correcting the docstring?

Support for non-negative constraints could be useful too but it seems to be a bit of work (you need to modify primal_cd_fast.pyx).

mblondel commented 3 years ago

CDRegressor doesn't use the penalty objects by the way.

If you need non-negative constraints, you can use lbfgs in scipy, which supports a bounds arguments.

StrikerRUS commented 3 years ago

Closed via #152.