Skip to content
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

random correction #139

Merged
merged 9 commits into from
Feb 25, 2022
Merged

Conversation

EnricaBelfiore
Copy link
Contributor

The random_corr method implemented did not work for matrices with a dimention higher than 30x30 because it returned a matrix not always positive definite nor symettrical (for numerical fluctuations). With this correction the matrix will allow for the creation of a category cov instance up until size 10000x10000 (bigger matrix gives memory issues, in the previous implementation as well), but some eigenvalues could be -1e-18 or in this range (numerical approximation of zero).

The method _reduce_size is modified because it did not work for a real covariance matrix.

P.s. even if we will change the decomposition it should be mantained because it is used also for different methods (invert, _gls_G_inv)

@luca-fiorito-11 luca-fiorito-11 self-requested a review February 19, 2022 18:13
@luca-fiorito-11
Copy link
Owner

Thanks @EnricaBelfiore , I will have a look. But first I'll wait that you finish the tests

@EnricaBelfiore
Copy link
Contributor Author

I made these changes without inserting the negative eigenvalues equal to zero because this is done by the to_positive method. I prefer to drop that method and insert the cut here if you agree.

@luca-fiorito-11
Copy link
Owner

I made these changes without inserting the negative eigenvalues equal to zero because this is done by the to_positive method. I prefer to drop that method and insert the cut here if you agree.

We agreed the eig method will remove eigenvalues given a tolerance.
The method to_semipositive will reconstruct the covariance with negative eigenvalues set to zero.

"""
Extract eigenvalues and eigenvectors.

Parameters
----------
sort : `bool`, optional, default is `True`
flag to return sorted eigenvalues and eigenfunctions
tolerance : `float`, optional, default is `None`
truncation proportional to the magnitude of the largest positive eigenvalue,
e.g. 1000 to cut all the eigenvalues 1000 times lower than the largest eigenvalue

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you want to remove only negative eigs? What can the user do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants