Homework 2 (110 points)

Submit on Canvas by Tuesday 10/11/22 at 11:43 PM. Ask questions and discuss on Piazza. Have fun!

Problem 1

Properties of the Poisson Random Processes (30 points)

Action potential waveforms from multiple neurons can be recorded on a single electrode. Imagine that exactly two neurons are contributing spikes to the signal you are recording. Each neuron is spiking independently according to a Poisson process with rate λ1 and λ2, respectively.

  1. The raw spike train recorded on the electrode is a Poisson process. Show that the raw spike train has an exponential ISI distribution.
  2. What is the rate of raw spike train Poisson process?
  3. What is the probability probability that each neuron will spike once within the same 1 ms interval?

x
Congrats you found my easter egg!

Problem 2

Point Process Model Validation (40 points)

We can describe the number of spikes a neuron produces in a one second window using a wide variety of random process models. Let's refer to the parameters of a given model as θ, and a set of neural counts as n. We can evaluate the quality of the model by asking for which model/parameters the likelihood of the data, P(θ∣n), is maximized. In this problem you will try to determine the model for the spikes from a synthetic neuron.

  1. Look at the data in the numpy data file hw2problem2A.npy. This file contains two variables, SpikeTimes and SpikeCounts. SpikeTimes is a list of spike times recorded in one experimental trial (each trial is 1 s for simplicity) from a neuron. For each trial, for convenience, the number of spikes is provided in the corresponding element of SpikeCount . You can load the data into Python using the following:
    import numpy as np
    [SpikeTimes, SpikeCount] = np.load("hw2problem2a.npy")
    Note that you can find the MATLAB format hw2problem2a.mat. Consider two possible models for the number of spikes per trail as per the table below.

    Model Parameters
    Gaussian Mean = 10.2, Variance = 9.5
    Poisson Rate = 9.8

    Using the data provided evaluate which set of parameters best describes the data. Click for hint!

  2. Now split the data into training and validation sets, use the training sets to train a Gaussian model and a Poisson model, and use the validation set to assess which model fits the data best Click for hint!

  3. Point Processes. Consider the actual spike times from a (given in the SpikeTimes list). If you were to model this neuron with a Poisson process, would you use a constant or a time-varying rate over the 1 second window? Justify your answer with one or more plots. Click for hint!

  4. Fano Factor / ISI Distribution. Consider the spike times returned by a different neuron (npy, mat). The data structure is identical to the neuron from part a so loading the data is the same code but with a new filename.

    If you were to model this neuron with a Poisson process would you use a constant or time-varying rate? Do the variance and mean of the count distribution have the relationship you would expect for a Poisson Process? What physiological process might you observe in the spike times that would explain your answer to the previous inquiry? Click for hint!

x
You should calculate the likelihood of each model. In other words, calculate the probability of, e.g., data from 1000 trials of the simulated data given one model or the other?
x
You should use the maximum likelihood estimate for the parameters of the models, which will be the sample mean and variance of the training data for the Gaussian and the sample mean for the Poisson.
x
The plot of the fake data in the IPad notes was used to evaluate poisson models
x
You’ll want to actually look at the spike times. Generating a peri-stimulus time histogram (PSTH) showing the average number of spikes in small bins of time will help explain your observations.

Problem 3

Describing Real Data (40 points)

        .__....._             _.....__,
        .": o :':         ;': o :".
        `. `-' .'.       .'. `-' .'
          `---'             `---'

_...----...      ...   ...      ...----..._
.-'__..-""'----    `.  `"`  .'    ----'""-..__`-.
'.-'   _.--"""'       `-._.-'       '"""--._   `-.`
'  .-"'                  :                  `"-.  `
'   `.              _.'"'._              .'   `
    `.       ,.-'"       "'-.,       .'
      `.                           .'
        `-._                   _.-'
            `"'--...___...--'"`
    

Here, we will characterize the neural activity recorded on a multielectrode array in a kitty's visual cortex available at hw2problem3.npy or hw2problem3.mat. Spike times in (microseconds) for 10 neurons are given in spiketimes, a 10 element numpy array, where each element is a numpy vector of spiketimes. The time-varying stimulus is described in the stimulus numpy array, where the first column is timestamps (regularly sampled at 5 ms) and the second column is the direction of motion (in degrees) of a moving bar. Stimulus directions are randomized, each direction is maintained for 4 s, and directions are repeated 8 times. You can load the data into Python as follows:

import numpy as np
[stimulus, spiketimes] = np.load('hw2problem3.npy')
  1. Neural activity in the visual cortex was recorded while the cat (meow) was viewing drifting bars (like in the Hubel and Weisel video shown in class) that cycled through different angles. Plot the "tuning curve" for the activity of the 10th neuron, show how the mean number of spikes varies as a function of the moving bar. Does this neuron have one "preferred direction"? Why might the directional tuning curve be shaped the way it is? Click for hint!

  2. Calculate the tuning curves for all the neurons. Plot a histogram of the "preferred direction" (i.e., direction of stimulus which produces the maximum average spiking) of the neurons. Plot a histogram of the "maximum firing rate" (i.e., the average firing rate for the preferred direction).

  3. Select the neuron with the largest maximum firing rate. For each stimulus direction calculate the mean spiking rate and variance from this mean in the number of spikes observed in one stimulus presentation. Calculate the fano factor for each stimulus direction and compare to what is expected for a Poisson process. Repeat for the neuron with the largest average (i.e., across all directions) firing rate.

  4. For the neurons in part c, create ISI distributions for spikes during stimuli in the preferred direction. Compare this to the ISI distribution expected under a Poisson approximation.

  5. (Extra Credit) For the neurons in part (c), use the time-rescaling theorem to renormalize the ISIs for all stimulus directions (i.e., assuming a piece-wise constant inhomogeneous Poisson process). Plot the resulting ISI distribution. Conduct a goodness-of-fit test on the spikes. Is the piece-wise Poisson model a good one?

x
The x-axis of the plot should be stimulus direction and the y-axis should be “average spikes per second”.
🤔Might there be some sort of symmetry for opposite directions?🤔