CNV: Assignment 1


4pm Thursday, 28 February 2013.


In this assignment, you will explore simulations for the development of retinotopy and the function of an orientation map.

You are strongly encouraged to work in pairs of your choosing, in which case you should submit one copy of the assignment, listing your partner, and the mark will be allocated equally to each. Please note, however, that pairs are expected to work on each part together, helping each other understand and figure things out, NOT dividing up the sections to be done separately. Dividing most of the work rather than working jointly will be considered scholastic dishonesty, with the appropriate corresponding penalties.

The assignment uses the Topographica simulator. For this course, we have installed Topographica in /group/teaching/cnv/topographica. To make it simple to run this copy of Topographica as "topographica", you should add that location to your path (e.g. for the current terminal by doing export PATH=/group/teaching/cnv/topographica:${PATH}, or you can add it permanently).

The same version (0.9.8) can be installed on your home machine if you wish, by following the instructions at If you run into problems on your private machine, please file a bug request as described at, but bear in mind that we can only officially provide support for the version installed on DICE.

Part 1: SOM retinotopy

First, follow the online SOM Retinotopy tutorial instructions for steps 1-10 on a DICE machine, developing a basic SOM map for retinotopy.

  1. As described in step 11, try varying these parameters:

    Random set of weight patterns
    Initial neighborhood radius
    Initial learning rate
    Retina density

    re-running the simulation each time, in order to be able to answer these questions about each of these four parameters:

    1. What is the effect of varying the parameter?
    2. How sensitive is SOM to that parameter? If there are changes, are they dramatic, or relatively minor? Explain.
    3. Explain why the behavior you observe occurs, referring to specific equations (by number) in chapter 3 of the CMVC text, or to the Euclidean distance activation function from the class notes.

    Note that you usually won't need to run all the way to 40000 iterations to see what's happening, as it should be clear by about 10000 iterations whether it is going to organize properly or not. Also note that changing any density effectively also changes the weight_seed, because the number and thus pattern of weights will differ for different sizes.

  2. Make a copy of the som_retinotopy.ty file. Add these lines somewhere before input_pattern:

    import random
    def xfn():
       return random.gauss(0,0.2)
    def yfn():
       if (random.uniform(0,1)>0.5):
           return random.gauss(-0.25,0.1)
           return random.gauss(+0.25,0.1)
    and replace the lines specifying x and y in the input_pattern with:
        x = xfn
        y = yfn

    Here random.uniform returns a uniform random number in the given range, while random.gauss returns a normally distributed (i.e., Gaussian) random number with the given (mean,stddev). What topographic grid pattern do you expect the SOM to develop in this case? Describe and briefly justify your expectations. Please do this part before the next question; what's important is that you try to reason out what the network will do, not that your prediction actually matches what you find in practice. Your mark will be based on how you are reasoning about it, not on whether what you expect to occur does happen.

  3. Try self-organizing using the different input distribution. Is it developing as you expected? If not, what is different? Do the parameters need to be changed to give a good representation for this type of input? If so, determine which one(s), and re-run the simulation. In either case, include a screenshot of a sample Center of Gravity grid plot from your final organized network, in .png or .pdf format.

The overall goal of this part is to demonstrate that you understand how the SOM algorithm works, and particularly how the behavior is determined by the parameters and the distribution of input patterns, so be sure to make this clear in your responses.

Part 2: Self-organized Gaussian OR map

First, follow the tutorial instructions at /group/teaching/cnv/topographica/doc/Tutorials/lissom_oo_or.html on a DICE machine, testing a LISSOM map self-organized on oriented Gaussians. A snapshot of the already-organized map is in /group/teaching/cnv/topographica/examples/lissom_oo_or_10000.typ, though if you wish to organize your own map on your own copy you can follow those instructions on the tutorial (if you obtained your own copy of Topographica you may have to first copy the lissom_oo_or.ty file from models/lissom_oo_or.ty to examples/lissom_oo_or.ty).

  1. For a Line stimulus, systematically vary the following input parameters and observe the V1 response (and LGN response, if appropriate):

    Brightness of the line
    Brightness of the background
    vertical location of the line
    Orientation of the line
    line thickness
    edge smoothing

    After varying each parameter, reset the values to the defaults using the button in the Test Pattern window, to ensure that the effect of each parameter is considered separately. For each parameter, report your observations on how the LISSOM map responds:

    1. Is the value of that parameter encoded in a useful way in the map activity? Explain.
    2. How sensitive is LISSOM to that parameter? If there are changes, are they dramatic, or relatively minor? Explain.
    3. Do you think the LISSOM response is biologically realistic, based on the biological background presented in this course? Why or why not?
    4. Explain why the behavior you observe occurs, referring to specific equations (by number) in chapter 4 of the CMVC text, and to the self-organized Projection plots.

    Note that when varying the scale or offset, it is very easy to get confused by the plots. The bitmaps in Topographica generally plot a range from 0.0 to 1.0 as colors black to white, with all values below 0.0 appearing black, and all values above 1.0 appearing white. With a large enough scale or offset, the onscreen plot will appear to be solid white, obscuring the actual pattern seen by the network. In such cases, you can select Normalize=Individually to see the pattern, but then changes in the scale are often entirely invisible. Even so, it should be clear enough as long as you keep these limitations in mind. You can also always right-click on the plots and select "Plot with axis labels" in a submenu to see a version with a scale bar.

  2. Explain why the LGNOnAfferent weights to V1 neurons in the Projection plot look very similar to each other, yet very different from the LGNOffAfferent weights to V1. What effect will this have on the ability to respond to lines that are brighter than the mean luminance? What effect will it have for darker lines? What does this indicate about the suitability of the chosen training pattern as a model for natural images?
  3. For any of the cases where you argued that the behavior was not biologically realistic, compare the LISSOM results to those from a model we recently developed called GCAL (in examples/gcal.ty). A snapshot of the already-organized map is in /group/teaching/cnv/topographica/examples/gcal_10000.typ. Does GCAL provide more realistic results? Can you see any obvious problems?

    For the purposes of this assignment, you can just treat the trained GCAL map as the same as LISSOM except for adding contrast gain control (similar to the afferent normalization discussed in the text), but if you want to see more about GCAL it is described in the Law et al. EDI-INF-RR-1404 tech report.

Preparing your assignment

Although your assignment need not be as polished as a publication, the guidelines described in Topographica's section on generating high-quality figures can be helpful. For instance, instead of awkwardly grabbing screenshots, you can save plots using Python commands like:


Here Projection can be anything from the Plots menu or its submenus, such as Activity or Orientation Preference (in either of which cases leave off the projection= parameter).

The output will go into ~/Documents/Topographica/ by default; you can change the directory by setting param.normalize_path.prefix to another value.

Alternatively, you can keep track of things by making an arbitrary string show up in all your filenames, if you do"whatever-suffix-you-like" after you load your first script. That changes the default prefix from e.g. som_retinotopy to som_retinotopywhatever-suffix-you-like. Example usage:

DICE> cd ~
DICE> mkdir cnv
DICE> cp /group/teaching/cnv/topographica/examples/tiny.ty cnv/
DICE> /group/teaching/cnv/topographica/topographica -g cnv/tiny.ty
topo_t0.0000_c1>>> import os,param
topo_t0.0000_c2>>> param.normalize_path.prefix=os.getenv("HOME")+"/cnv"
topo_t1.0000_c4>>> save_plotgroup("Activity")
topo_t1.0000_c5>>> !ls cnv
tiny_000001.00_Retina_Activity.png  tiny_000001.00_V1_Activity.png tiny.ty
topo_t1.0000_c8>>> save_plotgroup("Activity")
topo_t1.0000_c9>>> !ls cnv
tiny_000001.00_Retina_Activity.png tinysuffix_000001.00_Retina_Activity.png
tiny_000001.00_V1_Activity.png     tinysuffix_000001.00_V1_Activity.png     tiny.ty

If you want to have such commands run every time you start topographica, you can copy the file /group/teaching/cnv/topographica/sample_.topographicarc to ~/.topographicarc in your home directory, editing it as necessary.

If you care to get into it, there is a command called run_batch (see that does this automatically, making it simple to override parameters, run a set of analyses at a list of specified iterations, and automatically put the parameter changes into every filename.

I myself would use run_batch, but not everyone will probably want to learn that much Python for this assignment! If you do, I recommend working through the Python tutorials available from the course web page.


Your work must be submitted by the deadline using the submit command on Informatics DICE machines (type man submit for more details). To allow me to work with these files efficiently, you must follow these guidelines:

  1. Submit only one PDF file, named asst1.pdf.
  2. On the first page, include the student ID number(s) for any student who worked on this assignment.
  3. Do not include the names of any students anywhere in the document, to allow anonymous marking.
  4. Each problem (1.1, 1.2, 1.3, 2.1, 2.2, and 2.3) must be on a separate page; otherwise I am very likely to miss bits that you'll want me to count towards a particular problem.

Standard late policies will apply as described in your course guide, namely that late coursework is not accepted without good reason, which must be discussed with the ITO, not the lecturer. Similarly, standard academic misconduct policies apply as described in the University guidelines; in particular; students must clearly label any aspect of their submission that is not their own independent work (or that of their named partner).

Example of submit command:

submit cnv 1 asst1.pdf

Tips for getting a good mark

Be sure that you provide evidence that you did each part of this assignment. I can only judge what is actually submitted, so you should make sure that the files you submit make it clear that you have done everything, and thought about everything.

Be sure to cite any information that you use that is not from the course material or your own experience. Including such information is encouraged, but it must be properly cited. You can use the CMVC book Bibliography database for citation information for any paper cited in the CMVC text.

Submissions MUST use PDF, so that I can be sure to be able to read them and so that I can process all submissions from all students uniformly. Other formats like .doc or .sxw have a certain probability of working, but the probability is far from 1.0, and they cause a lot of problems. Naming and formatting the files as I require will make my job a lot easier and will make sure you get credit for everything you do, because I will be able to see exactly what you are submitting for each problem.

Please read and follow my list of writing tips.

Last update: assignment1.html,v 1.6 2014/01/26 23:21:30 jbednar Exp

Home : Teaching : Courses : Cnv : 2012-2013 : Coursework 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail:
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh