-
Notifications
You must be signed in to change notification settings - Fork 10
Weighted correlation matrix fixes #117
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
|
Following the example However, if I do I get all zeros -- I think something in the logic about recomputing is overriding the change. It may be that we want this behaviour (i.e. successive calls where one decreases Otherwise: looks good, works as expected, almost ready to merge! |
|
Can you check the code box in the previous comment? |
|
Okay, I can't tell what failure mode you are seeing that gives all zeros since your code block is blank. I tried it with various values of |
|
Oh, I think I've deduced what you meant: the code is still returning the degenerate part of the rank. Right, that's confusing. I'll check in a fix. |
Bad formatting -- I've fixed it now. You fixed the issue in the code block, but no in the way that I was expecting! Either way, this seems sorted now, and I think the last to-do is figuring out how to make sure this is all clear in documentation. |
|
Hm. In the example that you provided above: the current solution would fail because the ranks would be different. For your example to work, the rank of the matrix needs to be the same as the original We could revert to the previous form (with zeroing). Not sure... |
|
No, I don't think there is any need to revert. I think truncating the matrix is the right solution here, that way the user has a clearer example of what they are getting! |
|
Okay. It's less flexible perhaps, but better defined. Specifically, let S(i) and S(j) be the series reconstructed from PC i, j and let (S(i), S(j))_w denote the Frobenius norm of the two trajectory matrices. Then, you get a nPC x nPC rank matrix with |
|
I've documented the new behavior in the Python doc strings and defined the w-correlation matrix in the latest working version of the readthedocs manual. Should we change the merge target to |
|
I agree that this can/should go in I've also used this as an opportunity to post the up-to-date PDF version of the paper (the markdown was already updated). |
Summary
Computation of the weighted correlation matrix relies on the user to have computed a reconstruction with all PCs of interest. For example, if the last reconstruction used a particular pair of PCs, a subsequent call to
wCorr()orwCorrAll()would be incomplete.This addresses #114
Fix
wCorr(),wCorrAll(), andwCorrKey()trigger a reconstruction for all PCs before computing the weighted correlation matrixnPCvariable to limit the number of PCs used in the reconstruction. This defaults to thenPCvalue provided to the constructorwCorr*call and the desirednPCis less than or equal to the number of the last call.Checks so far
Checked using the
pyEXP coefficientsnotebook.