# Difference between revisions of "VS265: Homework assignments Fall2012"

### From RedwoodCenter

(→Assignments) |
(→Assignments) |
||

Line 66: | Line 66: | ||

* [http://redwood.berkeley.edu/vs265/lab4/eigmovie.txt eigmovie.py] | * [http://redwood.berkeley.edu/vs265/lab4/eigmovie.txt eigmovie.py] | ||

− | * [http://redwood.berkeley.edu/vs265/sols/hw3-08.pdf Solutions.pdf] This is a solution from a previous version of this class that is really well written. | + | <!-- * [http://redwood.berkeley.edu/vs265/sols/hw3-08.pdf Solutions.pdf] This is a solution from a previous version of this class that is really well written. --> |

==== Lab #5, due Monday, Oct 15 at beginning of class ==== | ==== Lab #5, due Monday, Oct 15 at beginning of class ==== | ||

Line 73: | Line 73: | ||

* [http://redwood.berkeley.edu/vs265/sparsenet_class_scripts.zip sparsenet scripts (zip)] | * [http://redwood.berkeley.edu/vs265/sparsenet_class_scripts.zip sparsenet scripts (zip)] | ||

* You will also need the following set of whitened natural movie images: [https://redwood.berkeley.edu/bruno/sparsenet/IMAGES.mat IMAGES.mat] | * You will also need the following set of whitened natural movie images: [https://redwood.berkeley.edu/bruno/sparsenet/IMAGES.mat IMAGES.mat] | ||

− | * Solutions [http://redwood.berkeley.edu/w/images/4/41/Hw5_sol_scripts.zip Scripts] [http://redwood.berkeley.edu/w/images/b/b4/Lab5_soln.pdf Writeup] | + | <!-- * Solutions [http://redwood.berkeley.edu/w/images/4/41/Hw5_sol_scripts.zip Scripts] [http://redwood.berkeley.edu/w/images/b/b4/Lab5_soln.pdf Writeup] --> |

==== Lab #6, due Wednesday, Oct 24 at beginning of class ==== | ==== Lab #6, due Wednesday, Oct 24 at beginning of class ==== | ||

Line 83: | Line 83: | ||

* [http://redwood.berkeley.edu/vs265/lab6/kohonen.txt kohonen.py] | * [http://redwood.berkeley.edu/vs265/lab6/kohonen.txt kohonen.py] | ||

* [http://redwood.berkeley.edu/vs265/lab6/showrfs.txt showrfs.py] | * [http://redwood.berkeley.edu/vs265/lab6/showrfs.txt showrfs.py] | ||

− | [http://redwood.berkeley.edu/w/images/8/8c/Solution6.pdf Solution] | + | <!-- [http://redwood.berkeley.edu/w/images/8/8c/Solution6.pdf Solution] --> |

==== Lab #7, due Wednesday, Oct 31 at beginning of class ==== | ==== Lab #7, due Wednesday, Oct 31 at beginning of class ==== | ||

Line 102: | Line 102: | ||

face,hi,X = [p[k].reshape(10,10).T.reshape(100,1) for k in 'face','hi','X'] | 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 | # line above converts Fortran to C ordering | ||

− | * Solutions: The outer product rule to calculate V is given by X*X' + face*face' + hi*hi'; * | + | <!-- * Solutions: The outer product rule to calculate V is given by X*X' + face*face' + hi*hi'; * |

[http://redwood.berkeley.edu/w/images/d/d1/Abbott_ps7.pdf Writeup] | [http://redwood.berkeley.edu/w/images/d/d1/Abbott_ps7.pdf Writeup] | ||

− | [http://redwood.berkeley.edu/w/images/2/29/Scripts.zip Scripts] | + | [http://redwood.berkeley.edu/w/images/2/29/Scripts.zip Scripts] --> |

==== Lab #8, due Wednesday, Nov. 14 at beginning of class ==== | ==== Lab #8, due Wednesday, Nov. 14 at beginning of class ==== | ||

Line 114: | Line 114: | ||

* [http://redwood.berkeley.edu/vs265/mog/X2.mat X2.mat] | * [http://redwood.berkeley.edu/vs265/mog/X2.mat X2.mat] | ||

* [http://redwood.berkeley.edu/vs265/mog/X2_v6.mat X2_v6.mat] (version 6) | * [http://redwood.berkeley.edu/vs265/mog/X2_v6.mat X2_v6.mat] (version 6) | ||

− | * [http://redwood.berkeley.edu/w/images/f/fc/Hw8_solution.pdf Solution] | + | <!-- * [http://redwood.berkeley.edu/w/images/f/fc/Hw8_solution.pdf Solution] --> |

==== Lab #9 (optional), due Monday, Nov. 26 at beginning of class ==== | ==== Lab #9 (optional), due Monday, Nov. 26 at beginning of class ==== | ||

Line 130: | Line 130: | ||

''Python code:'' | ''Python code:'' | ||

− | * [http://redwood.berkeley.edu/vs265/lab9/boltz.txt boltz.py] - python version of the above code with solution. | + | <!-- * [http://redwood.berkeley.edu/vs265/lab9/boltz.txt boltz.py] - python version of the above code with solution. |

− | * [http://redwood.berkeley.edu/w/images/9/9c/Lab9_soln.pdf Writeup with code] | + | * [http://redwood.berkeley.edu/w/images/9/9c/Lab9_soln.pdf Writeup with code] --> |

==== Lab #10 (optional), due Monday, Dec. 3 at beginning of class ==== | ==== Lab #10 (optional), due Monday, Dec. 3 at beginning of class ==== | ||

Line 141: | Line 141: | ||

* [http://redwood.berkeley.edu/vs265/ica/showbfs.m showbfs.m] | * [http://redwood.berkeley.edu/vs265/ica/showbfs.m showbfs.m] | ||

* [http://redwood.berkeley.edu/vs265/ica/IMAGES.mat IMAGES.mat] | * [http://redwood.berkeley.edu/vs265/ica/IMAGES.mat IMAGES.mat] | ||

− | * [http://redwood.berkeley.edu/w/images/9/99/Lab10_soln.pdf Solution] | + | <!-- * [http://redwood.berkeley.edu/w/images/9/99/Lab10_soln.pdf Solution] --> |

## Latest revision as of 04:14, 19 September 2014

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 Wednesday, September 5th at beginning of class
- 2.2 Lab #2, due Wednesday, September 19th at beginning of class
- 2.3 Lab #3, due Wednesday, Sept. 26 at beginning of class
- 2.4 Lab #4, due Thursday, October 4 at 9:00
- 2.5 Lab #5, due Monday, Oct 15 at beginning of class
- 2.6 Lab #6, due Wednesday, Oct 24 at beginning of class
- 2.7 Lab #7, due Wednesday, Oct 31 at beginning of class
- 2.8 Lab #8, due Wednesday, Nov. 14 at beginning of class
- 2.9 Lab #9 (optional), due Monday, Nov. 26 at beginning of class
- 2.10 Lab #10 (optional), due Monday, Dec. 3 at beginning of class

# 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.

# Assignments

#### Lab #1, due Wednesday, September 5th at beginning of class

#### Lab #2, due Wednesday, September 19th 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']

#### Lab #3, due Wednesday, Sept. 26 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']

#### Lab #4, due Thursday, October 4 at 9:00

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

#### Lab #5, due Monday, Oct 15 at beginning of class

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

#### Lab #6, due Wednesday, Oct 24 at beginning of class

*Python code:*

#### Lab #7, due Wednesday, Oct 31 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

#### Lab #8, due Wednesday, Nov. 14 at beginning of class

#### Lab #9 (optional), due Monday, Nov. 26 at beginning of class

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

*Python code:*