a question about tvb simulation: same parameters but results are different

77 views
Skip to first unread message

Wayne Wong

unread,
Oct 18, 2021, 12:20:52 PM10/18/21
to TVB Users
Dear All,

Hi everyone! I have a question about the simulation. I found that, even when I used the same parameters in the simulations, my simulation results could be different. I even stated the RandomState(seed=42) for both simulations, and use all parameters the same, but it still happened. I made a JupyterNotebook file to illustrate this issue: https://github.com/yilewang/TVB_Demo/blob/master/tvb_comparison.ipynb 

As yall can see, in the two simulations, the LFPs results are different. What could be the potential reason for the difference? 

Thank you!!

Best, 

Yile

Julie Courtiol

unread,
Oct 18, 2021, 12:34:47 PM10/18/21
to tvb-...@googlegroups.com
Dear Yile,

In your first simulation, you keep the conduction speed at its default value. In the second, you set it at 10.

Best, Julie


Dr. Julie Courtiol
Scientific Lab Manager
Brain Simulation Section 
Charité Universitätsmedizin Berlin

Le 18 oct. 2021 à 18:20, Wayne Wong <ylww...@gmail.com> a écrit :

Dear All,
--
You received this message because you are subscribed to the Google Groups "TVB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/d14ea6d1-1b98-4d9a-83d7-04e744fd74a0n%40googlegroups.com.

Wayne Wong

unread,
Oct 18, 2021, 1:03:10 PM10/18/21
to TVB Users
Thank you Dr. Courtiol for your reply~ ops I am really sorry for the mistake! In the previous notebook, I forget to include the speed option in the method 1. In the beginning, I thought it is due to the conduction velocity, however, when I changed it to 10, it still gave me different results. 

I update the notebook now, even though I included conduction velocity, the two simulations are still different: https://github.com/yilewang/TVB_Demo/blob/master/tvb_comparison.ipynb 

Thank you~

Julie Courtiol

unread,
Oct 18, 2021, 2:42:46 PM10/18/21
to tvb-...@googlegroups.com
In the figures, you can see that the initial conditions are different between the two simulations.
The simulator function resets the RandomState in the second simulation.

In order your system dynamics do not depend on the initial conditions, you have to remove the transient time. You have to use longer simulation length to identify it and then remove it from your time series.
---
Best regards,

Dr. Julie Courtiol




Wayne Wong

unread,
Oct 18, 2021, 6:20:58 PM10/18/21
to TVB Users
Dear Dr. Courtiol,

Thanks for it! Ya that makes sense. I noticed that the initial conditions are different for the simulations. I am just wondering why the initial conditions are different even though I set up the same random state seed. 

I also tried to separate my two methods and put them into different notebooks, and rest everything then run them separately, however, they still have different results, and the initial conditions are still different...  (sim1: https://github.com/yilewang/TVB_Demo/blob/master/sim1.ipynb ; sim2: https://github.com/yilewang/TVB_Demo/blob/master/sim2.ipynb )

I know there are not an absolute answer about the right or wrong on the simulation results (since it is stochastic), however, I still want to make sure that my results are reproducible and transparent to other people who may want to replicate my results in future.. As you can see, the only difference between my sim 1 and sim 2 is how I write my codes to execute the simulation, but at the end I still have different outcomes because of the initial conditions (I don't know how TVB decides initial condition for each simulation). Naturally I will doubt myself why it happened. My research is to do signal processing on the simulated signals, so I want to ensure the signals (data) I generated are good... So I guess my final question is that, is it possible that we can assign an initial condition to the system dynamics so that it will generate similar results every time, no matter how we generate the simulation?

Thanks again for your answer! And please forgive me if it is a super dumb question.. 

Best Regards, 

Yile

Wayne Wong

unread,
Oct 18, 2021, 6:23:03 PM10/18/21
to TVB Users
And also, longer simulation is a good idea! Probably I will extend my simulation length to reduce the differences caused by different initial conditions~ Thanks!

On Monday, October 18, 2021 at 1:42:46 PM UTC-5 courtio...@gmail.com wrote:

Julie Courtiol

unread,
Oct 19, 2021, 9:45:58 AM10/19/21
to tvb-...@googlegroups.com
The set up of initial conditions, from which the simulation will begin, is done in the Simulator: initial_conditions with shape [1 (time), n_svars, n_nodes, n_modes].





---
Best regards,

Dr. Julie Courtiol



Reply all
Reply to author
Forward
0 new messages