<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 SYDE 556/750
Step1:  Overall Goal
<img src="files/lecture1/book_cover.png" width="200" style="float
Step2:  Brain structures
Lots of visually obvious structure
Lots of greek and latin names to remember
locus coeruleus, thalamus, amygdala, hypothalamus, substantia nigra, etc etc
<img src="files/lecture1/brain1.jpg" width="300" style="float
Step3:  Neurons in the brain
100 billion
100's or 1000's of distinct types (distinguished via anatomy and/or physiology)
Axon length
Step4:  Kinds of data from the brain
Lesion studies
What are the effects of damaging different parts of the brain?
Occipital cortex
Step5:  <img src="files/lecture1/catgratings.gif" width="400" style="float
Step6:  Calcium Imaging
Use calcium to glow when Ca2+ ions bond
Happens a lot during neural activity and spike generation
Good spatial and good temporal resolution
E.g. In a fish embryo
Step7:  In a stalking fish
Step8:  Optogenetics
Allows stimulation and recording from select parts of the brain
Just those parts expressing a light sensitive proteins that are stimulated
High spatial and temporal resolution (but local)
Step9:  What do we know so far?
Lots of details
Data
Step10:  Billions of neurons
Simplify the neuron model and you can run more of them
Step11:  The controversy
What level of detail for the neurons?  How should they be connected?
IBM SyNAPSE project (Dharmendra Modha)
Billions of neurons, but very simple models
Randomly connected
2009
Step12:  Vision
Step13:  Problem solving
Step14:  Spaun
Step15:  Spaun
Step16:  Spaun
Step17:  Spaun
<ASSISTANT_TASK:>
Python Code:
from IPython.display import YouTubeVideo
YouTubeVideo('U_Q6Xjz9QHg', width=720, height=400, loop=1, autoplay=0, playlist='U_Q6Xjz9QHg') 
Explanation: SYDE 556/750: Simulating Neurobiological Systems
Accompanying Readings: Chapter 1
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('jHxyP-nUhUY', width=500, height=400, autoplay=0, start=60)
Explanation: Overall Goal
<img src="files/lecture1/book_cover.png" width="200" style="float:right"> 
- Building brains!
- Why? 
    - To figure out how brains work (health applications)
    - To apply this knowledge to building systems (AI applications)
Administration
Course website: http://compneuro.uwaterloo.ca/courses/syde-750.html
Contact information
Chris Eliasmith: <a href="mailto:celiasmith@uwaterloo.ca">celiasmith@uwaterloo.ca</a>
Course times: Mon & Wed. 9:00a-10:20a (10:30a-11:20p Wed for 750)
Location: Mon: E5-6004, Wed: E7-5343 
Office hours: by appointment
Coursework
Four assignments (60%)
20%, 20%, 10%, 10%
About two weeks for each assignment
Everyone writes their own code, generates their own graphs, writes their own answers
Final project (40%)
Make a model of some neural system
For 556 students, this can be an extension of something seen in class
For 750 students, this must be more of a research project with more novelty
ideas
Get your idea approved via email before Reading Week (Feb 18)
Schedule
<table style="border: 1px solid black;" cellspacing="10">
<tr><th>Week</th><th>Reading</th><th>Topic</th><th>Assignments</th></tr>
<tr><td style="padding:0 15px 0 15px;">Jan 7</td><td style="padding:0 15px 0 15px;">Chpt 1</td><td>Introduction</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Jan 9, 14</td><td style="padding:0 15px 0 15px;">Chpt 2,4</td><td>Neurons, Population Representation</td><td style="padding:0 15px 0 15px;">#1 posted</td></tr>
<tr><td style="padding:0 15px 0 15px;">Jan 16, 21</td><td style="padding:0 15px 0 15px;">Chpt 4</td><td>Temporal Representation</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Jan 23, 28, 30</td><td style="padding:0 15px 0 15px;">Chpt 5,6</td><td>Feedforward Transformations</td><td style="padding:0 15px 0 15px;">#1 due (23rd at midnight); #2 posted</td></tr>
<tr><td style="padding:0 15px 0 15px;">Feb 4, 6, 11</td><td style="padding:0 15px 0 15px;">Chpt 6,8</td><td>Dynamics</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Feb 13, 25</td><td style="padding:0 15px 0 15px;">Chpt 7</td><td>Analysis of Representations</td><td style="padding:0 15px 0 15px;">#2 due (15th at midnight); #3 posted</td></tr>
<tr><td style="padding:0 15px 0 15px;">Feb 18, 20</td><td></td><td>*Reading Week*</td><td></td></tr>
<tr><td style="padding:0 15px 0 15px;">Feb 27, Mar 4</td><td style="padding:0 15px 0 15px;">Provided</td><td>Symbols</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Mar 6, 11</td><td style="padding:0 15px 0 15px;">Chpt 8</td><td>Memory</td><td style="padding:0 15px 0 15px;">#3 due (6th at midnight)</td></tr>
<tr><td style="padding:0 15px 0 15px;">Mar 13, 18</td><td style="padding:0 15px 0 15px;">Provided</td><td>Action Selection</td><td style="padding:0 15px 0 15px;">#4 due (20th at midnight)</td></tr>
<tr><td style="padding:0 15px 0 15px;">Mar 20, 25</td><td style="padding:0 15px 0 15px;">Chpt 9</td><td>Learning</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Mar 27</td><td style="padding:0 15px 0 15px;"></td><td>Conclusion</td><td style="padding:0 15px 0 15px;"></td></tr>
<tr><td style="padding:0 15px 0 15px;">Apr 1, Apr 3</td><td style="padding:0 15px 0 15px;"></td><td>Project Presentations</td><td style="padding:0 15px 0 15px;"></td></tr>
</table>
To Do:
Get textbook (Eliasmith & Anderson, 2003, Neural Engineering), start reading.
Be able to run Juypter (old: ipython) notebooks
Anaconda is probably simplest
Decide what language you'll do your assignments in (Python highly recommended, need permission for others)
Start thinking about a project... already!
Focus of the Course
Theoretical Neuroscience
<img src="files/lecture1/neuro_levels.png" width="600" style="float:right"> 
- How does the mind work?
- Most complex and most interesting system humanity has ever studied
    - Why study anything else?
- How should we go about studying it?
    - What techniques/tools?
    - How do we know if we're making progress?
    - How do we deal with the complexity?
A Useful Analogy
<img src="files/lecture1/physics_analogy.png" width="500" style="float:right"> 
- What is Theoretical Neuroscience?
- A useful analogy is to theoretical physics
    - Similarities  
        - Methods are similar
        - Goals are similar (quantification)
    - Differences
        - Central question "What exists? vs Who are we?"
        - More simulation (because of nonlinearities) in biology    
Neural Modelling
Let's build it <img src="files/lecture1/understand.gif" style="float:right">
Specify theory in enough detail that this is possible
Tends to get complex, so need computer simulation
Bring together levels and modeling methods
Single neuron models (levels of detail; e.g. spikes, spatial structure, various ion channels, etc.)
Small network models (levels of detail; e.g. spiking neurons, rate neurons, mean fields, etc.)
Large network/cognitive models (levels of detail; e.g. biophysics, pure computation, anatomy, etc.)
Ideally allow all levels of detail below any higher level to be included as desired.
'Correct' level depends on questions being asked.
Problems with current approaches
Large-scale neural models (e.g. Human Brain Project, Synapse Project, etc.)
Lack of function or behaviour
Can't compare to psychological data
Assumes canonical algorithm repeats
e.g., Measurements from one small part (hippocampus) are valid everywhere
But, different parts of the brain are very different (connectivity, cell types, inputs/outputs)
Expects intelligence to 'emerge'
Unclear what 'emergence' means, how it will work, or what it explains
Wishful thinking?
Cognitve models (e.g. ACT-R, Soar, etc.)
Disconnected from neuroscience, can't compare to neural data
Trying to map components of the model to brain areas
When a component is active, maybe neurons in that area are more active?
No "bridging laws"
Like having rules of chemistry that never mention that it's all built out of atoms and electrons
No constraints on the equations
Just anything that can be written down
Many possibilities; hard to figure out what matches human data best
Maybe that's okay
Do we understand the brain enough to make this connection and constrain theories?
When understanding a word processor, do we worry about transistors?
The Brain
2 kg (2% of body weight)
20 Watts (25% of power consumption)
Area: 4 sheets of paper
Neurons: 100 billion (150,000 per $mm^2$)
End of explanation
from IPython.display import HTML
HTML('<H2>A Neuron</H2><p><iframe src="https://rawgit.com/celiasmith/syde556/master/lecture1/neuron.html" width=825 height=475></iframe>')
Explanation: Brain structures
Lots of visually obvious structure
Lots of greek and latin names to remember
locus coeruleus, thalamus, amygdala, hypothalamus, substantia nigra, etc etc
<img src="files/lecture1/brain1.jpg" width="300" style="float:left">
<img src="files/lecture1/brain2.png" width="300" float:right>
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('F37kuXObIBU', width=720, height=500, start=8*60+35)
Explanation: Neurons in the brain
100 billion
100's or 1000's of distinct types (distinguished via anatomy and/or physiology)
Axon length: from $10^{-4}$ to $5$ m
Each neuron: 500-200,000 inputs and outputs
72km of axons
Communication: 100's of different neurotransmitters
Neuron communication: Synapses
<img src="files/lecture1/NeuronStructure.jpg">
What it really looks like
<img src="files/lecture1/brainbow2.jpg">
What it really really looks like
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('KE952yueVLA', width=640, height=390)
Explanation: Kinds of data from the brain
Lesion studies
What are the effects of damaging different parts of the brain?
Occipital cortex: blindness (really blindsight)
Inferior frontal gyrus: can't speak (Broca's area)
Posterior superior temporal gyrus: can't understand speech (Wernicke's area)
Fusiform gyrus: can't recognize faces (and other visually complex objects)
Ventral medial prefrontal cortex: moral judgement??? (Phineas Gage)
etc, etc, etc
fMRI
Functional Magnetic Resonance Imaging <img src="files/lecture1/fMRI.jpg" style="float:right">
Measure blood oxygenation levels in the brain
show the difference between two tasks
averaged over many trials and patients
Measured while performing tasks
~4 second between scans
some attempts at going faster, but blood vessels don't change much faster than this
Shows where energy is being used in the brain
equivalent to figuring out how a CPU works by measuring temperature
a bit more fine-grained than lesion studies
Good spatial resolution, low temporal resolution
Neurosynth
EEG
Electrical activity at the scalp
Large-scale communication between areas
High time resolution, low spatial resolution
<img src="files/lecture1/eeg-person.jpg" width="200" style="float:left"> 
<img src="files/lecture1/eeg-data.jpg" width="200" style="float:left"> 
<img src="files/lecture1/p300.jpg" width="200" style="float:left">
Single cell recording
Place electrodes (one or many) into the brain, record from it
not necessarily right at a neuron
Pick up local electrical potentials
You can hear neural 'spikes'
High temporal resolution only one (or a few) cells
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('lfNVv0A8QvI', width=640, height=390)
Explanation: <img src="files/lecture1/catgratings.gif" width="400" style="float:left">
Multielectrode recordings
Put 'tetrodes' or multi-electrode arrays into the brain
Post-processing: 
"Spike sorting" 
Local field potentials (LFPs)
High temporal resolution, max ~100 cells
<img src="files/lecture1/lfps.png" width="400" style="float:left"><img src="files/lecture1/multielectrode.jpg" width="300" style="float:right">
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('DGBy-BGiZIM', width=640, height=360)
Explanation: Calcium Imaging
Use calcium to glow when Ca2+ ions bond
Happens a lot during neural activity and spike generation
Good spatial and good temporal resolution
E.g. In a fish embryo
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('CpejbZ-XEyM', width=640, height=360)
Explanation: In a stalking fish
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('v7uRFVR9BPU', width=640, height=390)
Explanation: Optogenetics
Allows stimulation and recording from select parts of the brain
Just those parts expressing a light sensitive proteins that are stimulated
High spatial and temporal resolution (but local)
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('_UFOSHZ22q4', width=600, height=400, start=60)
Explanation: What do we know so far?
Lots of details
Data: "The proportion of type A neurons in area X is Y" 
Conclusion: "Therefore, the proportion of type A neurons in area X is Y".
Hard to get a big picture
No good methods for generalizing from data 
"Data-rich and theory-poor" (Churchland & Sejnowski, 1994; still true)
Need some way to connect these details
Need unifying theory
Recall: Neural Modeling
What I cannot create, I do not understand   <img src="files/lecture1/understand.gif" style="float:right">
Build a computer simulation
Do to neuroscience what Newton did to physics
Too complex to be analytically tractable, so use computer simulation
Can we use this to connect the levels?
Single neuron simulation
Hodgkin & Huxley, 1952
<img src="files/lecture1/hh-neuron1.png" width="600">
Single neuron simulation
Hodgkin & Huxley, 1952
<img src="files/lecture1/hh-neuron2.png" width="600">
Single neuron simulation
<img src="files/lecture1/hh-circuit2.jpg" width="400" style="float:left">
<img src="files/lecture1/hh-circuit.png" width="400" style="float:left">
<img src="files/lecture1/hh-circuit3.gif" width="400" style="float:left">
Millions of neurons
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('WmChhExovzY', width=600, height=400)
Explanation: Billions of neurons
Simplify the neuron model and you can run more of them
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('2j9rRHChtXk', width=640, height=390)
Explanation: The controversy
What level of detail for the neurons?  How should they be connected?
IBM SyNAPSE project (Dharmendra Modha)
Billions of neurons, but very simple models
Randomly connected
2009: "Cat"-scale brain (1 billion neurons)
2012: "Human"-scale brain (500 billion neurons; 5x human!)
Called a "hoax and PR stunt" by:    
Blue Brain (Henry Markram)
Much more detailed neurons
Statistically connected (i.e. similar to hippocampus)
How much detail is enough?
How could we know?
What actually matters...
Connecting brain models to behaviour
How can we build models that actually do something?
How should we connect realistic neurons so they work together?
The Neural Engineering Framework
<img src="files/lecture1/nef_book.png" width="200" style="border:1px solid black; float:right">
Our attempt
Probably wrong, but got to start somewhere
Three principles
Representation
Transformation
Dynamics
Building behaviour out of detailed low-level components
Representation
How do neurons represent information? (What is the neural code?)
What is the mapping between a value to be stored and the activity of a group of neurons?
Examples:
Edge detection in retina
Place cells
Every group of neurons can be thought of as representing something
Each neuron has some preferred value(s)
Neurons fire more strongly the closer the value is to that preferred value
Values are vectors
Transformation
Connections compute functions on those vectors
Activity of one group of neurons causes another group to fire
One group may represent $x$, connected to another group representing $y$
Whatever firing pattern we get in $y$ due to $x$ is a function $y = f(x)$
Can find what class of functions are well approximated this way
Puts limits on the algorithms we can implement with neurons
Dynamics
Recurrent connections (feedback)
Turns out to allow us to compute functions of this form:
${dx \over dt} = f(x, u)$
$x$ is what the neurons represent, $u$ is the input neurons and $f()$ is the transformation
Great for implementing all of control theory (i.e., dynamical systems)
Example:
memory: (${dx \over dt} = u$)
Examples
This approach gives us a neural compiler
Given a quantitative description of a behaviour (e.g. an algorithm), you can solve for the connections between neurons that will approximate that behaviour
Works for a wide variety of neuron models
Number of neurons affects accuracy
Neuron properties influence timing and computation
Can make predictions (e.g. rats head direction and path integration)
Vision: character recognition
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('VWUhCzUDZ70', width=640, height=390)
Explanation: Vision: >1000 categories
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('sUvHCs5y0o8', width=640, height=360)
Explanation: Problem solving: Tower of Hanoi
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('f6Ul5TYK5-o', width=640, height=360)
Explanation: Spaun: digit recognition
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('WNnMhF7rnYo', width=640, height=390)
Explanation: Spaun: copy drawing
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('mP7DX6x9PX8', width=640, height=390)
Explanation: Spaun: addition by counting
End of explanation
from IPython.display import YouTubeVideo
YouTubeVideo('Q_LRvnwnYp8', width=640, height=390)
Explanation: Spaun: pattern completion
End of explanation
<END_TASK>