Dear Vladimir,
I checked all the parameters in two conditions (for and parfor) and they are all the same before they get to "% Optimize p: parameters of f(x,u,p)" line inside spm_nlsi_N function.
But on the first command inside the for loop for optimisation, there is a function spm_diff the results of which are different for the two conditions although the inputs are exactly the same. I checked spm_diff for any random functions that may have caused this difference but I couldn't find any. So, I assume when the first line of this for loop gives different parameters, then the whole loop is affected but I have not yet found out where this difference in spm_diff comes from. I am still searching.
Best,
Pegah
-----Original Message-----
From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On Behalf Of Vladimir Litvak
Sent: 03 September 2012 16:26
To: [log in to unmask]
Subject: Re: [SPM] FW: [SPM] DCM/EEG BMS results
Dear Pegah,
Yes, it might be something like that although I don't think it can be the head model as it is computed only once per subject and then only read but not modified. I think things that can be changed are either the DCM file or the data files (mat and dat). Maybe really try to see if they get modified between the start and the end of your parallel part and what the modification is.
Vladimir
On Fri, Aug 31, 2012 at 12:23 PM, Tayaranian Hosseini P.
<[log in to unmask]> wrote:
> Dear Vladimir,
>
> I recently realised that when I apply MSP on my data, a single_subj_T1_EEG_BEM.mat file is saved in canonical folder of SPM in "forward" level of source reconstruction.
>
> Now back to my question of parallel computing results. It seems very strange. Even when I apply parfor on just one dataset, its result is different from for-loop but if in the same parfor script, I close the matlabpool, then I will get the same result as for-loop.
>
> So, now I am definitely sure that the two codes are the same but it got me wondering if there are any other files (like single_subj_T1_EEG_BEM.mat) that are also being saved on the disk (in any of DCM functions) and for some reason, they are being loaded from the disk in a wrong order (it is kind of like having global parameters) when I apply parallel computing on the data instead of serial computing.
>
> Best,
> Pegah
>
>
> -----Original Message-----
> From: Tayaranian Hosseini P.
> Sent: 29 August 2012 17:22
> To: 'Vladimir Litvak'; [log in to unmask]
> Subject: RE: [SPM] DCM/EEG BMS results
>
> Dear Vladimir,
>
> Thank you for your reply.
>
> Yes of course it is not easy or maybe even practical to debug this program in PCT but I thought there might be a simple explanation for that.
>
> Best,
> Pegah
>
> -----Original Message-----
> From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]]
> On Behalf Of Vladimir Litvak
> Sent: 29 August 2012 15:16
> To: [log in to unmask]
> Subject: Re: [SPM] DCM/EEG BMS results
>
> Dear Pegah,
>
> DCM.F itself is approximation to the LOG evidence so a difference of
> 256 in F is a very large difference. A difference of 3 is sufficient to get one of the models 95% probable (in the two model case).
>
> Regarding the source of the differences as I learned being a computer science undergraduate:
>
> 1) Every bug has a reason.
> 2) If a bug seems to have no reason, see (1).
> 3) It is always worth the effort to investigate this kind of problems as they almost always originate from some more serious issues.
>
> However, I cannot tell you without going through the code line by line in the debugger what is happening and in the parallel case it can be quite tricky.
>
> Best,
>
> Vladimir
>
> On Wed, Aug 29, 2012 at 2:52 PM, Tayaranian Hosseini P.
> <[log in to unmask]> wrote:
>> Dear Vladimir,
>>
>>
>>
>> I again checked the two models and the priors are exactly the same. I
>> checked all the parameters and matrices in DCM.M and DCM.M.dipfit and
>> they are the same but all the amounts in posterior parameters such as
>> DCM.Ep, DCM.Cg, DCM.Cp,DCM.Eg, etc are different. And when I check
>> the mode predictions for the two models, the first one (with higher
>> BMS) predicts the original modes much better than the second model.
>>
>>
>>
>> But I still don't get it why when the two models are exactly the same
>> and they are applied on the same dataset, they should give different results?
>> Also, when DCM.F values are very close, why should I see such big
>> difference between the two models such that it will select one over
>> the other? Are the log-evidence values that are plotted using BMS the
>> same as log10(DCM.F) or
>> log(DCM.F) or any other parameter affects this comparison?
>>
>>
>>
>> Best,
>>
>> Pegah
>>
>>
>>
>>
>>
>> From: SPM (Statistical Parametric Mapping)
>> [mailto:[log in to unmask]] On Behalf Of Vladimir Litvak
>> Sent: 29 August 2012 14:04
>> To: [log in to unmask]
>> Subject: Re: [SPM] DCM/EEG BMS results
>>
>>
>>
>> Dear Pegah,
>>
>>
>>
>> That sounds strange and my guess would be that you also have slightly
>> different SPM or Matlab versions in the two cases and that's what
>> makes it different. You could try comparing all the posteriors, like
>> spm_vec(DCM.Ep) and spm_vec(DCM.Cp) and look for differences.
>>
>>
>>
>> Vladimir
>>
>>
>>
>> On 29 Aug 2012, at 13:27, Tayaranian Hosseini P. wrote:
>>
>>
>>
>> Hello,
>>
>>
>>
>> I have tried a specific DCM model on different EEG datasets. Then, to
>> speed up the calculations I tried parallel computing toolbox (PCT) of
>> MATLAB and applied the same model on the same datasets but when I
>> apply BMS (fixed
>> effects) on the results of the two models (before and after PCT) for
>> each dataset separately, the one before PCT always gives me higher
>> probability than the second one whereas I think they should be the
>> same because I have not changed any parameter in the model. Also, for
>> each dataset, F is similar for the two models for example 67632 vs
>> 67376 in one of the datasets. I checked the IDs for each set and they
>> were the same for the two conditions (before and after PCT).
>>
>>
>>
>> What else should I check in the DCM result to find out where this
>> change comes from?
>>
>>
>>
>> Best,
>>
>> Pegah
>>
>>
>>
>> --------------------------------------------------------
>>
>> Pegah Tayaranian Hosseini
>>
>> PhD Student
>>
>> Room 4077, Tizard building (13)
>>
>> Institute of Sound and Vibration Research
>>
>> University of Southampton, SO17 1BJ, UK
>>
>>
>>
>>
>> email: [log in to unmask]
>>
>>
>>
>>
|