Unsupervised Machine Learning: Algorithms, Types & Example

โšก Smart Summary

Unsupervised Learning is a machine learning technique that works on unlabeled data, letting the model discover structure on its own through clustering, association rules and dimensionality reduction rather than from answers supplied in advance.

  • ๐Ÿ”˜ No labels needed: The algorithm searches for structure instead of matching known answers.
  • โ˜‘๏ธ Three task families: Clustering, association rule mining and dimensionality reduction.
  • โœ… Four clustering styles: Exclusive, agglomerative, overlapping and probabilistic.
  • ๐Ÿงช Named algorithms: K-means, hierarchical clustering, Fuzzy C-Means, PCA, SVD and ICA.
  • ๐Ÿ› ๏ธ Where it earns its keep: Customer segmentation, fraud and anomaly detection, market-basket analysis, data preprocessing.
  • โš™๏ธ The trade-off: No ground truth means results must be interpreted, validated and named by a human.

Unsupervised Machine Learning: algorithms, types with example

What is Unsupervised Learning?

Unsupervised Learning is a machine learning technique in which the user does not need to supervise the model. Instead, it allows the model to work on its own to discover patterns and information that were previously undetected. It mainly deals with unlabeled data.

Unsupervised Learning Algorithms

Unsupervised Learning Algorithms allow users to perform more complex processing tasks compared to supervised learning. Unsupervised learning can, however, be more unpredictable than methods trained against known answers. Unsupervised learning algorithms include clustering, anomaly detection, dimensionality reduction and self-organising neural networks.

Example of Unsupervised Machine Learning

Let us take an example of Unsupervised Learning for a baby and her family dog. The first picture shows the pet the baby already recognises.

A baby with her family dog, the animal she already recognises

She knows and identifies this dog. A few weeks later a family friend brings along a dog and tries to play with the baby. That second, unfamiliar dog is shown below.

An unfamiliar dog the baby has never seen before

The baby has not seen this dog earlier. But she recognises that many features (2 ears, eyes, walking on 4 legs) are like her pet dog. She identifies the new animal as a dog. This is unsupervised learning, where you are not taught but you learn from the data (in this case data about a dog). Had this been supervised learning, the family friend would have told the baby that it is a dog, as shown in the above Unsupervised Learning example.

Why Unsupervised Learning?

Here are the prime reasons for using Unsupervised Learning in Machine Learning:

  • Unsupervised machine learning finds all kinds of unknown patterns in data.
  • Unsupervised methods help you to find features which can be useful for categorization.
  • It can run on data as it arrives, so incoming records are analyzed and grouped without waiting for a human to label them first.
  • It is easier to get unlabeled data from a computer than labeled data, which needs manual intervention.

Clustering Types of Unsupervised Learning Algorithms

Unsupervised learning problems are further grouped into clustering, association and dimensionality reduction problems. Clustering groups similar records, association finds items that appear together, and dimensionality reduction compresses many features into a few.

Clustering

Clustering is an important concept when it comes to unsupervised learning. It mainly deals with finding a structure or pattern in a collection of uncategorized data. Unsupervised Learning Clustering algorithms will process your data and find natural clusters (groups) if they exist in the data. You can also modify how many clusters your algorithms should identify. It allows you to adjust the granularity of these groups. The diagram below shows scattered records resolved into distinct groups.

Clustering diagram showing unlabeled data points grouped into separate clusters

There are different types of clustering you can utilize:

Exclusive (partitioning)

In this clustering method, data are grouped in such a way that one record can belong to one cluster only.

Example: K-means

Agglomerative

In this clustering technique, every record starts as its own cluster. The iterative unions between the two nearest clusters reduce the number of clusters.

Example: Hierarchical clustering

Overlapping

In this technique, fuzzy sets are used to cluster data. Each point may belong to two or more clusters with separate degrees of membership.

Here, data will be associated with an appropriate membership value. Example: Fuzzy C-Means

Probabilistic

This technique uses a probability distribution to create the clusters.

Example: The following keywords

  • โ€œmanโ€™s shoe.โ€
  • โ€œwomenโ€™s shoe.โ€
  • โ€œwomenโ€™s glove.โ€
  • โ€œmanโ€™s glove.โ€

can be clustered into two categories, โ€œshoeโ€ and โ€œglove,โ€ or โ€œmanโ€ and โ€œwomen.โ€

Clustering Types

Following are the algorithms most often met in unsupervised Machine Learning. The first two group records, the last three reduce dimensions rather than form clusters, and K-NN is listed because it is often confused with K-means.

  • Hierarchical clustering โ€” clustering
  • K-means clustering โ€” clustering
  • K-NN (k nearest neighbors) โ€” a supervised classifier, not a clustering method
  • Principal Component Analysis โ€” dimensionality reduction
  • Singular Value Decomposition โ€” dimensionality reduction
  • Independent Component Analysis โ€” dimensionality reduction

Hierarchical Clustering

Hierarchical clustering is an algorithm which builds a hierarchy of clusters. It begins with all the data assigned to a cluster of its own. Here, two close clusters are going to be merged into the same cluster. This algorithm ends when there is only one cluster left. It defines two ideas worth naming separately.

Agglomerative clustering

This bottom-up form of hierarchical clustering does not require the number of clusters K as an input. The agglomeration process starts by forming each record as a single cluster.

This method uses some distance measure and reduces the number of clusters (one in each iteration) by a merging process. Lastly, we have one big cluster containing all the objects, and the analyst cuts the tree at the height that gives a sensible number of groups.

Dendrogram

In the Dendrogram clustering method, each level will represent a possible cluster. The height of the dendrogram shows the level of similarity between two joined clusters. The closer to the bottom of the process they are, the more similar the clusters; choosing the cut that defines the final groups is not automatic and is mostly subjective.

K-means Clustering

K-means is an iterative clustering algorithm which refines the grouping at every iteration. Initially, the desired number of clusters is selected. In this clustering method, you need to cluster the data points into k groups. A larger k means smaller groups with more granularity; a lower k means larger groups with less granularity.

The output of the algorithm is a group of โ€œlabels.โ€ It assigns each data point to one of the k groups. In k-means clustering, each group is defined by creating a centroid for that group. The centroids are like the heart of the cluster, which captures the points closest to them and adds them to the cluster.

K- Nearest neighbors

K-nearest neighbour is the simplest of all machine learning classifiers. It differs from other machine learning techniques in that it does not produce a model. It is a simple algorithm which stores all available cases and classifies new instances based on a similarity measure. Because it needs labeled cases to classify against, K-NN is a supervised method; it appears here only because its distance-based logic resembles clustering.

It works very well when there is a meaningful distance between examples. The learning speed is slow when the training set is large, and the distance calculation is nontrivial.

Principal Components Analysis

Principal Component Analysis takes a high-dimensional space and selects a new basis, keeping only its most important scores. Each direction in this basis is known as a principal component. The subset you keep constitutes a new space which is small in size compared to the original space. It maintains as much of the complexity of the data as possible.

Association

Association rules allow you to establish associations amongst data objects inside large databases. This unsupervised technique is about discovering interesting relationships between variables in large databases, and it is a staple of data mining. For example, people that buy a new home are most likely to buy new furniture.

Other Examples:

  • A subgroup of cancer patients grouped by their gene expression measurements
  • Groups of shoppers based on their browsing and purchasing histories
  • Movies grouped by the ratings given by viewers

Supervised vs. Unsupervised Machine Learning

Here is the main difference between Supervised vs. Unsupervised Learning:

Parameters Supervised machine learning technique Unsupervised machine learning technique
Input Data Algorithms are trained using labeled data. Algorithms are used against data which is not labeled
Computational Complexity Supervised learning is a simpler method. Unsupervised learning is computationally complex
Accuracy Accuracy can be measured directly against known labels. Accuracy cannot be measured directly; results need interpretation
Typical output A prediction for each new record Groups, rules or compressed features

Applications of Unsupervised Machine Learning

Some applications of Unsupervised Learning Techniques are:

  • Clustering automatically splits the dataset into groups based on their similarities
  • Anomaly detection can discover unusual data points in your dataset. It is useful for finding fraudulent transactions
  • Association mining identifies sets of items which often occur together in your dataset
  • Latent variable models are widely used for data preprocessing, such as reducing the number of features in a dataset or decomposing the dataset into multiple components

Disadvantages of Unsupervised Learning

  • You cannot get precise information regarding data sorting, because the data used in unsupervised learning is unlabeled and its true grouping is not known
  • Less accuracy of the results, because the input data is not known and not labeled by people in advance. This means that the machine is required to do this itself.
  • The spectral classes do not always correspond to informational classes.
  • The user needs to spend time interpreting and labelling the classes that follow from the classification.
  • Spectral properties of classes can also change over time, so you cannot keep the same class information while moving from one image to another.

FAQs

The elbow method plots within-cluster error against k and looks for the bend. The silhouette score, ranging from โˆ’1 to 1, rates how well each point fits its cluster. Read both together.

Distance-based algorithms treat every unit equally, so a salary column in thousands will dominate an age column in years. Standardising each feature first gives every variable a fair say in the distance.

Apriori is the classic association-rule miner behind market-basket analysis. It finds frequent item sets, then turns them into rules ranked by support, confidence and lift. FP-growth and Eclat do the same faster.

Semi-supervised learning uses a small labeled set alongside a large unlabeled one. Structure found in the unlabeled data guides the model, so accuracy approaches a supervised result at far lower labelling cost.

PCA is a linear transform that preserves global variance and applies to new records. t-SNE is non-linear and built for visualising local neighbourhoods in two dimensions; distances between separated groups should not be read literally.

Isolation Forest, One-Class SVM, DBSCAN and autoencoder reconstruction error are the usual choices. Each scores how far a record sits from the bulk of the data, so a threshold decides what counts as anomalous.

Automated pipelines sweep algorithms, distance measures and values of k, then rank the runs by internal validity scores. Language models increasingly draft plain-English names for the resulting segments, shortening the interpretation step.

GitHub Copilot scaffolds scikit-learn pipelines, elbow plots and silhouette charts from a one-line prompt. Check that it scaled the features and set a random seed, which generated snippets often omit.

Summarize this post with: