Feat : k_Medoids Algorithm#251
Merged
siriak merged 2 commits intoTheAlgorithms:masterfrom Oct 25, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a complete implementation of the K-Medoids (PAM) clustering algorithm in R using R6 object-oriented design. K-Medoids is a robust alternative to K-Means that uses actual data points as cluster centers, making it more resistant to outliers.
Key changes:
- Full K-Medoids implementation with support for Euclidean and Manhattan distance metrics
- Comprehensive API including fit(), predict(), silhouette_score(), and helper methods
- Extensive documentation with roxygen2 comments and four detailed usage examples
siriak
approved these changes
Oct 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
K-Medoids (PAM) Algorithm – Summary Review
Overview
K-Medoids (Partitioning Around Medoids) clusters data into k groups using actual data points (medoids) as centers — more robust and interpretable than K-Means, especially against outliers.
Algorithm Summary
Key Traits:
Strengths ✅
fit(),predict(),silhouette_score(),get_medoids()Improvements 🔧
plot_clusters())Complexity
K-Medoids vs K-Means
Use Cases
✅ Customer segmentation
✅ Document clustering
✅ Noisy or mixed data
❌ Avoid for huge or high-dimensional datasets
Testing
Verdict ⭐⭐⭐⭐⭐
Excellent, production-ready implementation — clean, robust, well-documented, and ideal for educational or research use.
Next steps: add optimization, visualization, and CLARA variant for scalability.