-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add noise input to get_searchlight_RDMs function for crossnobis and mahalanobis distance measures #356
Comments
Hi Alex, Thanks for filing this, it makes a lot of sense. Indeed a rework of searchlight as well as how we pass around noise is something we've had on our list for a while, but probably won't get around to before the end of the year. A PR would definitely be welcome, let me know if you have any questions / want to discuss anything. |
Thanks Jasper. I've written a pretty hacky function which handles crossnobis for searchlight, which I'll share here. It's not hugely efficient as there's no chunking and I'm not confident enough in my coding to submit it a a PR, but maybe it will come in handy for someone else in the same situation. As a point of reference for timing, I am using a compute server but find it runs in around 2 hours for a single subject with 10 GB of memory (4 conditions, 8 runs, about 250.000 voxels in a grey matter mask). It's messy code, as I'm currently midway through analysis, but I'll come back when I have time and clean it up a little. The n_conds and n_sessions input could be avoided by simply reading the length unique elements in of 'conds' or 'sessions' in obs_desc. As with normal crossnobis, the input in obs_desc should be ordered so that session and condition tags match the order of the observations in the data itself. While I'm here, thank you for all the hard work you and team have put in to rsatoolbox - it's a superb tool, and has made my life a lot easier (and my analyses more reproducible!).
|
That's excellent - the performance sounds good actually - thanks for sharing! I'll leave this here for future reference. Do let us know if there's anything else we can improve on. |
Hi all,
Currently there is no simple way to input residuals (or noise in general) to use for noise calculations into the get_searchlight_RDMs function. This means there is no way to use crossnobis or mahalanobis distance with the current implementation of searchlight.
I would suggest maybe adding the arguments "method_cov"=None and "residuals"=None to the function.
The function should first select relevant channels from both the data and residuals (if present) for a given searchlight centre. Then, if 'residuals' are present, then the function should use either rsatoolbox.data.noise.prec_from_residuals. If only 'method_cov' is present, it should use rsatoolbox.data.noise.prec_from_measurements to calculate the noise covariance matrix. This should use the input from "method_cov".
The resulting covariance matrix can then be input into the calc_rdm function in the argument "noise".
Let me know how this sounds - I'm happy to have a crack at implementing it if it's useful.
Best wishes,
Alex
The text was updated successfully, but these errors were encountered: