PDA

View Full Version : my first MATLAB assignment: statistics!


ime_NY
2006-06-19, 17:46
Hi all,

So I just got MATLAB to work on my iBook, and I've spent the day dealing with matrices and arrays. I think I’ve done a good job so far in getting over my inherent fear of programming. Now my boss has given me a nice assignment, which , of course, will go over my head seeing that this is my first attempt in trying to understand a programming ap. Any help and insight will be greatly appreciated.

Our experiment is based on visual displays of faces, and my assignment is to compile some statistics based on our raters' subjective opinion of these faces, which were scored from 1 (really, really don't like) to 10 (really, really like). There's 500 total facial pictures. The ratings are in a "ratings" directory, and the pictures are in a "pictures" directory. Here's the three easiest questions of the assignment:

a.) Write a program that figures out and displays the 30 highest, the
30 lowest, and the 30 average/middle images.

b.) Write a program that displays the one picture that a rater rated more highly than the average of the raters; conversely, create a program that displays the one picture that a rater rated much lower when compared to the mean rating.

c.) create a program that does all of the above BUT instead uses z-scores to
do all calculations.


just to show you the breadth of understanding after my first day, the most fancy computation I've done for an individual rater is displaying the ID numbers for each of the 10 rating intervals; i.e., I showed that one rater had rated six pictures as "10" with:

>> find (scores==10)

which then gave me a vector of six ID #s in order from 1-500.

Even though these are the three easiest questions of the assignment, my head hurts thinking about this, so i'm going back to tackle it at the Command Window.

Any insights or help will greatly appreciated.

Thanks in advance.

Anonymous Coward
2006-06-19, 18:12
The user's guide that came with the program is good. It's better than most other introductory books that are available for this program.

What version of Matlab did you get?

Are you writing programs yet (.m script files)?

Depending on how short of time you get, you probably can find script files that other people have written and made available.

I am guessing you don't want to spend any more than you have to, but it might be interesting to look and see what kind of supplementary packages that Mathworks has for sale (i.e., statistical packages, etc.). If you look hard enough, you will probably find the same functionality that other people have written and made available for free.

ime_NY
2006-06-19, 20:28
Anonymous Coward,

I started working with the manual and a book called "Getting Started with Matlab 7" by Pratap. I'll be making my own .m files, and I actually ordered the stats toolbox. So I'm waiting for its arrival.

Anonymous Coward
2006-06-21, 13:15
Don't wait for the stats package to start!

The stats package doesn't add any more functionality to Matlab. What I mean is that Mathworks has just done some of the programming for you.

So, what you might do is try to program some function and then when you get the stats package, compare what you did with what the Mathworks programmers did.

But, since you're just beginning, perhaps that isn't really good advice. Anyway, when you get the stats package, it should be just a collection of new functions you can use right out of the box, but also you can look at the code for programming ideas. (You can do that right now, if you have the basic Matlab program.)

sebatlh
2006-06-22, 07:53
a.) Write a program that figures out and displays the 30 highest, the
30 lowest, and the 30 average/middle images.

I'm not sure what you mean by directory, but if you have the ratings in vectors or in a matrix you could take a mean over the ratings for each picture. Do a 'help mean' to make sure that you take the mean in the right 'direction' (rows/colums) if you have them in a matrix.
Then you could use sort on the resulting vector to sort the scores and picking the 30 highest rating would simply mean picking the last (or first, depending on how you sort them) 30. Sort will give you an index on how it sorted the vector. Use that to pick the right pictures. I.e take the last 30 elements of the indexvector to get the picture-number.
Check 'help sort' for the details. :)


b.) Write a program that displays the one picture that a rater rated more highly than the average of the raters; conversely, create a program that displays the one picture that a rater rated much lower when compared to the mean rating.


I guess you could do something like
find (max(meanRating - theRating) == theRating)
to find out the highest deviation from the mean for one specific persons ratings.
I don't know anything about displaying pictures though.

More tips:
Always use .m files, even if the file is only like 4 lines. Saves you a lot of retyping :)

If you can figure out a way to do it with pen and paper, you can program it! It will be difficult in the beginning because you don't know the language. But figure out what you want to do and then use the help function to find out how it is written. The key is to break up the problem into small simple pieces that you can turn into code.

Good luck :)