Clustering with dbscan in 3d

14 次查看(过去 30 天)
jeffs
jeffs 2017-6-6
评论: jeffs 2017-6-7
hello community
i am trying to cluster a 3d binary matrix (size: 150x131x134) because there are separeted groups of data structure. i used kmeans(X) before and in some cases there is a good output, but only for data sets which contain less than 4 cluster structures. my matrix will contain up to 8 separate data structures and the kmeans is unefficient then because there is a high dependence on inital conditions in some cases it cuts a data structure in half. now i found another cluster algorithm: dbscan; but i couldnt find any implementation which works in 3d in matlab too.
any idea where i can get a good dbscan algorithm implementation in matlab?
  5 个评论
jeffs
jeffs 2017-6-6
data typ is: 154x135x131 logical
>> version
ans =
9.1.0.441655 (R2016b)
jeffs
jeffs 2017-6-6
by turning it from logical to single i get following error:
>> [IDX, isnoise]=dbscanKopie(versuch,0.5,10)
Error using pdist2 (line 136) N-D arrays are not supported.
Error in dbscanKopie (line 21) D=pdist2(X,X);
it seems like there is some problem in pdist2()..

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2017-6-6
You need to convert your data to vector or to 2D with one "point" per row. The "distance" measure used expects each row to be a separate sample, and is not able to find distances for 3D.
  3 个评论
Walter Roberson
Walter Roberson 2017-6-6
You have not really indicated what you want to cluster on. Each of your values is either 0 or 1, so if you cluster on the value you would be obtaining at most two clusters. Are you looking for rows that have some relationship, or columns that have some relationship, or pages that have some relationship?
My suspicion is that you should be considering bwconncomp to find the parts that are contiguous.
jeffs
jeffs 2017-6-7
CC =
Connectivity: 26
ImageSize: [154 135 131]
NumObjects: 5
PixelIdxList: {1x5 cell}
>> CC.PixelIdxList
ans =
Columns 1 through 3
[1936x1 double] [1210x1 double] [3264x1 double]
Columns 4 through 5
[1664x1 double] [1394x1 double]
after bwconncom() i get this result. with the kmeans algorithm i got the same cluster structure with same size of each structure. is bwconncom() also working when i have a data set where two clusters can overlap? now there is a set of cell arrays containing the linear indices of the pixels in the kth object. but how to implement this in dbscan?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by