필터 지우기
필터 지우기

How do I find cluster center of each cluster gained from Spectral Clustering?

조회 수: 12 (최근 30일)
Riley
Riley 2021년 3월 29일
댓글: Megh 2022년 8월 2일
Hi, I am using Spectral Clustering for data analysis recently and I found that Spectral Clustering function built in MATLAB only returns the cluster indicator (that is, "idx"). However, I actually need the cluster center of each cluster (similar to the centroid locations gained by k-means). How can I get it? Any idea or code would be very helpful.
Regards, Ning
  댓글 수: 2
Image Analyst
Image Analyst 2021년 3월 29일
Attach your data and what you've tried so far. Attach screenshots.
Riley
Riley 2021년 3월 29일
clear
clc
load('xi.mat');
K=100;
[idx]=spectralcluster(xi, K);
Thank you for reminding. This is code and data xi. 'idx' contains cluster indices of each sampling in xi.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2021년 3월 29일
As you have indices in hand, you can get the centers....
clear
clc
load('xi.mat');
K=100;
[idx]=spectralcluster(xi, K);
C = zeros(k,2) ;
for i = 1:k
c = xi(idx==i) ; % this will give cluster
C(i,:) = mean(c) ; % calculate the mean
end
  댓글 수: 2
Riley
Riley 2021년 3월 29일
Thanks for your code and idea. It's not what I exactly want but inspiring me!
Megh
Megh 2022년 8월 2일
I dont think it makes sense to take the mean since the mean is specifially optimized to minimize the euclidean distance from all the points in the given cluster to the cluster center, which turns out to be the mean after differentiating the MSE loss function and setting it to zero, as in k-means.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by