{
"metadata": {
"name": "NeuroHW1.ipynb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Neuroscience Homework 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"1) You want to study activity patterns of populations of neurons, and use an approach like that used to study leech decision making. You are interested in activity patterns in sensory areas, and you want to use a ridiculously simple model system. Ultimately you settle on the olfactory system of the single-toed sloth, which has only 2 neurons."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Amazingly you find that these neurons can only fire a single spike, although they\n",
"do so very reliably (maybe that\u2019s why sloths are sloths you think to yourself).\n",
"\n",
"* a) How many odors can this sloth discriminate?\n",
"* b) Sketch a diagram showing how to construct a network of neurons where each neuron is selective for one of the x odors the sloth can discriminate. Activity of those neurons should be the product of the firing rates of the inputs and the synaptic weights (vary between -1 (inhibition) and 1) with which they are connected; if that product is above some threshold the cell fires, if not it\u2019s silent. Even with neurons that just fire a single spike, you should be able to find a set of synaptic weights where each downstream neuron fires uniquely for one of those x odors. How many layers does your network require to achieve your x different outputs?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You next stumble on a sloth with two neurons, but they fire multiple spikes, with\n",
"some trial to trial variability. You will do some simple coding in Python (or Matlab if you wish) to understand this sloth."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Python is a powerful and flexible programming language, created by Guido van Rossum and named after the Monty Python comedy troupe. The core Python language is supplemented by various add-on \"packages\" that provide advanced functionality. We will be making extensive use of three packages here: Numpy, Scipy, and Matplotlib. The \"modules\" provided by these packages turn Python into a powerful scientific computing environment. Numpy provides access to things such as matrix operations and linear algebra. Scipy provides mathematical operations such as integration and also statistical tools. Matplotlib provides an environment for producing elegant plots. \n",
"\n",
"To start off, let's import the Numpy package and the Matplotlib package (for plotting). Use the standard abbreviations 'np' and 'plt'."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* c) Draw 2000 random numbers from a normal (Gaussian) distribution, with mean 6 and standard deviation 1, and plot a histogram of the data with 20 bins."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Back to the sloth. You record the spiking rates (mean \u00b1 SD) of his two neurons\n",
"to 100 presentations of two different odors, Eucalyptus and Fig:\n",
"$$\n",
"\\begin{array}{c|c|c|}\n",
" & \\rm{Eucalyptus} & \\rm{Fig} \\\\\n",
" \\rm{Neuron 1} & 100 \u00b1 10 & 80 \u00b1 10 \\\\\n",
" \\rm{Neuron 2} & 60 \u00b1 10 & 40 \u00b1 10 \\\\\n",
" \\end{array}\n",
"$$ \n",
"Create four vectors representing the responses of these neurons for 100 trials.\n",
"For Neuron1+Eucalyptus you should end up with a variable that\u2019s 100 points long, where the mean of those points is 100 and the SD is 10."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the data. One convenient way is to represent the data as boxplots."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* d) Plot histograms of the Neuron 1 data, both eucalyptus and fig, on the same graph. Do the same for neuron 2."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If the sloth chooses odors based on the activity of one neuron at a time, and he discriminates odors using a thresholding mechanism, where should he place that threshold to most accurately discriminate for Neuron1 & Neuron2? Justify your answer by determining how often the sloth will mis-identify eucalyptus smell as fig (& vice versa) with different thresholds. \n",
"\n",
"* e) Plot the frequency of mis-identifications a function of threshold for Neuron1 & Neuron2. Plot results using 5 different thresholds, including the one you think is 'optimal'. \n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* f) How often would he mis-identify the two odors theoretically at the optimum threshold, given that the neurons show Gaussian variability in their firing? (Hint: we can use the stats.norm.cdf function from Scipy to calculate the cumulative density of a Gaussian distribution. We will have to first load the special \"stats\" subpackage from SciPy)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* g) Plot the 2D response vector i.e. where both neurons contribute to the choice."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* h) How often will the sloth mis-identify the odors under these circumstances?\n",
"\n",
"For this question think in terms of distance between individual points (i.e. individual trials) and the mean response. Use Pythagoras\u2019 theorem to measure that distance for each point and see which mean response it is close to."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# insert code here"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* i) Give an intuitive explanation for why discrimination accuracy is higher in the 2D situation."
]
}
],
"metadata": {}
}
]
}