Nonlinear Receptive Fields
Below we provide source code implementing the Volterra relevant-space technique and simulated data to test its functionality. The code runs on R, an environment for statistical computing and graphics. To test the Volterra relevant-space technique, follow the next steps.
- Download R from http://www.r-project.org/.
- Install R. The installation is extremely easy, but if necessary check the installation instructons.
- Download the Volterra relevant-space technique source code (save this file in a working directory with the name vrstFunctions.R).
- Download the simulated data and driver script.
- Simple cell: images (56 M), responses, and driver script (save these file in the working directory with the names xSC.dat, ySC_5spi.dat and doDemoSC.R, respectively).
- Complex cell: images (56 M), responses, and driver script (save these file in the working directory with the names xCC.dat, yCC_5spi.dat and doDemoCC.R, respectively).
- Run R from the working directory where the source code and data were downloaded.
For Windows: change the 'Start in' field property of the shortcut used to lunch R. In this field put the name of the working directory. To start R in the working directory double click on the shortcut.
For Linux: cd to the working directory and type R.
For Mac: it should be something similar, but I have not try it, yet. - Finally in the command window of R, type:
- source("doDemoSC.R"), to use the simple cell data.
- source("doDemoCC.R"), to use the complex cell data.
- The driver script will display a figure containing a plot of cross-correlation coefficients between predictions and responses, as a function of the order of the Volterra model. This figure will also show the two relevant dimensions estimated by PPR.


- If you want to use other data, create a first ASCII tabular file with one image per row and a second ASCII file with the cell responses. Then copy demoSC.R to demoYourCell.R. In demoYourCell.R replace xSC.dat by the name of your images file, and replace ySC_5spi.dat by the name of your responses file. Finally, in the R command window type source("doDemoYourCell.R").
In our studies, we obtained best results when the images were coded by zero mean numbers in the range [-1,1]. Images do not need to be whitened or weighted according to their corresponding responses, as opposed to spike triggered techniques. - To make the code easier to understand and more expedient, it does not include the multiple steps of averaging discussed in the paper.
- The core of the code appears in the two functions shown below (to see a function definition in R just type the function name). Note that, after the relevant dimensions have been estimated, the Volterra relevant-space technique only involves linear operations. Specifically, to estimate the coefficients of the low-dimensional Volterra model the function estimateCoefsTruncatedPInv first projects the images in the estimated relevant dimensions, then builds the data matrix, and finally solves the linear Volterra equation. After the coefficients of the low-dimensional Volterra model have been estimated, the function estimateVolterraModelsWithRDsWithOrder reconstructs the Volterra kernels.
estimateCoefsTruncatedPInv <- function(x, y, rds, order) {
# project stimuli in relevant dimensions
px <- x%*%rds
# build data matrix of Volterra linear equation
dataMatrix <- buildDataMatrix(px=px, order=order, nRDs=ncol(rds))
# solve the Volterra linear equation
coefs <- solveTruncatedPInv(x=dataMatrix, y=y)
return(coefs)
}estimateVolterraModel <- function(x, y, rds, order) {
# estimate coefficients of the low-dimensional Volterra problem
coefs <- estimateCoefsTruncatedPInv(x=x, y=y, rds=rds, order=order)
# reconstruct the first and second order kernels
k1 <- getK1FromCoefsAndRDs(coefs=coefs, rds=rds)
k2 <- getK2FromCoefsAndRDs(coefs=coefs, rds=rds)
return(list(coefs=coefs, k1=k1, k2=k2))
} - If you need help processing your data contact Joaquín Rapela.
