Skip to content

question about the need of a perturbation term #528

Open

Description

@lcnature

Hi @cameronphchen sorry for bothering you.
We were reading this line of code of adding a small diagonal term to the product (Line 595-597)

np.fill_diagonal(perturbation, 0.001)

It is a bit confusing to us what is the purpose of this term. I am guessing that it serves some purpose for numerical stability. But it seems that a_subject is not a square matrix, but rather with the same of n_voxels * n_features. Because the voxels are not necessarily ordered in a meaningful way, the diagonal matrix of 0.001 will only impact some of the voxles but not all. So I wonder whether this addition is actually necessary. Of course, it is a small term which might not impact the result in any way. But maybe the code can work without it?

Thanks!

Activity

  1. cameronphchen commented on Jun 21, 2023

    @cameronphchen
    Contributor
  2. lcnature commented on Jun 27, 2023

    @lcnature
    ContributorAuthor

    Thanks Cameron! I guess it is a bit unsafe to remove it given that you encountered numerical issues before. If I get a chance to try it intensively to ensure that removing this term does not cause problem, or identify the situation when SVD breaks, then I can try to make a PR removing it. Alternatively, maybe we can make it a try and except logic: by default we don't add this term, but if SVD fails, then we add the perturbation just for that iteration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions