Closed ybernaerts closed 4 years ago
I barely believe it but at the time of writing I finally got a posterior sample which came close for the first time to an experimentally observed trace: But, most posterior samples still did have no APs at all (I used the BDN framework, inspired by your paper, 1 round and trained on 10000 samples). Perhaps I'm slowly moving in better directions. Anyway, thoughts and ideas still highly appreciated.
Hi Yves,
Thanks for the words of encouragement and the questions. I will here only reply to the sbi-related issues.
So I'm reaching a bit of a dead end. Now, a HH-like model is highly nonlinear and a true challenge for these inference algorithms. I think it is fair to say that we've not completely solved this open problem. In Fig. 4 of "Training deep neural density estimators to 2 identify mechanistic models of neural dynamics", you've fitted Allen Institute data and, although, in the right direction, AP shapes and adapting firing patterns can be very different between high posterior samples and experimentally observed traces.
In https://www.biorxiv.org/content/10.1101/838383v3, you are right that the high-probability (under the posterior) samples are not always in very close agreement with the experimental data from Allen Institute. In principle, this could be an indication that (1) the posterior is not well inferred or/and (2) the model is not flexible enough to fit the experimental data. At this point, we cannot tell with full certainty what is the main cause. However, we have run another algorithm (SMC-ABC) on the same cells (and with much higher number of simulations than with SNPE), and the posteriors were quite similar to the ones obtained with SNPE, suggesting that the limitations on this problem are more on the modelling side than on the inference side.
I was also surprised to see that you've used simpler BDNs for experimentally observed traces and more flexible MAFs for simulated data.
There is another important distinction between simulated data and experimental data: in the simulated data case, we ran one round SNPE, whereas we ran 2 rounds SNPE for the experimental data. Indeed, for the experimental data, we empirically found that multi-round SNPE improved substantially the quality of the posteriors. However, currently, multi-round SNPE with MAFs has some "leakage" issues (see issue https://github.com/mackelab/sbi/issues/287). Therefore, for our problem, we used multi-round SNPE with MDNs. Note that MDNs are planned to be implemented in sbi in the next few weeks.
But, most posterior samples still did have no APs at all (I used the BDN framework, inspired by your paper, 1 round and trained on 10000 samples). Perhaps I'm slowly moving in better directions.
Do you really mean 10k samples? If so, I would suggest you to increase the number of simulations. In our case, for each experimental trace, we ran 2 rounds SNPE, each round with 125000 simulations.
Hi Pedro,
thanks for the fast reply and encouraging suggested adaptations!
suggesting that the limitations on this problem are more on the modelling side than on the inference side.
This might indeed suggest that, for some neurons, we need an additional compartment modelling e.g. the axon initial segment, or simply current diffustion to dendrites and axons.
However, currently, multi-round SNPE with MAFs has some "leakage" issues (see issue #287).
Does using MAFS with SNLE have the same issue?
we ran 2 rounds SNPE, each round with 125000 simulations.
I will try 2 rounds of SNPE with much more samples and MDNs.
Note that MDNs are planned to be implemented in sbi in the next few weeks.
To me it seems implemented already? Are you sure it's not in there yet?
Hi Yves,
This might indeed suggest that, for some neurons, we need an additional compartment modelling e.g. the axon initial segment, or simply current diffustion to dendrites and axons.
Yes, absolutely. An additional compartment would perhaps be a good idea. But even before that, do increase the number of simulations for training SNPE. This might lead to substantially better results.
Does using MAFS with SNLE have the same issue?
It will not have the same issue, but it might have other issues. We have never tried SNLE nor SNRE in this problem.
To me it seems implemented already? Are you sure it's not in there yet?
Sorry, I was not very clear. You are right that MDNs are implemented. Let me be more specific. At the moment, SNPE is implemented with atomic proposals (see https://arxiv.org/abs/1905.07488), which leads to the "leakage" issues I mentioned (independently of using MDNs or MAFs). In the next few weeks, the non-atomic version of SNPE (https://arxiv.org/abs/1905.07488) will be implemented: this one does not have the serious "leakage" issues but only works for MDNs (not MAFs).
Sorry, I was not very clear. You are right that MDNs are implemented. Let me be more specific. At the moment, SNPE is implemented with atomic proposals (see https://arxiv.org/abs/1905.07488), which leads to the "leakage" issues I mentioned (independently of using MDNs or MAFs). In the next few weeks, the non-atomic version of SNPE (https://arxiv.org/abs/1905.07488) will be implemented: this one does not have the serious "leakage" issues but only works for MDNs (not MAFs).
I see what you mean. 2 rounds with 100000 simulations each and these 'leakage' issues seem to occur.
But even before that, do increase the number of simulations for training SNPE. This might lead to substantially better results.
I'll keep it to one round of SNPE MDN 100000 simulations for now then :). Happy to hear you guys are working on the non-atomic version. Could it be that you posted the same reference twice? I read that reference, but perhaps I'm less aware of a reference referring to non-atomic SNPE.
Cheers!
I'll keep it to one round of SNPE MDN 100000 simulations for now then :). Happy to hear you guys are working on the non-atomic version. Could it be that you posted the same reference twice? I read that reference, but perhaps I'm less aware of a reference referring to non-atomic SNPE.
I posted the same reference twice, and it was on purpose. ;) The paper has both types of proposals (see beginning of section 3, and sections 3.1 and 3.2 of the paper).
I see. A closer look is required then. Thanks again Pedro!
I hope to post a good posterior sample here soon, to partially resolve this issue.
Hi Yves, cool that you're working with sbi
! :)
I've started implementing the non-atomic version of APT. You can track progress here. If everything goes well, it will be done end of next week.
All the best and see you soon in Tübingen Michael
Hey Michael,
Sounds great! I'll track you closely then ;)
See you in Tübingen indeed!
https://github.com/mackelab/sbi/pull/301 got merged, I'll close this issue for now. Feel free to reopen with further questions
Hey guys,
first of all, it's a pleasure to experiment with the sbi package. Great work on having state of the art simulator based inference algorithms in one package.
Since I have gotten only unsatisfactory results (with multiple packages) for quite some time now, I wanted to get your opinion on strategies to efficiently 1.-- create 1 compartment models and 2.-- run the inference for actually observed experimental traces. Feel free to comment on every step that I employ to infer parameters for mouse motor cortical neuron responses I see to current clamp (Patch-seq) experimental protocols.
I check the neuron cell type: Pvalb (fast spiking) e.g. and 2 channels (Na+ / K+) should in principle be suffient (I also use 'sufficient 1 compartment models from Pospischil et al.); Sst and perhaps I need an adapting K+ current (g_M in your tutorial); a bursting Vip or Sst neuron and I'd add one or two Ca++ channels (also explained in Pospischil et al.). First of all, the models in Pospischil et al. were done for ferret cortical neurons, not for mice, but I nevertheless expect these 1 compartment models to be rather sufficient to describe also mouse cortical neurons.
Then I'd check my experimentally observed membrane time constant and input resistance and derive a membrane area from it. Concretely: if I assume a specific membrane resistance c_m of 1 microF/cm*2 , I'd adapt the specific membrane resistance r_m (kOhm cm*2) so that c_m r_m gives me the experimentally observed tau (ms). With that derived r_m, the observed input resistance R_i should equal r_m * area, so I adapt my 1 compartment area so that it is satisfied. ` def syn_current(duration=800, dt=0.04, t_on = 100, curr_level = 1e-4, exp_input_res=270, exp_tau=10, seed=None):
exp_input_res in MOhms!
What about the temperature of the experiment? Optimally one should adapt the rate constant equations with the Q10 factor so that the rate of change of open probabilities of ion channels is temperature scaled. Models in Pospischil et al. are optimised for T1 = 36 degree Celcius, my experiments are either done at T2 = 25 or 34 degree Celcius. I adapt, therefore, dx/dt = scale * ... with the scale being Q10**(T2-T1). Here x represents m, h, p, ... I hope I added this scale at the right place in your exponential Euler method (see code below).
`def HHsimulator(V0, params, dt, t, I, seed=None): """Simulates the Hodgkin-Huxley model for a specified time duration and current
And then inference right? Well, no matter what I seem to opt for (BDNs, MAFs, SNLE or SNPE) I seem to either, run into posteriors that have no prior support (i.e. the summary statistics I observe lead to parameter values outside of the prior support), or I do get some posterior that gives me traces rather 'not so close' to what I experimentally observe, in terms of action potential (AP) shape, or even firing rate.
Here's an example of an Sst neuron responding to a 100 pA positive current injection. What I seem to struggle with is that I don't have simulations arriving at the same 'height' meaning that the derived membrane area might be wrong but even when I try to scale the simulation input current (which is the same as if one wants to scale the area), or even try to infer the scale, I get no sensible results. What about the Nernst potential for E_Na+ and E_K+? Perhaps they are dissimilar to ferret conditions. I tried to use different values for them too, however, or infer them, but to no avail.
So I'm reaching a bit of a dead end. Now, a HH-like model is highly nonlinear and a true challenge for these inference algorithms. I think it is fair to say that we've not completely solved this open problem. In Fig. 4 of "Training deep neural density estimators to 2 identify mechanistic models of neural dynamics", you've fitted Allen Institute data and, although, in the right direction, AP shapes and adapting firing patterns can be very different between high posterior samples and experimentally observed traces. I was also surprised to see that you've used simpler BDNs for experimentally observed traces and more flexible MAFs for simulated data.
Any thoughts, comments, ideas are highly appreciated!