# Homework #2: Neural Encoding Models

(Due Date: Sunday May 5, 2013 before midnight)

`Submission Procedure:`
`Create a Zip file called "528-hw2-lastname-firstname" containing the following:`
`(1) Document with write-up containing your answers to any questions asked in each exercise, as well as any figures, plots, or graphs supporting your answers,`
`(2) Your Matlab program files,`
`(3) Any other supporting material needed to understand/run your solutions in Matlab.`
` `
`Upload your Zip file to this dropbox.`
` `
`Upload your file by 11:59pm Sunday, May 5, 2013. `
`Late submission policy is here.`
` `

Like Homework #1, this homework is based on the ﬂy H1 neuron dataset c1p8.mat described in exercise 8 of Chapter 1 in the Dayan and Abbott book: http://www.gatsby.ucl.ac.uk/~dayan/book/exercises.html

Download the c1p8.mat dataset from the link above (if you don’t have the dataset already from Homework #1) and solve the two problems below using Matlab (or Octave).

1.    (50 points) (Imitate the H1 neuron!) Set aside the last 20% of the H1 neuron data as “test data” and recompute the spike-triggered average for the rest of the data (the “training data”). Construct a linear kernel from this average and use it in Equation 2.1 of the textbook to construct a model of the response of the H1 neuron. Choose r0 so that the average firing rate predicted by the model in response to the stimulus used for the training data matches the actual average firing rate. Use a Poisson generator to generate a synthetic spike train from the linear estimate of the firing rate in response to the stimulus in the test data. Plot examples of the actual and synthetic spike trains for portions of the test data stimulus. How well does your model predict the arrival times of spikes? Try to quantify the overall performance of your model on the test data.

2.    (50 points) (H1 Eigenfun!) Compute the covariance matrix and its eigenmodes for the H1 neuron data above and make a scatter plot of the projections of the spike-triggered stimuli onto the two leading eigenmodes.  Find the threshold (nonlinear decision) functions as defined in class, both with respect to the two leading eigenmodes separately, and jointly, i.e., the two-dimensional threshold function.  Can the two-dimensional distribution of projections be approximated by the product of the one-dimensional distributions (i.e., do the two features contribute independently?).

`     Suggested background reading: Lecture slides and the paper by Arcas, Fairhall, and Bialek on the class website:`
`     http://www.cs.washington.edu/education/courses/528/13sp/AgueraFairhallBialek2001.pdf `
`      For this problem, assume all spikes are “isolated” (in the terminology of the paper) and use all spikes for your analysis.`

` `
` `