3
votes

Scikit-learn offers a large variety of useful linear models. However, I am working on a problem which is linear with non-negativity constraints (i.e. solution variables should be non-negative).

I would like to use scikit-learn, but the only function I saw that can support currently non-negativity is Lasso(), via the 'positive=true' flag. LassoCV() or lasso_path() don't support non-negativity.

Are there other non-negative linear models available in scikit-learn? Are there plans to include these in the near future?

1
There are no plans to include much new in scikit-learn; the dev team is discussing a feature freeze so that a 1.0 can be released in the near future.Fred Foo
Propagating the positive=True constructor parameter to LassoCV and lasso_path would still be accepted as a PR I think. It does not add much complexity to the existing code base as LassoCV and lasso_path are wrappers for Lasso.ogrisel
anyone want to turn one of these into an answer?Bitwise

1 Answers

3
votes

The current stable version of scikit-learn supports the positive kwarg in LassoCV and lasso_path (though the latter isn't mentioned in the docstring, it seems). Example of nonnegative lasso_path usage: https://github.com/scikit-learn/scikit-learn/blob/master/examples/linear_model/plot_lasso_coordinate_descent_path.py

The ElasticNet and associated CV-versions also support a nonnegative option.