# VS265: Homework assignments Fall2010

### From RedwoodCenter

Students are encouraged to work in groups, but turn in assignments *individually*, listing the group members they worked with.

**Submission instructions**:
email both a PDF of your solutions as well as your code (.m or .py files) as attachments to:

rctn.org vs265 (vs265 should be out front)

You can hand in a paper copy of your solutions before class, but you still have to email your code to the address above before the assignment is due.

## Contents

- 1 Resources
- 2 Assignments
- 2.1 Lab #1, due Thursday, September 9th at beginning of class
- 2.2 Lab #2, due Tuesday, Sep 21 at beginning of class
- 2.3 Lab #3, due Tuesday, September 28 at beginning of class
- 2.4 Lab #4, due Tuesday, Oct 5 at beginning of class
- 2.5 Lab #5 due Tuesday, Oct 12 at beginning of class
- 2.6 Lab #6 (Due Tuesday, Oct 26 at beginning of class)
- 2.7 Lab #7 (Due Tuesday, Nov. 2)
- 2.8 Lab #8 (Due Thursday, Nov. 11)
- 2.9 Lab #9 (Due Tuesday, Nov. 23)

# Resources

## Matlab

Amir, the past GSI for the course says "There is a guide to Matlab on the web by Kevin Murphy which is really excellent. I think it would be great for the VS265 students: http://code.google.com/p/yagtom/"

## Python

Fernando Perez at the Brain Imaging Center has an *excellent* set of resources on Python for scientific computing. You will likely find the "Starter Kit" particularly useful.

Additionally, Josh Bloom (Astronomy) is teaching a Science Research Computing with Python course this semester (on Mondays 2-5pm in Hearst 310, Fall 2010, CCN 06180) which you might want to take. A Python Boot Camp kicked-off that class, and has a lot of accessible introductory material.

# Assignments

#### Lab #1, due Thursday, September 9th at beginning of class

*for Python: either ...*

In [1]: import scipy.io In [2]: d = scipy.io.loadmat("data.mat") In [3]: X,O = d['X'],d['O']

*or use data.npz*

In [1]: import numpy as np In [2]: d = np.load('data.npz') In [3]: X,O = d['X'],d['O']

- Solutions:

#### Lab #2, due Tuesday, Sep 21 at beginning of class

*For Python you can use apples-oranges.npz*

In [1]: import numpy as np In [2]: d = np.load('apples-oranges.npz') In [3]: d.keys() Out[3]: ['oranges2', 'apples2', 'apples', 'oranges']

- Solutions:

#### Lab #3, due Tuesday, September 28 at beginning of class

Matlab code are as separate files below.

*For Python you can use *

- data2d.npz (see previous assignments above for how to read this in)
- faces2.npz
- hebb.py
- eigmovie.py

- Solutions:

#### Lab #4, due Tuesday, Oct 5 at beginning of class

- lab4
- foldiak scripts (zip)
- sparsenet scripts (zip)
- You will also need the following set of whitened natural movie images: IMAGES.mat
- Solutions:

#### Lab #5 due Tuesday, Oct 12 at beginning of class

*Python code:*

- kohonen.py
- showrfs.py
- Solutions:

#### Lab #6 (Due Tuesday, Oct 26 at beginning of class)

*Python code:*

- hopnet.py - python version of the above code as one file (with run, genpat, and corrupt methods)
- patterns.npz

p = np.load('patterns.npz') face,hi,X = p['face'], p['hi'], p['X']

# if you load patterns.mat, use: p = scipy.io.loadmat("patterns.mat") face,hi,X = [p[k].reshape(10,10).T.reshape(100,1) for k in 'face','hi','X'] # line above converts Fortran to C ordering

- Solutions:

#### Lab #7 (Due Tuesday, Nov. 2)

#### Lab #8 (Due Thursday, Nov. 11)

- lab8.pdf
- scribble.mat
- scribble_v6.mat (version 6)
- extract_patches.m
- prob.m
- show_patches.m
- boltz.m
- sample.m
- draw.m
- sigmoid.m

*Python code:*

- boltz.py - python version of the above code.