Clustering with dbscan in 3d

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 commentaires

jeffs
jeffs le 6 Juin 2017
i have tried this before and by using this i get following error:
>> [IDX, isnoise]=DBSCAN(binarydata,0.5,10)
Warning: Converting non-floating point data to double. > In pdist2 (line 219) In DBSCAN (line 8) Error using ' Transpose on ND array is not defined. Use PERMUTE instead.
Error in pdist2 (line 343) D = pdist2mex(X',Y',dist,additionalArg,smallestLargestFlag,radius);
Error in DBSCAN (line 8) D=pdist2(X,X);
KSSV
KSSV le 6 Juin 2017
This error can be sorted...can you tell class of your image and what version you are using?
jeffs
jeffs le 6 Juin 2017
data typ is: 154x135x131 logical
>> version
ans =
9.1.0.441655 (R2016b)
jeffs
jeffs le 6 Juin 2017
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()..

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 6 Juin 2017

0 votes

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 commentaires

jeffs
jeffs le 6 Juin 2017
can you please be more specific on this special case? how to convert my 3d matrix into 2d?
Walter Roberson
Walter Roberson le 6 Juin 2017
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 le 7 Juin 2017
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?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Centre d'aide et File Exchange

Question posée :

le 6 Juin 2017

Commenté :

le 7 Juin 2017

Community Treasure Hunt

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

Start Hunting!

Translated by