Rank: 1900 based on 30 downloads (last 30 days) and 3 files submitted
photo

Zacharias Voulgaris

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Zacharias View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
21 Jan 2010 Efficient convertors between binary and decimal numbers Alternatives to the built-in functions bin2dec & dec2bin, exhibiting a somewhat faster performance. Author: Zacharias Voulgaris binary, decimal, conversion 7 2
  • 4.0
4.0 | 1 rating
20 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris unique values, class labels, class vector 6 3
20 Jan 2010 Distance Matrix calculation A compact program for calculating the distances of a group of points, given as rows in a matrix. Author: Zacharias Voulgaris distance calculation, euclidean distance 17 2
  • 2.0
2.0 | 1 rating
Comments and Ratings by Zacharias View all
Updated File Comments Rating
14 Jan 2011 Optimal polynomial fitting Optimal polynomial fitting according to the Akaike's information criterion. Author: Damien Garcia

Very intriguing program, brilliant in its simplicity. It tackles very effectively the over-fitting issue that often appears in various regression scenarios. Also, very easy to use and well documented.

It would be much more practical though if it actually yielded the coefficients of this polynomial (at least have the option to do so). This way the user won't have to run polyfit.m to find them.

03 Mar 2010 Particle Swarm Optimization Toolbox With Trelea, Common, and Clerc types along with ... Author: Brian Birge

I am also interested in discrete PSO for TSP. If anyone has something in Matlab, please contact me. Thanks.

03 Mar 2010 Munkres Assignment Algorithm An efficient implementation of the Munkres algorithm for the assignment problem. Author: Yi Cao

Truly excellent. It has everything you could ask of a Matlab program: good structure, excellent comments, simplicity, flow and efficiency. Thank you for sharing.

21 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris

Thank you for your feedback.

It is true that there are different ways of going about this problem, one of which is using the unique function. However, the whole idea of developing the nc program was to avoid the "unique" function as it is slower. Note that the speed of a function is more accurately measured via the profiler program of Matlab, or through the cputime function.

Comments and Ratings on Zacharias' Files View all
Updated File Comment by Comments Rating
14 Mar 2011 Efficient convertors between binary and decimal numbers Alternatives to the built-in functions bin2dec & dec2bin, exhibiting a somewhat faster performance. Author: Zacharias Voulgaris Ali

More correct version:

function y = d2b(x)

% Convert a decimanl number into a binary array
%
% Similar to dec2bin but yields a numerical array instead of a string and is found to
% be rather faster

if x==1
   y=1;
   return
end

c = ceil(log(x)/log(2)) + 1; % Number of divisions necessary ( rounding up the log2(x) )
y(c) = 0; % Initialize output array
for i = 1:c
    r = floor(x / 2);
    y(c+1-i) = x - 2*r;
    x = r;
end

% If there is a preceding one, remove it.
if(y(1) == 0)
    y(1) = [];
end

30 Sep 2010 Efficient convertors between binary and decimal numbers Alternatives to the built-in functions bin2dec & dec2bin, exhibiting a somewhat faster performance. Author: Zacharias Voulgaris Olmi, Roberto

A little bug for the trivial input value: x=1. Add these lines to fix:
if x==1
   y=1;
   return
end

21 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris Campbell, Rob

Respectfully, I must disagree. Firstly, the Mathworks help makes it clear that tic,toc is to be preferred over cputime. In addition tic, toc provides the same answer as "total time" of the profiler.

I am not sure why you say unique is slower. I just re-wrote your function using it and get a 3x speed up over your code (8s compared to 25s for a vector of length 1e7). The code is much neater and easier to understand and provides the same output:

function [q,Q,C,N] = nc2(O)
Q=unique(O);
q=length(Q);
N=hist(O,Q);

for k=1:length(Q);
    C{k}=find(O==Q(k));
end

As I said earlier, please do correct me if I'm missing something silly. I'm not trying to make pedantic criticisms, just to help!

21 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris Voulgaris, Zacharias

Thank you for your feedback.

It is true that there are different ways of going about this problem, one of which is using the unique function. However, the whole idea of developing the nc program was to avoid the "unique" function as it is slower. Note that the speed of a function is more accurately measured via the profiler program of Matlab, or through the cputime function.

21 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris Campbell, Rob

I will hold off a rating for now...
Nice idea but I have some comments:

- Code is not commented and is rather long for what it does. You could do 90% of this using a call to unique and call to hist (2 lines!). Using your output labels:
q=length(unique(A));
Q=unique(A);
Then:
N=hist(A,unique(A)); %the number in each class
The indecies for each class is the 3rd output of unique. You can either use that as is or turn it into a cell array as you have (C).

- Your code doesn't seem faster to me, it seems about 7 times slower (although without making C, but C may not be necessary). What am I missing?

r=round(randn(1,10e5)*10);
>> tic,[b,i,j]=unique(r);a=hist(r,b);toc
Elapsed time is 0.570190 seconds.
>> tic,nc(r);toc
Elapsed time is 3.543892 seconds.

Top Tags Applied by Zacharias
binary, class labels, class vector, conversion, decimal
Files Tagged by Zacharias View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
21 Jan 2010 Efficient convertors between binary and decimal numbers Alternatives to the built-in functions bin2dec & dec2bin, exhibiting a somewhat faster performance. Author: Zacharias Voulgaris binary, decimal, conversion 7 2
  • 4.0
4.0 | 1 rating
20 Jan 2010 Number of classes A practical tool for finding quickly the classes of a dataset based on the labels array. Author: Zacharias Voulgaris unique values, class labels, class vector 6 3
20 Jan 2010 Distance Matrix calculation A compact program for calculating the distances of a group of points, given as rows in a matrix. Author: Zacharias Voulgaris distance calculation, euclidean distance 17 2
  • 2.0
2.0 | 1 rating

Contact us at files@mathworks.com