flatironinstitute / nemos

NEural MOdelS, a statistical modeling framework for neuroscience.
https://nemos.readthedocs.io/
MIT License
82 stars 8 forks source link

Notes on Fit head-direction demo (dev branch) #150

Open EricThomson opened 5 months ago

EricThomson commented 5 months ago

Continuing with my notes on the demos.

I am less sure I understood some of the motivation with this demo. Still some great bits. For instance, the visualization of feature building is really great for building intuition.

My concern is with the motivation and setup. We do these nice visualizations of these tuning curves for head direction with plot_head_direction_tuning() . We sort the neurons based on their tuning preference. Clearly behavior is driving activity.

The nb says:

The population activity tracks very well the current head-direction of the animal. Question : are neurons constantly tuned to head-direction and can we use it to predict the spiking activity of each neuron based only on the activity of other neurons?

Based on all the work to visualize and talk about head-direction tuning, I was expecting us to use the head direction to predict the firing rate (sort of like we did with injected current), and then add in the spike history filter, and then add in the coupling filter, and then compare and constrast the effects of these three factors.

But, unless I'm missing something the notebook just looks at spike history and coupling. This seems incomplete. I'm left wondering how much better we would do with this clearly important variable of head direction, and why it was left out given the effort to set it up and establish its importance.

Maybe I am missing something? E.g., the demo is called fit head direction. I'm not sure we ever fit head direction. My apologies if I am simply missing something that is probably the case :laughing:

EricThomson commented 5 months ago

Independently of my above concern (which I assume is me missing some big picture thing).

This was the first intro to the basis concept, and I thought that was really well done. It is one of the more difficult concepts in nemos and you do it slowly in multiple steps, and did a really good job explaining why it was needed, and the important features of the basis set chosen.

With this nb I started to run into memory issues on my machine (Ubuntu with 4GB of GPU RAM). (jaxlib.xla_extension.XlaRuntimeError: RESOURCE_EXHAUSTED). The following placed at beginning of my nb (found via stack overflow) helped a lot (not saying it should be added, but maybe something to keep in mind as a hack):

import os
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false"
os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"]=".5"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"]="platform"