Introduction to Modeling and Computational Neuroscience using Python I wonder why. I wonder why. I wonder why I wonder. I wonder why I wonder why I wonder why I wonder! * Randy Heiland Research Scientist Indiana University * Surely You're Joking, Mr. Feynman! (Adventures of a Curious Character), Richard Feynman. Overview • Computational Science: Experiments, Models, Simulations, Analyses • Modeling • Neuroscience • Python programming • Questions? (+ short survey) 0.00000000e+00, 7.59139762e-07, 1.39243600e-07, 3.508636 5.32143167e- 512 electrode chip Courtesy A.Litke 05, 2.44901501 1.73985789e-08, 0.00000000e+00 1.45115517e-06, 4.93031343e-09, 3.11438363e-08, 1.92049751e-06, 2.16824470e-08, 6.40914027e-09, 2.65017478e-06, 7.59736245e-07, 1.45118790e-06, 0.00000000e+00, 3.30347955e-06, 7.32821449e-08, , 7.22468653e-06, 1.50957302e-08, 1.05983595e-06, 2.70174543e-06, 4.93023466e-09, 1.16339858e-08, 0.00000000e+00, 4.09147792e-08, 5.44135943e-07, 2.33556551e-05, 8.26447814e-09, 3.32418446e-06, [ 2.56281682e-07, 3.11322475e-08, 7.34055651e-08, 4.09002090e-08, 0.00000000e+00, 3.82542228e-09, Mental Experiment Analysis Patterns, Structures, Causality… Model u’ = f(u,v) v’ = g(u,v) Mathematical Simulation Procedural Courtesy of Indiana University Modeling • Using math to approximate some process (or data) (physical, biological, chemical, social, …) • Typically ignore some parameters for a more “reasonable” model (e.g., for your F=ma lab, you ignored friction) • “ all models are wrong, but some are useful” – Prof. Emer. George E. P. Box, Statistics, UW-Madison Simulation • • • • Execution of a model in a computer program Several computer languages: C/C++, Java, etc. Higher level languages: MATLAB, Python, etc. Solving some models may require the use of parallel computing. Python language • • • • • >>> (52*55)/3.0 953.3333333333334 >>> from math import * >>> cos(pi) -1.0 Easy to use Interpreted Powerful Free (“open source”); runs on all computers Used in many computational science tools Simple model in Python Average monthly temperature in Indiana (from weather.com) A function as a model lowTemp=[19,22,30,41,52,61,65,63,55,43,34,23] plot(lowTemp,'o') # ‘o’ circular points time = arange(0, 12, 0.1) F = 22*sin(pi/6 * (time-pi)) + 42 plot(time,F) (Note that Python is “0-based indexing”) Neuroscience • Goal: understand relationship between neural structures and functions Why? • Help solve important problems – Vision – Memory – Auditory … • Ponder/explain interesting topics – Consciousness; self-awareness – Altruism Concepts & Terminology Soma A neuron is a nerve cell. It contains a soma, dendrites, and axon. (Combination of biology, chemistry, and physics) Illustrative image Microscopic image Yes, it’s quite complex Soma SEM image: cutaway of (mouse) nerve ending and its synaptic vesicles (cellimagelibrary.org) The scale of a model • Models can be at different scales: molecular, cellular, multi-cellular, tissue, organ, organism, … • A single neuron model is on a different space and time (“spatiotemporal”) scale than a brain region or whole brain model. Larger number of neurons complex signaling and networks Rich-Club Organization of the Human Connectome. M.P. van den Heuvel and O. Sporns. J. Neuroscience, 2 Nov 2011. 100 billion neurons in human brain (Thanks to Journal of Neuroscience and authors for permission to use this image) • “… it is intolerable that we do not have this information [connectional map] for the human brain. Without it there is little hope of understanding how our brains work…” (Crick 1993) Q: who knows who Francis Crick was? Hint: James Watson, Maurice Wilkins, Rosalind Franklin Francis Crick, 1916-2004 Vision: conversion of light to electrical signals Memory • One of the main hypotheses in neuroscience is that memories are encoded in the strengths of synapses between neurons Soma • Plasticity – the ability to change as a result of experience Overwhelmed yet? • Let’s begin by modeling a single neuron • How? – An electrical circuit is a good starting model • Why? – Because it is an (chemo)electrical circuit From your past homework The nervous system of the human body contains axons whose membranes act as small capacitors. A membrane is capable of storing 1.2 x 10-9 C of charge across a potential difference of 0.07 V before discharging nerve impulses through the body. What is the capacitance of one of these axon membranes? neuron spike Single neuron simulation http://phet.colorado.edu/en/simulation/neuron - play the simulation to see V flip/spike Simplified model of a neuron RC circuit (Resistance-Capacitance) Ion transports act as a resistor. Cell membrane acts as a capacitor. http://phet.colorado.edu/en/simulation/circuit-construction-kit-ac-virtual-lab Leaky integrate-and-fire (LIF) model (#1) dV 1 = (-V + I × R) dt RC Where variables refer to membrane’s: V = potential R = resistance I = current if t > t_rest; otherwise = 0 • Note: for those who haven’t taken Calculus (yet), dV/dt is a derivative (not division) • This equation is a differential equation • It can be solved numerically LIF in Python # initialize all variables … for i, t in enumerate(time): # loop over desired time if t > t_rest: V[i] = V[i-1] + (-V[i-1] + I*R) / tau * dt if V[i] >= V_threshold: V[i] = V[i] + V_spike t_rest = t + tau_ref plot(time,V) Numerical integration via forward Euler method. (Rf. www.neurdon.com/tag/spiking-neurons) But it’s not very realistic… dV 1 = (-V + I × R) dt RC Hodgkin-Huxley model (#2) • 1952 (Nobel Prize 1963) Giant squid measure voltages Circuit model • Electrical circuit model • A more complicated differential equation - has both linear and nonlinear components What about modeling LOTS of neurons • To model a brain, we want to model a network of neurons • Need models of both the spiking behavior and the synapse (transmission between neurons) In the human brain, each neuron is connected to several thousand other neurons. http://connectomethebook.com/?page_id=58#all Izhikevich model (#3) dv 2 = 0.04v + 5v +140 -u+ I dt du = a(bv -u) dt v=c if v >= 30 mV then u=u+d • m=membrane potential; u=membrane recovery • Captures multiple types of spiking behavior • Computationally fast enough to do many neurons Izhikevich model (cont’d) (plus many more) • Izhikevich E.M. (2003) Simple Model of Spiking Neurons. IEEE Transactions on Neural Networks, 14:1569- 1572 Analysis • After you have a model and have run a simulation of the model, you need to analyze the resulting data. Similarly, data from an experiment needs to be analyzed. – Transfer Entropy is just one such analysis technique (next slide) • The Fourth Paradigm: Data-Intensive Scientific Discovery (2009) – http://research.microsoft.com/en-us/collaboration/fourthparadigm Visualization of analysis results Transfer Entropy (TE) measures the effect that one neuron’s spiking has on another neuron. max min Part of much larger TE matrix Graph displays of TE (with different thresholds) DIY neuroscience experiments www.backyardbrains.com (SpikerBox: $50-$100) ♪ input output http://www.youtube.com/watch?v=edEXKiOmPvE Cockroach leg Sampling of Research[ers] John Beggs, Physics, Indiana U. - experimental research (“brains in a dish”) and analysis of experimental and simulated data Nancy Kopell, Mathematics, Boston U. Co-Director of Center for Biodynamics - develops models for and analysis of networks of neurons, esp. rhythms and oscillations. Susan Amara, Neurobiology, U. of Pittsburgh, past President of Society for Neuroscience. - molecular & cellular biology of transporters Olaf Sporns, Psychological and Brain Sciences, Indiana U. - computational cognitive neuroscience; neural networks; coined “Connectome” Some related textbooks Summary • Modeling uses math to approximate reality • Modeling occurs at multiple scales • Neuroscience: understand relationship between neural structures and functions • Python lets you experiment with computational neuroscience (for free) IU might be of interest to you • Dept of Physics – Biophysics, Biocomplexity • School of Informatics and Computing – Complex systems, computer science, data mining • Dept of Pyschological and Brain Sciences – Learning, computational models of … • Biology, Chemistry, … Thanks! Be curious. Be creative. Be nice to your neurons. Questions & short survey Further reading/References • • • • • • • • http://www.neurdon.com/tag/spiking-neurons/ http://connectomethebook.com/ Vase or Face? A Neural Correlate of Shape-Selective Grouping Processes in the Human Brain. Journal of Cognitive Neuroscience, Aug 2001, pg 744-753 http://www.scientificamerican.com/article.cfm?id=is-it-possible-to-use-more http://blogs.scientificamerican.com/streams-of-consciousness/2011/09/28/goldiehawn-plunges-into-brain-science/ http://faculty.washington.edu/chudler/what.html http://www.symmetrymagazine.org/cms/?pid=1000591 - From Eye to Sight, Alan Litke Craddock TJA , Tuszynski JA , Hameroff S (2012) Cytoskeletal Signaling: Is Memory Encoded in Microtubule Lattices by CaMKII Phosphorylation? PLoS Comput Biol 8(3): e1002421. doi:10.1371/journal.pcbi.1002421 http://www.ploscompbiol.org/article/info%3Adoi%2F10.1371%2Fjournal.pcbi.100 2421 Analysis publications • Simple model of spiking neurons. IEEE Transactions on Neural Networks (2003) 14:1569- 1572 • Complex network measures of brain connectivity: uses and interpretations. Neuroimage. 2010 Sep;52(3):1059-69 • Extending Transfer Entropy Improves Identification of Effective Connectivity in a Spiking Cortical Network Model Neuroimage. 2010 Sep;52(3):1059-69 Self-awareness • Awareness of one’s own ability to think (humans, apes, dolphins, …) • 1970 “mirror test” for chimpanzees – Difficult to test I wonder why. I wonder why. I wonder why I wonder. I wonder why I wonder why I wonder why I wonder! * • Effects of meditation experience on functional connectivity of distributed brain networks. Feb 2012. www.frontiersin.org/human_neuroscience/10.3389/fnhum.2012.00038/abstract “Participants with more meditation experience exhibited increased connectivity within attentional networks…” • Nerve cells are formed during fetal life and for a short time after birth. Unlike most cells, which have a fairly short lifespan, neurons in the brain live a long time. These cells can live for up to 100 years or longer. To stay healthy, living neurons must constantly maintain and repair themselves. • Groups of neurons in the brain have special jobs. For example, some are involved with thinking, learning, and memory. Others are responsible for receiving information from the sensory organs (such as the eyes and ears) or the skin. Still others communicate with muscles, stimulating them into action. Definitions (for this talk) • Model: math equation(s) to describe a process (physics,chemistry,biology,…) • Simulation: computer program to solve the model • Analysis: interpretation/verification of data from the simulation (or experiment) Is it possible to use more of our brain? Barry Gordon, professor of neurology and cognitive science at the Johns Hopkins University School of Medicine, replies Scientific American| Saturday, March 3, 2012 | 2 Yes! Though perhaps not how you might imagine. You can't put more of your brain to work. Your whole brain is working all the time, even when you think you're just being lazy. What you can do is make it work more productively. There are two proved strategies to make your neural systems more efficient. The first strategy is to focus, which is hard to do. It is quite difficult to force your brain to stay on task and to shut off extraneous thoughts. Yet by concentrating, your brain can muster the neural tools it needs to tackle a complex problem. In fact, intense focus may be one reason why so-called savants become so extraordinary at performing extensive calculations or remembering a slew of facts. The second approach is optimization. The human brain is far from an ideal "thinking machine." Our mental processes are slow, and the accuracy of our memory is far from perfect. Our intrinsic limitations are compounded by the simple mental blunders we make; these unhelpful tendencies, however, are correctable. For instance, you can become a better problem solver by looking beyond your personal biases and blind spots to consider alternative solutions. The more you learn to recognize and seek a variety of answers, the better your brain will be at finding optimal solutions. Some proof that focus and optimization can improve the brain's performance comes from research on video gamers. Neuroscientists at the University of Rochester have shown that even novice gamers can improve cognitive skills such as perception and attention by playing action video games. These games can strengthen players' mental acuity because they require intense concentration and ruthless selfcorrection (otherwise, your friends shoot you!). Sometimes, however, you may think better when you're not trying so hard. (You have to consider all the alternatives.) Periods of artistic and scientific creativity—when people often tackle the biggest, most open-ended problems—usually require letting your brain meander, percolate, chill. It may not feel like you are using more of your brain when you unleash it in this way, but one virtue of the human brain is that it often does its best work when it does not seem to be working at all. 1-min lesson in Diff. Eq. • Geometric interpretation • Show sin(x), tangent/deriv cos(x) • d/dt F(x) = cos(x) This confocal micrograph shows specialized cells named Purkinje cells (red) that are found in a part of the brain called the cerebellum. They send out vast numbers of branches that make connections with other cells in the cerebellum. This part of the brain co-ordinates your voluntary movements and keeps you oriented in space. It also plays a part in learning physical skills - like riding a bike or playing the piano.