Skip to main content

K-Means Clustering Algorithm and K-Medoids clustering

K-Means Clustering Algorithm and K-Medoids clustering

K-Means Clustering Algorithm 

K-Means Clustering is an unsupervised learning algorithm that is used to solve the clustering problems in machine learning or data science. In this topic, we will learn what is K-means clustering algorithm, how the algorithm works, along with the Python implementation of k-means clustering.

What is K-Means Algorithm?

K-Means Clustering is an Unsupervised Learning algorithm, which groups the unlabeled dataset into different clusters. Here K defines the number of pre-defined clusters that need to be created in the process, as if K=2, there will be two clusters, and for K=3, there will be three clusters, and so on.

It is an iterative algorithm that divides the unlabeled dataset into k different clusters in such a way that each dataset belongs only one group that has similar properties.

It is a centroid-based algorithm, where each cluster is associated with a centroid. The main aim of this algorithm is to minimize the sum of distances between the data point and their corresponding clusters.

The algorithm takes the unlabeled dataset as input, divides the dataset into k-number of clusters, and repeats the process until it does not find the best clusters. The value of k should be predetermined in this algorithm.

The k-means clustering algorithm mainly performs two tasks:

-Determines the best value for K center points or centroids by an iterative process.

-Assigns each data point to its closest k-center. Those data points which are near to the particular k-center, create a cluster.

Hence each cluster has data points with some commonalities, and it is away from other clusters. 

The below diagram explains the working of the K-means Clustering Algorithm:

K-Medoids clustering-

K-Medoids and K-Means are two types of clustering mechanisms in Partition Clustering. First, Clustering is the process of breaking down an abstract group of data points/ objects into classes of similar objects such that all the objects in one cluster have similar traits. , a group of n objects is broken down into k number of clusters based on their similarities.

Two statisticians, Leonard Kaufman, and Peter J. Rousseeuw came up with this method. This tutorial explains what K-Medoids do, their applications, and the difference between K-Means and K-Medoids.

K-medoids is an unsupervised method with unlabelled data to be clustered. It is an improvised version of the K-Means algorithm mainly designed to deal with outlier data sensitivity. Compared to other partitioning algorithms, the algorithm is simple, fast, and easy to implement.

K-Medoids:

Medoid: A Medoid is a point in the cluster from which the sum of distances to other data points is minimal.

(or)

A Medoid is a point in the cluster from which dissimilarities with all the other points in the clusters are minimal.

Instead of centroids as reference points in K-Means algorithms, the K-Medoids algorithm takes a Medoid as a reference point.

There are three types of algorithms for K-Medoids Clustering:

1.PAM (Partitioning Around Clustering)

2.CLARA (Clustering Large Applications)

3.CLARANS (Randomized Clustering Large Applications)

Comments

Popular posts from this blog

Why Laravel Framework is the Most Popular PHP Framework in 2025

Laravel In 2025, Laravel continues to be the most popular PHP framework among developers and students alike. Its ease of use, advanced features, and strong community support make it ideal for building modern web applications. Here’s why Laravel stands out: 1. Easy to Learn and Use Laravel is beginner-friendly and has a simple, readable syntax, making it ideal for students and new developers. Unlike other PHP frameworks, you don’t need extensive experience to start building projects. With clear structure and step-by-step documentation, Laravel allows developers to quickly learn the framework while practicing real-world web development skills. 2. MVC Architecture for Organized Development Laravel follows the Model-View-Controller (MVC) architecture , which separates application logic from presentation. This structure makes coding organized, easier to maintain, and scalable for large projects. For students, learning MVC in Laravel helps understand professional ...

The Latest Popular Programming Languages in the IT Sector & Their Salary Packages (2025)

Popular Programming Languages in 2025 The IT industry is rapidly evolving in 2025, driven by emerging technologies that transform the way businesses build, automate, and innovate. Programming languages play a vital role in this digital revolution, powering everything from web and mobile development to artificial intelligence and cloud computing. The most popular programming languages in today’s IT sector stand out for their versatility, scalability, and strong developer communities. With increasing global demand, mastering top languages such as Python, Java, JavaScript, C++, and emerging frameworks ensures excellent career growth and competitive salary packages across software development, data science, and IT engineering roles. 1. Python Python stands as the most versatile and beginner-friendly language, widely used in data science, artificial intelligence (AI), machine learning (ML), automation, and web development . Its simple syntax and powerful libraries like Pandas, ...

Data Mining And Basic Data Mining Task

Data Mining And Basic Data Mining Task Data Mining Basic Task Data Mining- In industry lots of data available in business,science or any type of industry. Firstly that all data and daily transaction saved in operational database.in that operation database all data saved related with day to day transaction. Data warehouse collect data from operational data warehouse and save successfully.In data warehouse gives only important data from operational database.if operational database contains 100 transaction then in data warehouse gives a 95 transactions from operational database. Data mining basically coming from KDD (knowledge discovery database) concept.Data mining is only part of KDD process. Data mining used from selecting data from data warehouse and show that data to user with with graphical formation like pi chart,bar chart ,diagram etc. Data mining select a important data from data warehouse with user requirement and show that data to user wi...