-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support veRSA #92
base: development
Are you sure you want to change the base?
Support veRSA #92
Conversation
…ave mode for PCA; Avoid recomputing PCA for different ROIs.
Hey, thank you for the PR! I love the veRSA feature addition - it's a really valuable contribution! The improved computational speed of the encoding functionality is also fantastic. I've tested the code and it works well! Regarding the encode_layer_ridge function - good point. This is actually a leftover from the linear encoding function, which uses PCA for dimensionality reduction. The ridge regression version simply splits and flattens the activation without PCA. The docstring incorrectly states it's using Incremental PCA. I'll fix this in another push to dev and add averaging across features to make it equivalent to linear encoding. While replicating some notebooks to test the function, I noticed it only runs when save_model and save_pca are set to true. Otherwise, I get this error:
which probably comes from
This is probably not planned, right? As always great contribution, thank you so much!! |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Again thanks for the review! |
It looks great, thank you so much Christina! I honestly think its my inability but I still struggle with the save_model / save_pca False cases. I am executing the Cognition Academy Dresden Notebook 2.ipynb to usually test for Linear Encoding (because its quick and has some data) and here the function still only runs when the parameters are set to true. See error below
The code is from this section:
Am I missing something? Thanks again for everything!! |
You're right, I missed one case. Sorry about that! Can you check if the notebook runs now? |
The goal of this PR is to support computing RSA on top of voxelwise encoding, to implement the method sometimes mentioned as veRSA. While implementing this though, I ended up making some other changes as well, to support usecases I thought important and to avoid recomputation of transforms.
Altogether, the changes are outlined as follows:
return_correlations
is not supported with veRSA.encoding_metric
function, at the innermost loop. Also, as for different subjects the fold splitting is also not influenced, the way I see this done for multiple subject ROIs is to have them named with unique names e.g. V1_subj1.npy to be processed as ROIs.encode_layer
function activations for all samples were currently stacked in memory, and for some models with very large feature vectors this can no longer fit in memory (even 64G of RAM). So an optionmem_mode
is added for the user to chose either to stack the features or transform them one by one (they are still stacked up tobatch_size
to fit PCA). Also, the last batch was not processed correctly in case the number of samples was not exactly divided by batch_size.shuffle
argument is added and integer input is supported intrain_test_split
: these are to support the option of training and evaluating on an exact (known) train-test split.Finally, although I implemented these for both the Linar and Ridge regression functions, I haven't tested it on the Ridge one, and I am a bit confused on what takes place in
encode_layer_ridge
. Is this code complete?Also, TODO: Update user-guide notebooks with new parameters.and TODO: Re-target this PR on development after thesmall_fixes
PR is merged.