-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] addressing issue #6887, adding callable support for covariance comp. #7078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…iance computation
sklearn/covariance/graph_lasso_.py
Outdated
@@ -300,6 +300,12 @@ class GraphLasso(EmpiricalCovariance): | |||
If verbose is True, the objective function and dual gap are | |||
plotted at each iteration. | |||
|
|||
cov : can be 'empirical' or a callable. If 'empirical' is given, | |||
empirical covariance is computed. If a callable is given it is used | |||
to compute covariance matrix; it should take two input values, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compute the
assert_array_almost_equal(covs['cd'], covs['lars'], decimal=4) | ||
assert_array_almost_equal(icovs['cd'], icovs['lars'], decimal=4) | ||
|
||
# Smoke test the estimator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually more than a smoke tests, you're checking the result, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I compare the results of the object when passed with a callable to the one I compute manually and then call the graph_lasso
with computed values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I would remove that comment ;)
lgtm apart from comments |
Nowadays we can pass a precomputed covariance matrix that could fulfill this needs. |
Reference Issue
#6887
What does this implement/fix? Explain your changes.
Adds support for a callable computing covariance matrix.
Any other comments?