-
Notifications
You must be signed in to change notification settings - Fork 7
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Profiling estimates for optimal transport #34
Comments
Hi,
|
Yes, most probably the regions on which you try to apply optimal transport
contains too many voxels. The best solution is to choose smaller regions (200 voxels up to 400-500). For 1000 voxels, it becomes really slow and so on.
Also don't search an exact solution, a regularization of 10e-1, 10e-2 is already pretty weak and the alignment is not really improved by less regularization but it will be much slower.
As a reference, the Sinkhorn algorithm used (and not really optimized) yields a complexity in O(p * n^2 *log(n)* τ−3 ) to find a T approximate solution for n voxels and p timeframes.
|
Hey @emdupre, did this solve your problem ? I just thought of something else, in some cases, the clustering algorithm can create unbalanced regions so even though you have a high number of regions, one might be very large and completely blocking the algorithm. To solve this, you should change the clustering parameter of your estimator.( |
I wasn't able to get it to finish -- I switched to ReNA by by pre-empting your PR #35 in my local copy, but that still didn't solve it, yet. I'm planning to try your suggestion to increase the entropy regularization, but I probably won't have time to play around with this again until next week. Thanks for checking in -- I'll keep y'all up to date ! |
I did some additional testing on various IBC data. Apparently all clustering algorithms give very unbalanced results for long raw timeseries, which we did not observe since we mostly worked on contrasts for now. An algorithm which give less bad results is hierarchical kmeans, that I may add in fmralign soon. For now the best solution to have reasonable parcels is to feed an atlas such as BASC (available in nilearn for various number of regions after resampling it to the resolution of your data) You can feed any 3D Niimg atlas directly in the 'clustering' argument in PairwiseAlignment or TemplateAlignment |
I did some profiling for various estimators : Scaled Orthogonal, Ridge and OT with different regularization level. (Time is 1 CPU runtime in seconds) The difference is not huge up to 1000 voxels where our OT implementation starts taking forever without any clear reason. It's based on POT, and we might want to optimize this a lot in the coming months by recoding sinkhorn specifically. Until then, 1000 voxels for the biggest region is the limit ! |
Ahhh, that makes a lot of sense ! I had been trying various regularization thresholds but all still with the BASC parcellation at the finest resolution -- but that's still only 444 parcels. Do you think it would be worth adding this to the docs ? I'm happy to open a PR ! |
Sorry about that, yes if you have a good idea of where it should be added, for sure it'd very helpful. Are you working at a high resolution ? I'll try to make hkmeans available as soon as possible - at least as long it's not in nilearn - so that you still have an option for better balanced clusters |
Thand @thomasbazeille |
Hello, Hierarchical Kmeans are available in fmralign through : This gives way better balanced clusters especially for timeseries. |
Hi --
Thanks for this great resource ! I'm trying to adapt this example and apply it to some data I've processed, sub-sampling only the first ten frames.
Of the four methods surveyed, the first three all run smoothly and complete in under 5 minutes. I have not, though, been able to obtain results for optimal transport -- it runs for over 12 hours on my 24GB RAM machine.
I'm including the exact script below. Do you have any estimates of how long you expect optimal transport to take, or how much RAM you would recommend ?
Thanks !
The text was updated successfully, but these errors were encountered: