ThomasYeoLab / CBIG

MIT License
579 stars 382 forks source link

Warning: Van Mises did not converge after 100 iterations #1

Closed jcrdubois closed 2 years ago

jcrdubois commented 5 years ago

in stable_projects/brain_parcellation/Kong2019_MSHBM/step1_generate_profiles_and_ini_params

I am running the CBIG_MSHBM_generate_ini_params on my own dataset with 15 subjects, two runs per subject. The inputs are:

seed_mesh          = 'fs_LR_900';
targ_mesh           = 'fs_LR_32k';
num_clusters       = 17;
num_initialization = 1000;

The program runs fine, but I get the following Warning from most iterations. For example:

Iter. 145...  Warning: Von mises did not converge after 100 iterations 
> In direcClus_fix_bessel_bsxfun (line 232)
  In CBIG_VonmisesSeriesClustering_fix_bessel_randnum_bsxfun (line 129)
  In CBIG_MSHBM_generate_ini_params (line 59) 
took 19.683137 second.

Should I worry about these warnings? Should I increase the default number of iterations to avoid it?

rubykong commented 5 years ago

@jcrdubois This warning suggests that the current random seed is not a good initialization for the vMF clustering algorithm.

1) If at least 30% of your random initializations does not show this warning

You can ignore these warnings.

In our algorithm, we run multiple random initializations (e.g., 1000) and pick the random seed with parcellations that result in the best cost function value. In our experience, random seeds that do not converge after 100 iterations will have bad cost function values, even if we run more iterations to let them converge. Hence, these seeds are basically ``useless’’ because they will never be selected to be the best solution even if we run more iterations. Therefore, we have set the max number of iterations to 100.

2) If almost all of your random initializations show this warning

You need to run more random initializations and check the quality of your final clustering results. The clustering results are stored in <output_dir>/group/group.mat, load this file in Matlab and use the following command to visualize the parcellation:

For data in fsaverage5 space

load('<output_dir>/group/group.mat');

CBIG_DrawSurfaceMaps(lh_labels, rh_labels, 'fsaverage5', 'inflated'); 

For data in fs_LR_32k space

load('<output_dir>/group/group.mat');

CBIG_DrawSurfaceMaps_fslr(lh_labels, rh_labels, 'fs_LR_32k', 'inflated'); 

If you find this parcellation looks reasonable, you can go ahead with it. But if you find this group-level parcellation looks terrible, this suggests that might have to improve your input data. For example, you might need to modify your preprocessing (more or less smoothing?), include more subjects, etc