Difference between revisions of "VS265: Homework assignments Fall2010"

From RedwoodCenter
Jump to navigationJump to search
 
(19 intermediate revisions by 2 users not shown)
Line 30: Line 30:
 
   In [3]: X,O = d['X'],d['O']
 
   In [3]: X,O = d['X'],d['O']
  
* Solutions: [http://redwood.berkeley.edu/vs265/soln1-2010.pdf pdf] [http://redwood.berkeley.edu/vs265/lab1.txt lab1.py] [http://redwood.berkeley.edu/vs265/lab1-08.m lab1.m (from '08)]  
+
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/soln1-2010.pdf pdf] [http://redwood.berkeley.edu/vs265/lab1.txt lab1.py] [http://redwood.berkeley.edu/vs265/lab1-08.m lab1.m (from '08)] -->
  
 
==== Lab #2, due Tuesday, Sep 21 at beginning of class ====
 
==== Lab #2, due Tuesday, Sep 21 at beginning of class ====
Line 47: Line 47:
 
   Out[3]: ['oranges2', 'apples2', 'apples', 'oranges']
 
   Out[3]: ['oranges2', 'apples2', 'apples', 'oranges']
  
<!--* Solutions: [http://redwood.berkeley.edu/amir/vs298/soln2-08.pdf pdf] [http://redwood.berkeley.edu/amir/vs298/soln2.zip zip'd Matlab code]-->
+
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/sols/soln2-08.pdf pdf] (ignore self grading instructions) [http://redwood.berkeley.edu/vs265/sols/soln2.zip zip'd Matlab code] -->
  
 
==== Lab #3, due Tuesday, September 28 at beginning of class ====
 
==== Lab #3, due Tuesday, September 28 at beginning of class ====
Line 56: Line 56:
 
* [http://redwood.berkeley.edu/vs265/lab3/hebb.m hebb.m]
 
* [http://redwood.berkeley.edu/vs265/lab3/hebb.m hebb.m]
 
* [http://redwood.berkeley.edu/vs265/lab3/eigmovie.m eigmovie.m]
 
* [http://redwood.berkeley.edu/vs265/lab3/eigmovie.m eigmovie.m]
<!--* Solutions: [http://redwood.berkeley.edu/amir/vs298/hw3-08.pdf pdf] [http://redwood.berkeley.edu/amir/vs298/hw3-08.zip zip'd Matlab code]. For self-grading, each question is worth 3 points.-->
+
 
 +
''For Python you can use ''
 +
* [http://redwood.berkeley.edu/vs265/lab3/data2d.npz data2d.npz] (see previous assignments above for how to read this in)
 +
* [http://redwood.berkeley.edu/vs265/lab3/faces2.npz faces2.npz]
 +
* [http://redwood.berkeley.edu/vs265/lab3/hebb.txt hebb.py]
 +
* [http://redwood.berkeley.edu/vs265/lab3/eigmovie.txt eigmovie.py]
 +
 
 +
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/sols/hw3-08.pdf pdf] [http://redwood.berkeley.edu/vs265/sols/hw3-08.zip zip'd Matlab code]. For self-grading, each question is worth 3 points. -->
 +
 
 +
==== Lab #4, due Tuesday, Oct 5 at beginning of class ====
 +
* [http://redwood.berkeley.edu/vs265/lab4.pdf lab4]
 +
* [http://redwood.berkeley.edu/vs265/foldiak_class_scripts.zip foldiak 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]
 +
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/sols/sol4-08.pdf pdf] -->
 +
 
 +
==== Lab #5 due Tuesday, Oct 12 at beginning of class ====
 +
* [http://redwood.berkeley.edu/vs265/lab5.pdf lab5]
 +
* [http://redwood.berkeley.edu/vs265/lab5/kohonen.m kohonen.m]
 +
* [http://redwood.berkeley.edu/vs265/lab5/showrfs.m showrfs.m]
 +
 
 +
''Python code:''
 +
* [http://redwood.berkeley.edu/vs265/lab5/kohonen.txt kohonen.py]
 +
* [http://redwood.berkeley.edu/vs265/lab5/showrfs.txt showrfs.py]
 +
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/sols/soln5-08.pdf pdf] [http://redwood.berkeley.edu/vs265/sols/lab5.zip zip'd Matlab code] -->
 +
 
 +
==== Lab #6 (Due Tuesday, Oct 26 at beginning of class) ====
 +
* [http://redwood.berkeley.edu/vs265/lab6.pdf lab6.pdf]
 +
* [http://redwood.berkeley.edu/vs265/lab6.zip zip'd Matlab files]
 +
* [http://redwood.berkeley.edu/vs265/lab6/genpat.m genpat.m]
 +
* [http://redwood.berkeley.edu/vs265/lab6/hopnet.m hopnet.m]
 +
* [http://redwood.berkeley.edu/vs265/lab6/patterns.mat patterns.mat]
 +
* [http://redwood.berkeley.edu/vs265/lab6/corrupt.m corrupt.m]
 +
 
 +
''Python code:''
 +
* [http://redwood.berkeley.edu/vs265/lab6/hopnet.txt hopnet.py] - python version of the above code as one file (with run, genpat, and corrupt methods)
 +
* [http://redwood.berkeley.edu/vs265/lab6/patterns.npz 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: <!-- [http://redwood.berkeley.edu/vs265/sols/sol6-08.pdf pdf] -->
 +
 
 +
==== Lab #7 (Due Tuesday, Nov. 2) ====
 +
* [http://redwood.berkeley.edu/vs265/lab7.pdf lab7.pdf]
 +
* [http://redwood.berkeley.edu/vs265/mog/mog.m mog.m]
 +
* [http://redwood.berkeley.edu/vs265/mog/show_mog.m show_mog.m]
 +
* [http://redwood.berkeley.edu/vs265/mog/X1.mat X1.mat]
 +
* [http://redwood.berkeley.edu/vs265/mog/X1_v6.mat X1_v6.mat] (version 6)
 +
* [http://redwood.berkeley.edu/vs265/mog/X2.mat X2.mat]
 +
* [http://redwood.berkeley.edu/vs265/mog/X2_v6.mat X2_v6.mat] (version 6)
 +
 
 +
==== Lab #8 (Due Thursday, Nov. 11) ====
 +
* [http://redwood.berkeley.edu/vs265/lab8.pdf lab8.pdf]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/scribble.mat scribble.mat]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/scribble_v6.mat scribble_v6.mat] (version 6)
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/extract_patches.m extract_patches.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/prob.m prob.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/show_patches.m show_patches.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/boltz.m boltz.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/sample.m sample.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/draw.m draw.m]
 +
* [http://redwood.berkeley.edu/amir/vs298/boltz/sigmoid.m sigmoid.m]
 +
 
 +
''Python code:''
 +
* [http://redwood.berkeley.edu/vs265/lab8/boltz.txt boltz.py] - python version of the above code.
 +
 
 +
==== Lab #9 (Due Tuesday, Nov. 23) ====
 +
 
 +
* [http://redwood.berkeley.edu/vs265/lab9.pdf lab9.pdf]
 +
* [http://redwood.berkeley.edu/vs265/ica/ica.m ica.m]
 +
* [http://redwood.berkeley.edu/vs265/ica/test_data.mat test_data.mat]
 +
* [http://redwood.berkeley.edu/vs265/ica/ica2.m ica2.m]
 +
* [http://redwood.berkeley.edu/vs265/ica/extract_patches.m extract_patches.m]
 +
* [http://redwood.berkeley.edu/vs265/ica/showbfs.m showbfs.m]
 +
* [http://redwood.berkeley.edu/vs265/ica/IMAGES.mat IMAGES.mat]
 +
<!-- * Solutions: Thanks to Chung-Hay from our 2006 class [http://redwood.berkeley.edu/amir/vs298/soln8.pdf pdf]-->

Latest revision as of 23:41, 28 August 2012

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.

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

  • Solutions:

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

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

Python code:

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)

Python code:

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

Lab #9 (Due Tuesday, Nov. 23)