Skip to content

fcma: compute_correlation returns zeros for NaNs #400

Closed

Description

@snastase

I just noticed that brainiak.fcma.util.compute_correlation returns float zeros when computing the correlation between vectors containing NaNs, which is inconsistent with other correlation computations in Python like np.corrcoef and scipy.stats.pearsonr (which return np.nan). Is this the desired output? Or is it necessary for the high-speed BLAS implementation? Might not be worth bothering with—was just curious.

Activity

  1. yidawang commented on Jan 10, 2019

    @yidawang
    Member

    We designed in this way to prevent the entire computation from crash when encountering the NaN vectors. We can point this out in the docstring if you think this may lead to some potential issue.

  2. snastase commented on Jan 10, 2019

    @snastase
    ContributorAuthor

    Okay, makes sense. When invoking compute_correlation in the isfc function, I may reassign these zeros to NaNs at the output stage to make the output consistent with isc. I can add a sentence to the compute_correlation docstring mentioning this.

  3. yidawang commented on Jan 10, 2019

    @yidawang
    Member

    Or can you submit a PR to add an argument to this function, indicating if we will convert NaN to 0? Thanks!

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