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

TypeError: Wrong type for labels. Please either set labels to the number of variables or provide the axis labels as a single string of characters (like "ts" for time and stimulus) #42

Open
victoris93 opened this issue Dec 5, 2022 · 1 comment

Comments

@victoris93
Copy link

victoris93 commented Dec 5, 2022

Hi,

I'm trying to run dPCA on this dataset. I suppose that my problem stems either from the shape of the input array or from my erroneous understanding of labels. The shape of the input array is (127, 2, 2, 6, 6). So I've got 127 average cell firing rates for trials with 4 variables having 2, 2, 6 and 6 levels. Is the shape correct? The labels defined below don't seem to cut it. Thanks a bunch!

from dPCA import dPCA

labels = ['cdfo'] # choice, decision, spatial frequency, orientation
dpca = dPCA.dPCA(labels, 5, regularizer = "auto")
demixed_mouse1 = dpca.fit_transform(dPCADataMouse1T5)

UPD: the same error is thrown when no labels are specified:

dpca = dPCA.dPCA()
demixed_mouse1 = dpca.fit_transform(dPCADataMouse1T5)
@victoris93 victoris93 changed the title Wrong type for labels. Please either set labels to the number of variables or provide the axis labels as a single string of characters (like "ts" for time and stimulus) TypeError: Wrong type for labels. Please either set labels to the number of variables or provide the axis labels as a single string of characters (like "ts" for time and stimulus) Dec 5, 2022
@QiqiXian
Copy link

Hi,

The shape of the input array should be: (trial_num_for_each_condition, neuron_num, other_dims), where neuron_num is the dimension that will be reduced.
The length of labels should match the number of other_dims.
If you use regularizer = "auto", you should call the function as: dpca.fit_transform(data.mean(0), data). Here data is a single-trial input matrix and data.mean(0) is a trial-average matrix.

Hope this helps!

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

No branches or pull requests

2 participants