Clustering/sorting of close data points

10 次查看(过去 30 天)
Hello all,
I would like to bundle up some close data points. This is how my data looks like: 214981 366893 455877 455877 455877 455878 889359 889359 1443570 1443570........
Can anybody suggest an easy way to do this?
Thanks.
Raju
  6 个评论
Raju Kumar
Raju Kumar 2022-7-11
编辑:Raju Kumar 2022-7-11
Thanks for your reply. How would you consider 'tol' for the following data if I want to sort out two or more close values?
sortedData =uniquetool(Data, tol?) % Data = [214981 366893 455877 455877 455877 455878..]
Raju
Walter Roberson
Walter Roberson 2022-7-11
Consider for example your value 455877 : what is the minimum and maximum value that you wish to be considered to be the same group as 455877, if those values were encountered as data?
Consider also 214981: what is the minimum and maximum value that you wish to be considered to be the same group as 214981, if those values were encountered as data?
I ask about two different values because the boundary for higher values might not have the same range as for lower value. For example in [1 8 25] the 8 might be considered to be relatively far from the "1" (since it is 8 times the value), whereas by the time you got to 200000, the value 200010 might be considered "close" to 200000 since the difference is pretty small relative to the value.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2022-7-11
编辑:Image Analyst 2022-7-12
This is really too broad a question to answer yet. You haven't even plotted your data or told us what "close" is. I suggest you start by reading this page:
Maybe you can simply take the histogram.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
This is how I'd classify your data. Basically you can do it manually for such few data points. For far more data points, you can try the Classification Learner App on the apps tab of the tool ribbon. Even for these few, it looks like SVM might be good. But please attach far more data so we can find the best classifier.
data = [214981 366893 455877 455877 455877 455878 889359 889359 1443570 1443570]';
classes = [1,1,1,1,1,1,2,2,3,3]';
plot(data, 'b.', 'MarkerSize', 30);
grid on;
  2 个评论
Raju Kumar
Raju Kumar 2022-7-12
编辑:Raju Kumar 2022-7-12
Thanks for your lead and information. Here is the data file. I basically want to group or number them whenever they are close (by increasing the counting eg. 1,2, 3...etc where number 1 should be assigned to first close numbers and number 2 should be assigned to second close numbers and so on).
Raju
Image Analyst
Image Analyst 2022-7-12
Exactly how are you seeing clusters in that data?
s = load('raju.mat')
s = struct with fields:
ToA: [26182×1 double]
toa = s.ToA;
classes = [1,1,1,1,1,1,2,2,3,3]';
plot(toa, 'b.', 'MarkerSize', 10);
grid on;
xlabel('Index of Vector')
ylabel('Value of toa')

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by