資源簡介
基于密度的一種聚類方法(DBSCAN)源碼 ,里面包含一個簡單易懂的例子,講述了DBSCAN,將簡單的數(shù)據(jù)集進行DBSCAN聚類,最終將聚類的結(jié)果繪制成為圖形化。

代碼片段和文件信息
%
%?Copyright?(c)?2015?Yarpiz?(www.yarpiz.com)
%?All?rights?reserved.?Please?read?the?“l(fā)icense.txt“?for?license?terms.
%
%?Project?Code:?YPML110
%?Project?title:?Implementation?of?DBSCAN?Clustering?in?MATLAB
%?Publisher:?Yarpiz?(www.yarpiz.com)
%?
%?Developer:?S.?Mostapha?Kalami?Heris?(Member?of?Yarpiz?Team)
%?
%?Contact?Info:?sm.kalami@gmail.com?info@yarpiz.com
%
function?[IDX?isnoise]=DBSCAN(XepsilonMinPts)
????C=0;
????
????n=size(X1);
????IDX=zeros(n1);
????
????D=pdist2(XX);
????
????visited=false(n1);
????isnoise=false(n1);
????
????for?i=1:n
????????if?~visited(i)
????????????visited(i)=true;
????????????
????????????Neighbors=RegionQuery(i);
????????????if?numel(Neighbors) ????????????????%?X(i:)?is?NOISE
????????????????isnoise(i)=true;
????????????else
????????????????C=C+1;
????????????????ExpandCluster(iNeighborsC);
????????????end
????????????
????????end
????
????end
????
????function?ExpandCluster(iNeighborsC)
????????IDX(i)=C;
????????
????????k?=?1;
????????while?true
????????????j?=?Neighbors(k);
????????????
????????????if?~visited(j)
????????????????visited(j)=true;
????????????????Neighbors2=RegionQuery(j);
????????????????if?numel(Neighbors2)>=MinPts
????????????????????Neighbors=[Neighbors?Neighbors2];???%#ok
????????????????end
????????????end
????????????if?IDX(j)==0
????????????????IDX(j)=C;
????????????end
????????????
????????????k?=?k?+?1;
????????????if?k?>?numel(Neighbors)
????????????????break;
????????????end
????????end
????end
????
????function?Neighbors=RegionQuery(i)
????????Neighbors=find(D(i:)<=epsilon);
????end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1677??2018-05-13?15:09??DBSCAN?Clustering\DBSCAN?Clustering\DBSCAN.m
?????文件???????1350??2015-08-23?04:39??DBSCAN?Clustering\DBSCAN?Clustering\license.txt
?????文件????????707??2015-09-07?01:04??DBSCAN?Clustering\DBSCAN?Clustering\main.m
?????文件??????15713??2013-09-12?21:48??DBSCAN?Clustering\DBSCAN?Clustering\mydata.mat
?????文件???????1149??2015-09-07?01:04??DBSCAN?Clustering\DBSCAN?Clustering\PlotClusterinResult.m
?????文件????????121??2015-08-23?04:35??DBSCAN?Clustering\DBSCAN?Clustering\www.yarpiz.com.url
?????文件???????1350??2015-08-23?04:39??DBSCAN?Clustering\license.txt
?????文件????????121??2015-08-23?04:35??DBSCAN?Clustering\www.yarpiz.com.url
?????目錄??????????0??2018-04-25?15:41??DBSCAN?Clustering\DBSCAN?Clustering
?????目錄??????????0??2018-04-25?15:41??DBSCAN?Clustering
-----------?---------??----------?-----??----
????????????????22188????????????????????10
評論
共有 條評論