VS265: Homework assignments Fall2012: Difference between revisions

From RedwoodCenter
Jump to navigationJump to search
Line 82: Line 82:
* [http://redwood.berkeley.edu/vs265/lab6/showrfs.txt showrfs.py]
* [http://redwood.berkeley.edu/vs265/lab6/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] -->
* Solutions: <!-- [http://redwood.berkeley.edu/vs265/sols/soln5-08.pdf pdf] [http://redwood.berkeley.edu/vs265/sols/lab5.zip zip'd Matlab code] -->
==== Lab #7, due Wednesday, Oct 31 at beginning of class ====
* [http://redwood.berkeley.edu/vs265/lab7.pdf lab7.pdf]
* [http://redwood.berkeley.edu/vs265/lab7.zip zip'd Matlab files]
* [http://redwood.berkeley.edu/vs265/lab7/genpat.m genpat.m]
* [http://redwood.berkeley.edu/vs265/lab7/hopnet.m hopnet.m]
* [http://redwood.berkeley.edu/vs265/lab7/patterns.mat patterns.mat]
* [http://redwood.berkeley.edu/vs265/lab7/corrupt.m corrupt.m]
''Python code:''
* [http://redwood.berkeley.edu/vs265/lab7/hopnet.txt hopnet.py] - python version of the above code as one file (with run, genpat, and corrupt methods)
* [http://redwood.berkeley.edu/vs265/lab7/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] -->

Revision as of 05:52, 24 October 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.

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

  • 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 #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
  • Solutions: