- kmedoids: https://www.mathworks.com/help/releases/R2021a/stats/kmedoids.html
- pdist2: https://www.mathworks.com/help/releases/R2021a/stats/pdist2.html
- Kmeans algorithm for mixed features: https://www.mathworks.com/matlabcentral/fileexchange/53489-amjams-mixed_kmeans
k medoid with heterogene data( numerik,binar ,nominal)
1 view (last 30 days)
Show older comments
i have a matrix data(nominal und numerik) D(suppose that 3 nominal value,2 numerik value ) und i wat to use k medoid . which distance will be used in k medoid??
idx=k-medoids(D,4,'distance',@(x,y) pdist2(x(:,1:3),y(:,1:3),'hamming')+pdist2(X(:,(4:5),Y(:4,5),'euclidean'))
its korrekt?
0 Comments
Answers (1)
Prasanna
on 28 Feb 2025
Hi Peka,
It is my understanding that you are trying to apply the k-medoids clustering algorithm to a dataset that contains both nominal and numeric data. To perform the same, ensure that the input data numeric matrix to the ‘kmedoids’ function is numeric data where the rows of X correspond to observations, and the columns correspond to variables.
Your approach to use a custom distance function that combines Hamming and Euclidean distances is a reasonable way to handle mixed data types. Here, Hamming distance can be used for nominal data and Euclidian distance can be used for numeric data.
For more information regarding the above, refer to the following documentations:
Hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!