Add new distance function to NCTool

1 view (last 30 days)
Ali Ml
Ali Ml on 19 Aug 2013
How can I have add the jaccard distance measure in nctool I have added Jacdist.m file to the following path
MATLAB\R2008b\toolbox\nnet\nnet\nndistance
Jacdist.m source code
function d = jacdist(pos) %JACCARD Summary of this function goes here % Detailed explanation goes here fn = mfilename; if (nargin < 1), error('NNET:Arguments','Not enough arguments.'); end if ischar(pos) switch(pos) case 'name' d = 'Jaccard Distance'; otherwise, error('NNET:Arguments',['Unrecognized code: ''' pos '''']) end return end
[dims,s] = size(pos);
d = zeros(s,s);
for i=1:s
for j=1:(i-1)
d(i,j) = pdist([pos(:,i) pos(:,j)],'jaccard');
end
end
d = min(d(i,:));
Then added new distance function name to newsom.m (if nargin < 4, dfcn = 'jacdist'; end) at following path
MATLAB\R2008b\toolbox\nnet\nnet\nnnetwork
But clustering is not performed correctly, for simple cluster dataset

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!