-
Notifications
You must be signed in to change notification settings - Fork 16
ENH: Add GP error analysis experiment script #227
Conversation
993f526
to
50002b3
Compare
50002b3
to
ea93c4a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
=======================================
Coverage 66.18% 66.18%
=======================================
Files 19 19
Lines 905 905
Branches 112 112
=======================================
Hits 599 599
Misses 264 264
Partials 42 42 ☔ View full report in Codecov by Sentry. |
Using the std deviation value of scikit-learn's GP regressor class (committed in |
@oesteban Adopted
|
@jhlegarreta I've moved things to use scikit-learn's cross-validation to avoid errors on our side implementing the CV framework:
Running this:
I get
which I believe is consistent with the expectations:
Regarding the number of directions in training, the interpretation of the k-fold is also different from what I think we were discussing: k = 5 -> 5 folds, 120/5=24 bvecs per test fold -> 96 bvecs for training. I keep receiving the following warnings though:
and:
WDYT? |
Decreasing the SNR did not help with the warnings. My hypothesis being that noisier data would regularize the problem. |
Okay, decreasing the SNR had the expected effect on the cross-validation:
Results in
|
Looks like it does at least concerning the folds: the larger the value of
Not sure 🤔. My expectation is that the more bvecs for training (the larger What I got wrong at the beginning was the intuition with the SNR, but I think the trend with the SNR shown in the plots is correct. TBH, in the plots that I pasted, I have the impression that if we have a very close look at the SNR 10 case (and may be the SNR 20 as well), there is a very slight decrease at N (k) 120 wrt to 20 (have not checked quantitatively). So unless I am missing something, this looks consistent with your results. But I'd expect the error to be notably, and not marginally, smaller.
Since my last commit/the adoption of proper k-folds, we are not using the repeats, so not sure how to assess this. Please ignore my comment if you believe that yours makes sense.
Yes, I am also getting the abnormal termination notice. Increasing the tolerance bounds did not result in any benefit for me, so there is something else that we are missing, either in a previous step or in the controls of scikit-learn's GP. In DIPY we were getting warnings when using a given CVXPY optimizer and they went away when switching to another one. In that case the warning itself was suggesting to switch to another one; not sure if in this case we have that control.
So the smaller the SNR, the larger the error, which is expected, and matches what we saw in the plots if I read well ❔. |
31e5972 adds the capability to generate a carpet plot with the ground truth and the estimated signal (see an example in nipreps/nireports#137) and a correlation plot, which looks like this for the noiseless and k=5 case: The calls are commented since after pulling the most recent commits I've seen that we no longer have the data available; had done this prior to your latest commits. |
@jhlegarreta I've found several issues - see 10a576d I'll keep digging the kernel.theta setting. Keep you posted. |
@jhlegarreta EDITED: it was a false alarm. |
(the optimizer issue is still standing though) |
Thanks for all this investigation. Let me know if you are able to push the latest changes so that I can continue investigating on my end. Two notes:
Unrelated note: eventually, after we manage to fix the current issues and if it makes sense to bring the implementation closer to DIPY's reconstruction models, we may want to use DIPY's cross validation: |
Add GP error analysis experiment script.
Use scikit-learn GP returned std error value.
Use `scikit-learn` k-folds.
Add carpet and correlation plots.
Our kernel implementation needed to have a better handling of parameters and hyperparameters. * Because the weighting was not a parameter, scikit-learn used to clone the object and create exponential kernels (dismissing the spherical setting). * I've set sigma_sq as a "fixed" hyperparameter so that it is not optimized. * The order of the derivatives was wrong - sckit-learn sorts parameters alphabetically. * I assume there are more issues, the main one that I believe parameters are not being actually optimized (set may not be working properly). This relates to the ``theta`` property of all kernels, which is a list of log-transformed parameters. This commit also fixes the wrong argument name ``kernel_model`` and uses the appropriate ``weighting``.
Like other kernels in Scikit-Learn.
308a921
to
5f5a218
Compare
I tried to migrate the cross-validation to only use Scikit-learn CV utilities. At first, Scikit-learn wanted our ``eddymotion.model._dipy.GaussianProcessModel`` to be a sklearn's Estimator. That made me realize that the boundaries between Scikit-learn, DIPY, and eddymotion weren't clear. This commit: * Separates our old ``_dipy`` module into two modules, moving all Scikit-learn-related types into a new ``_sklearn`` module. * Type-annotates and completes docstrings of most of the code. * Updates the test script ``dwi_estimation_error_analysis.py`` to employ the new code.
5f5a218
to
de3888f
Compare
Spins off work by @jhlegarreta in #227. Co-authored-by: Jon Haitz Legarreta Gorroño <[email protected]>
Currently, I have:
|
Instead of making the script 1-off, let's keep the scores of all cross validation cycles.
51de1a2
to
92fbaba
Compare
Running a comparison right now - let's keep moving :) |
Add GP error analysis experiment script.