here is my code of DBSCAN algorithm
codes.
function cluster = dbscan(iris, Eps, MinPts)Eps=0.04;MinPts=4;cluster = zeros(size(iris,1),1);classcounter = 0;doLoop = 1;while(doLoop) classcounter = classcounter + 1; notClassified = find(cluster == 0); if(sum(notClassified) == 0) doLoop = 0; else cluster(notClassified(1)) = classcounter; cluster = dbrec(notClassified(1), iris, Eps, MinPts, cluster); end endantal(max(cluster)) = 0;for i = 1:size(iris,1) antal(cluster(i)) = antal(cluster(i)) + 1;endtemp = find(antal < 3);for i = 1:size(temp,2) cluster(find(cluster == temp(i))) = 0;endsave cluster;
for dbrec function
function cluster = dbrec(pIdx, M, Eps, MinPts, cluster)for i=1:size(M,1) if(norm(M(i,:) - M(pIdx,:)) < Eps && cluster(i) == 0) cluster(i) = cluster(pIdx); cluster = dbrec(pIdx, M, Eps, MinPts, cluster); endend
I use a data file which is 4.5lakh values*5 .When i run the code I get Matlab Recurssion limit error. When i change the recurssion limit to 1000 or 2000 i get the same error and when i set it to 2500 the simulation goes on ffor the whole day without results.
I am in a catch 22 situation please help
with regards, mani
Best Answer