Skip to content

Errors with behavioral and mean-centered PLS #73

@tylercall

Description

@tylercall

Hello,

I recently encountered errors while trying to run behavioral and mean-centered PLS on my data (functional connectivity matrix and accompanying behavioral matrix). I have been able to reproduce these errors with the sample code from the README, leading me to believe the issue might be a bug in in the PLS implementation and not an issue with my input matrices (which I've confirmed are correctly stacked and contain no constant columns).

For both PLS functions, I tried testing different combinations of arguments (e.g., omitting groups, setting it to [40] to represent a single group, etc.). The only way I have been able to bypass the errors is to turn off permutation testing, bootstrapping, and force n_proc=1.

Behavioral PLS

For behavioral PLS, the error is: "ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 4 is different from 40)". I have reproduced the error with the following sample code:

    X = np.random.rand(80, 10000)  # a 10000-feature (e.g., neural) data array
    Y = np.random.rand(80, 10)     # a 10-feature (e.g., behavioral) data array
    groups = [20, 20]  # a list with the number of subjects in each group
    n_cond = 2         # the number of tasks or conditions

    bpls = pyls.behavioral_pls(X, Y, groups=groups, n_cond=n_cond)

Mean-centered PLS

For mean-centered PLS, I am getting "IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed". This error occurs with the following sample code:

    X = np.random.rand(80, 10000)  # a 10000-feature (e.g., neural) data array
    groups = [20, 20]  # a list with the number of subjects in each group
    n_cond = 2         # the number of tasks or conditions

    mpls = pyls.meancentered_pls(X,
                                 groups=groups,
                                 n_cond=n_cond)

"Workaround"

The only way I've been able to bypass this error is by forcing n_boot=0, n_perm=0, and n_proc=1. For example:

mpls = pyls.meancentered_pls(X, groups=groups, n_cond=n_cond, n_boot=0, n_perm=0, n_proc=1)

Running without permutation testing or bootstrapping is not really a viable workaround, but I hope that this helps pinpoint the bug (or user error?).


Thank you!

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