Computational Intelligence

Computer Vision Assignment One (Programming meta-assignment)

Due: Tuesday, March 22

The purpose of this assignment is ensure that those who are rusty with programming have the skills needed for the next assignment. You can do this assignment as a group, but I highly recommend that those who who do not program on a regular basis attempt the assignment alone, getting help from the group as needed.

  1. Acquire access to Matlab. Matlab is available under windows in the open CCIT lab in ECE 206, UA CS linux machines, and, apparently on the PC's and Macs in the library. The CS linux machines can be accessed remotely, and (also technically remotely) from the lab in GS 228.

    Under linux Matlab is started using the command "matlab". There is both a GUI and an non-GUI interface. The GUI requires that X-windows is working properly, and is a bit slow. The non-GUI version can be started up with: "matlab -nodisplay -nojm". If your DISPLAY variable is not set correctly, you will get the non-GUI version by default.

    Recommend machines to use are cy01, cy02, cy03, ..., cy10. To use onto these remotely, you will have to login to lectura first (lectura.cs.arizona.edu), and then ssh from there. Matlab is NOT available on lecture itself.

    If you are having trouble, get support from your group. If you are still having trouble, E-mail kobus@cs.arizona.edu. Start early to leave time for iterating over problems and don't beat your head against the wall!

  2. Become familiar with Matlab.

    Read this short Matlab tutorial and be aware of this longer Matlab primer. Google can be used to find other tutorials.

    The complete documentation for Matlab is also available on the web. All Matlab commands are well documented with Matlab's help system. For example, if you want to know how the svd function works, type help svd. You can also get help on all the built in operators and even the language itself. Typing help gives a list of help topics.

    Tip: You may want to turn on paging (more on) for reading help pages.
    Tip: Often you want to put a semicolon at the end of your directives to Matlab. The semicolon at the end of a line prevents Matlab from displaying the result of an expression.

  3. Reading a file of numbers.

    Download this file into your working directory and read it into matlab matrix x with:

        x = load('data_a1_1.txt') 
    
  4. Computing mean and sample standard error.

    Compute the mean and the sample standard error of each column of the matrix x.

    Too easy? For those who program all the time: Can your solution be easily modified for the case that the amount of data (the number of rows in the matrix) is too big to fit in memory and/or all you can do is read the rows of x one at a time, and you can only read them once (i.e. no rewind)?

  5. Computing weighted mean and sample standard error

    The previous calculation assumed that each data point was equally important. When doing probabilistic calculations, we want to deal with quantities in accordance with the probability that we believe them. Those probabilities become weights which we use to multiply the effect of each point. The weights (like probabilities) should sum to one.

    For this exercise, compute the same quantities as in the previous question, but weight each row by the row number. Thus row 1 gets weight 1, row 2 gets weight 2, etc. Of course, the weights as stated do not add up to one. You need to deal with this.

    If this is giving you trouble, after a fair attempt, click here for a hint.

  6. Optional. Matlab is very useful as a calculator, and for testing out your "ideas" about the results of calculations. The directive:

        x=rand(4)
    

    gives you a random matrix with entries between 0 and 1. The directive:

        y=x'
    
    Computes the transpose of x. Finally, to invert x:

        z = inv(x)
    

    Generate a random matrix and compute the different of these two quantities:

        the inverse of the transpose
        the transpose of the inverse
    

    thereby reminding yourself of the fact that they are the same, quicker than you might be able to find it in a text or prove it.

What to Hand In

E-mail me (kobus@cs.arizona.edu) the mean and the sample standard errors for the data file, both as is, and with the weights specified.