K-means clustering implementation on physiological signals data
Show older comments
I need your kind guidance in using K-mean for clustering on physiological signals data. I have 20 signals file, each file has 14 features and the size is different for each file such as 27X14, 22X14 etc. Now i want to give all these files at a time as input to K-mean to generate the clustering. Bit it always create wrong scatterplot for clusters, as can be seen from plot, there is large number of data at 0, which looks wrong to me. I zoomed in this data in another plot to show you all. I tried to reshap my data but still cannot create the right cluster. I am attaching the code which i am using and the scatterplot. I also attached the data file. Please guide me how to do this or is there any other code to do. Looking forward to hearing from you. Thanks


cd 'D:\Research\Classification\final'
labels1=dir('*.csv');
figure
IMF_U = [];
for j =1: length(labels1)
sw = readmatrix(labels1(j).name);
% sw =reshape(sw,[],2);
IMF_U=[IMF_U;sw];
end
IMF_U =reshape(IMF_U,[],2);
[idx,C] = kmeans(IMF_U,3);
gscatter(IMF_U(:,1),IMF_U(:,2),idx,'bgm')
hold on
plot(C(:,1),C(:,2),'kx')
hold off
legend('Cluster 1','Cluster 2','Cluster 3','Centroid')
3 Comments
Image Analyst
on 21 Feb 2023
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
John D'Errico
on 21 Feb 2023
You appear to have some information in your data set that is all zero. And of course, kmeans found it. What would you expect? If you want better help, then you need to provide the data. Attach it as @Image Analyst showed.
Muhammad Hammad Malik
on 21 Feb 2023
Accepted Answer
More Answers (0)
Categories
Find more on k-Means and k-Medoids Clustering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!