Thanks. You mentioned that I could "[add] positive to LassoCV and [pass]
it to the Lasso estimators used in the cross-val." In the directory of
my own installation of scikit-learn, I modified
sklearn/linear_model/coordinate_descent.py to include "positive=False"
to the parameter list of __init__ for the classes LassoCV, ElasticNetCV,
and LinearModelCV, and added "self.positive=positive" in the body of the
__init__ methods. However, calling LassoCV("positive=True", cv=20) still
gives me the error "TypeError: __init__() got an unexpected keyword
argument 'positive'".
I appreciate your patience with me. I have been programming in Python
for only a few months and am no expert in machine learning. I imagine
that I'm overlooking or misunderstanding some things that are obvious to
those with more experience.
I notice that Lasso inherits from ElasticNet, and that ElasticNet
includes the "positive" option, although some of the documentation for
ElasticNet doesn't seem to reflect this. I imagine that this means it
would be at least as straightforward for me to add the "positive" option
to ElasticNetCV as to LassoCV. ElasticNetCV may be even better for my
problem than LassoCV, since I expect many of my regressors to be
correlated.
I'm using these regularized regression methods as part of an iterative
solver for non-negative canonical correlation. CCA can be done by
finding w that minimizes ||Yv-Xw||^2, then scaling w by ||Xw||, then
doing the same for v, and so on back and forth until convergence. Lasso
and ElasticNet can be used for the minimization step. I'm realizing,
however, that the objective function I need to minimize will require an
additional quadratic term to enforce the orthogonality of each
projection direction to all previous directions. These methods from
scikit-learn could give me the first pair of canonical variables, but if
I want to get subsequent ones (and I do) I may have to use a more
general-purpose optimization library like scipy.optimize and define my
own objective function.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general