raulzito234

A nerd blog about cs

Month: June, 2013

Run Matlab code in csail condor clusters.

So let’s say you write a bunch of matlab code but you have a lot of data to process. You submit your code to some clusters doing the following and the following.

But when you submit your code, it doesn’t run!!! Why? Because you don’t have enough licenses to do it. So instead of crying you can use octave,

If you are using the csail clusters octave v3.0 will be probably installed on the filesystem. But if you need more capabilities (like I do) you will probably need to download and install a new version of octave and then compile it.

 

NOTE: https://lists.cs.wisc.edu/archive/htcondor-users/2010-May/msg00139.shtml

How to Create multiple Condor jobs

If you want to know how to create a single condor job, please follow this post.

My code runs matlab code. To run many jobs I created a script that creates a script per job the name of the script of each single job is matlab.sh.  The following script creates such a script:

#!/bin/sh

bashstring="#!/bin/sh"
prefix="matlab -nodisplay -nodesktop -nosplash -nojvm -r \"SimilarityMeasureWithInput('"
sufix="')\""
FILES=./Fragments/Training/*
for f in $FILES
do
 echo $bashstring$'\n'$prefix$f$sufix >> matlab.sh
 chmod u+x matlab.sh
 condor_submit mat.submit
 rm matlab.sh
done

The above code checks all files under the directory ./Fragments/Training and loops through them, it then prints the content of the concatenated string $bashstring$’\n’$prefix$f$sufix to the file matlab.sh. For example a script file matlab.sh will look like this:


#!/bin/sh

matlab -nodisplay -nodesktop -nosplash -nojvm -r "SimilarityMeasureWithInput('./Fragments/Training/14_2_1.jpg')"

It makes the script file runnable by the user with the command chmod and then submits the job. The submit file is named mat.submit in this case, but it can be named anything. Don’t forget to create the submit file.

Installing OpenNi and Kinect Body Tracker

Follow the instruction here:

http://decyborg.wordpress.com/2013/01/19/kinect-on-os-x-10-8-and-processing/

For coding use the reference page:
http://kinectcar.ronsper.com/docs/openni/introduction.html

When the NITE application finds the hand it prints the following:

Session start: (685.803162,182.640594,2355.797607)
** 2
Point (685.803162,182.640594,2355.797607) -> (487.627411,195.358078,2355.797607)
Point (685.803162,182.640594,2355.797607) -> (487.627411,195.358078,2355.797607)

The number after ** is the number of times that it found the hand since the start of the application.

Is Neymar the best brazilian striker player?

Today Barcelona is unveiling Neymar. They bought him for a very large sum, not only because of his skills because he is an idol in Brazil. His image is very valuable as well.

Neymar

But one question that I was wondering was Is he actually a good soccer player?

So as a Computer Scientist I went ahead and grabbed some stats for the most famous soccer players in Brazil. And also for the rest of the world. I used 2 different metrics from us soccerway. The metrics are goals per minute for Domestic Leagues and National Team.

They are representative of how well they play because each player played a significant amount of minutes on the domestic leagues and for the national team.

Domestic Leagues

DomesticLeagues

According to this list, Hulk unexpectedly is the best, followed by Fred, then Neymar, Pato and Lucas. Hulk might be so ahed because he plays for a Russian team and played for a Portuguese team for quite a while. Both leagues are not known for their competitiveness.

But Fred, Neymar, Pato and Lucas have played quite a while in Brazil. Therefore the rank Fred >> Neymar >> Pato >> Lucas might be very representative of how well they play.
International Cups

International

Again what we see is the rank Fred >> Neymar >> Pato >> Lucas. These numbers show that Hulk is actually not better than the other players but played against weaker teams. Hulk is better than Lucas in both of the measures, but Hulk is a forward player as Lucas is midfielder/winger. Even tough Hulk appears to be the 1st in the rank for domestic cups, he is probably not a good choice for the Brazilian National Team. He was elected as one of the biggest disappointments in the Russian Cup by Life Sports.

Fred is 32% better in the national team stats and 4% better in the domestic league stats, showing that he is better than Neymar in average and therefore is the best brazilian striker player.

But given that Neymar is the 2nd best brazilian striker (excluding Hulk) and is such an iconic figure, Barcelona probably was smart on buying him.

There were other questions that I always had and since I had the numbers in my  hand I was able to answer them. Here they are:

Does Messi play better in Barcelona compared to Argentina?

Let’s look at the numbers again:

Messi

Messi scores a lot of goals compared to any other brazilian player (except Hulk), but when it comes to the National Team he is behind Fred, Neymar and Pato. The team is an important part of how players perform and shouldn’t be  undermined. Actually Messi has 42% of the performance in his National Team (Argentina) compared to the performance he has in Barcelona.

If you look at other players, they do not underperform like Messi does when playing for a national team (Except Hulk). Therefore Messi plays much better for Barcelona compared to Argentina.

Who is the best striker?

Now let’s compare all the best strikers. The metrics used are the same. Here they are:

DomesticLeague

David Villa presents the best numbers for Domestic Leagues. Who would expect that? Messi comes in second place and then Ronaldinho!!! David Villa and Messi perform much better than the rest of the players. Now let’s look at the national teams performance:

NationalTeam

We can notice that David Villa was both 1st and 2nd on both metrics. He is definitely the player that has the biggest average compared to other players. David Villa is the best striker playing nowadays.