views:

255

answers:

4

I have a project in a course at the university that requires various Matlab functions. My version of Matlab is supplied by my workplace, and it doesn't have some of the toolboxes that are required for the project. Is there some repository of such implementations anywhere? I couldn't find anything relevant when I googled.

While my question is general, I'm listing the functions that I need and can't find, since my question is also specific:

  • knnclassify - an implementation of K-nearest neighbors
  • svmclassify - an implementation of Support Vector Machines
  • svmtrain - part of the SVM implementation
  • mapstd - normalizes a matrix to have a mean of 0 and standard deviation of 1

An alternative I'm considering is working in Python with Numpy and Pylab. Are there toolboxes in Pylab that are equivalent to these Matlab functions?

+2  A: 

You could also look at R which is very strong in many data-driven fields, including Machine Learning.

Also of note is the MLOSS directory of open-source machine learning software.

Dirk Eddelbuettel
+3  A: 

You might want to consider getting your own copies of Matlab and the toolboxes you need. Mathworks has VERY attractive pricing for University students.

GNU Octave is the free Matlab more-or-less-work-alike. I don't know how well the toolboxes are covered.

Alternatively, if the assignment needs them, the school probably has them on some lab machines somewhere, and you MIGHT be able to login remotely, using an Xterm of some kind. Ask the TA.

John R. Strohm
Octave actually has some functions that basic MATLAB (without toolboxes) doesn't. I don't remember exactly which functions, but I was mostly working with statistics at the time.
Doresoom
+2  A: 

The first place I would check is the MathWorks File Exchange. There are over 10,000 code submissions from MATLAB users, and you may be able to find alternatives to the various MATLAB toolboxes. Here's something that may be helpful:

Another alternative for a simpler function like MAPSTD is to try and implement a stripped-down version of it yourself. Here's some sample code that replicates the basic behavior of MAPSTD:

M = magic(5);               %# Create an example matrix
rowMeans = mean(M,2);       %# Compute the row means
rowStds = std(M,0,2);       %# Compute the row standard deviations
rowStds(rowStds == 0) = 1;  %# Set standard deviations of 0 to 1
for i = 1:size(M,1)
  M(i,:) = (M(i,:)-rowMeans(i))./rowStds(i);  %# Normalize each row of M
end
%# Or you could avoid the for loop with a vectorized solution...
M = bsxfun(@rdivide,bsxfun(@minus,M,rowMeans),rowStds);

This obviously won't cover all of the options in MAPSTD, but captures the basic functionality. I can confirm that the above code gives the same result as mapstd(M).

gnovice
one correction: in case SD=0 (constant row) you cant divide by zero! instead use: `M = bsxfun(@rdivide,bsxfun(@minus,M,rowMeans),rowStds+(rowStds==0));`
Amro
also an alternate solution would be: `zscore(M')'` or more accurately `zscore(M')'*ystd + ymean` to match the function call `mapstd(M,ymean,ystd)`
Amro
@Amro: Good catch on the standard deviations. I corrected the code to account for that case. I avoided using the function ZSCORE since that is in the Statistics Toolbox, and I wanted to show an example with basic MATLAB.
gnovice
A: 

http://www.sagemath.org/

Sake