
What unsupervised learning is, the nine sections you will go through, from the map of the field and scikit-learn to recommenders and text clustering, how each lesson pairs the running notebook with an animated scene of the real data, and who the course is for.
Who Laxmi Kant is, the work he does as an AI engineer and corporate AI trainer, and why every method in this course runs for real on real data.
How the eight sections, slide decks and notebooks fit together, and a study method: watch, run it yourself, then change one thing.
The Udemy player settings that make code easy to read: quality and full screen, speed, captions and transcript, notes and offline viewing.
Where to get the course repository, and the one-time setup: Python 3.12, uv, running the notebooks, what each dataset downloads, and Ollama for the last section.
How to leave an honest rating, how to use the Q&A, and where the announcements about new sections appear.
Test three hand-written rules on 4,600 real emails and watch them break, then meet supervised, unsupervised and reinforcement learning, with semi-supervised learning in between.
What supervised learning needs, classification and regression, how 10 labels name 37% of new digits right against 93% with 60,000, and why labels are expensive, which is the reason unsupervised learning exists.
What an algorithm can pull out of data with no labels (groups, directions, oddities and representations) and where it falls short.
What a few labels plus many unlabelled rows can do in semi-supervised learning, set beside reinforcement learning.
The five families of unsupervised learning, a close look at dimensionality reduction and clustering, and how the families mix in a real project.
The other three families: finding points that do not fit, turning data into useful vectors, and generating data like the old.
Six common problems in a supervised project, such as too few labels or too many columns, and how an unsupervised step helps with each.
Four ways to judge a result when there is no answer key, why the course hides labels until grading, and how self-supervised learning makes labels from the data.
Where unsupervised and self-supervised learning run in real systems, from search to fraud monitoring, and the Python libraries the course uses.
Meet scikit-learn on its home page: a free, open-source library of classical machine learning built on NumPy, SciPy and matplotlib, its six jobs, and which of them need labels.
Walk through the scikit-learn website once: the menu, the User Guide, the API reference, the Examples gallery, the Community blog and the search box, and which question each one answers.
Move around the User Guide chapter by chapter, from supervised learning to model selection, preprocessing and dataset loading, and follow the Choosing the right estimator chart.
Open the unsupervised learning chapter, read its nine topics one plain sentence each, and see how three big sections of this course come from it.
See that every model is used in the same four steps, import, make, fit and use, on lines from this course, and find each model's exact name in the API reference.
Read the page of one class, PCA, then KMeans: the full name, the Parameters you set, the Attributes that end with an underscore, the Methods you call and the example at the bottom.
A 28 by 28 digit is one point in 784 dimensions: why distances lose meaning there, and a map of the methods in the section.
Import every tool of the section in one cell, then load the 70,000 MNIST digits from OpenML.
Scale the pixels to the range 0 to 1, show a digit as a picture, and see why two raw pixels cannot tell the digits apart.
How PCA finds the directions of most spread, then fit it on all the digits and read the explained variance of each component.
Read the cumulative explained variance curve, keep enough components for 95% of the variance, and plot the digits on the first two components.
Draw each PCA component as a 28 by 28 image and rebuild a digit as the mean digit plus weighted components.
Measure how badly PCA rebuilds each digit and find the most unusual one, the idea that later becomes a fraud detector.
Fit PCA one chunk at a time with partial_fit, and check how close it gets to plain PCA.
Build components that use only a small patch of pixels each, with three quarters of their values exactly zero, at the cost of a slower fit.
Why no straight line splits two rings, and how Kernel PCA with an RBF kernel pulls them apart, fitted on 5,000 digits.
Split the data table into three smaller pieces with Truncated SVD, and see what skipping the centring step gives and costs.
Multiply by a random matrix while keeping distances, and use the Johnson-Lindenstrauss bound to find how few dimensions are enough.
Build Gaussian and sparse random projections in scikit-learn and check that the distance between two real digits survives.
Pull mixed signals back into independent sources with FastICA, then look at an independent component of the digits as an image.
Build each digit from at most five atoms with MiniBatchDictionaryLearning, and look at one atom and the weights of one digit.
What a manifold is, why distance along the surface differs from straight-line distance, and an Isomap map of a 2,000-digit sample.
Map the same 2,000 digits with MDS and Locally Linear Embedding, and compare the maps side by side.
How t-SNE turns distances into neighbour probabilities and builds a 2D map, run on the first 50 PCA components of 10,000 digits.
Perplexity is roughly the number of neighbours each point pays attention to: run t-SNE at perplexity 5 and 100 and compare the maps.
How UMAP builds a neighbour graph and a layout, fit it on 60,000 digits, then use transform to place the last 10,000 on the same map.
Put every method of the section side by side, with its kind, whether it can place new points and how far it scales, and a rule for choosing a method for your own data.
Meet the credit card fraud problem: only 0.17% of the rows are fraud, so accuracy tells you nothing, and the plan is to rank rows by how unusual they are.
Import every tool of the section in one cell, from NumPy and pandas to the scikit-learn and PyOD detectors.
Download 284,807 card transactions from two days, and count the 492 frauds among them.
Why the V1 to V28 columns are already PCA scores, which columns stay as they are, and how the Amount column is prepared.
Split the rows into training and test sets with the same fraud rate in both, and see why what PCA cannot rebuild marks an unusual row.
Project each row down and back up with PCA and use the rebuild error as a fraud score, and see why keeping every component gives no signal.
Grade a ranking with precision, recall, the precision-recall curve and average precision.
Grade the top of the list the way a fraud team works, with precision at N and recall at N when N equals the number of frauds.
Try every number of components, score each with average precision, and see why keeping all of them scores close to zero.
Why scaling the columns, usually a good habit, hurts here: the V columns are uncorrelated with falling variance, and scaling erases that order.
Any model with an inverse transform can score a row by rebuilding it: Sparse PCA, ICA, random projection, dictionary learning and Kernel PCA.
Put the five reconstruction methods in a dictionary and score them all with average precision in one loop.
Why Kernel PCA compares every row with every fitted row, which would need about 271 GB here, and how to fit on a sample and transform the rest.
Score a row by how few random cuts it takes to isolate it, then fit IsolationForest and flip its score for ranking.
Score a row by its density compared with the density of its neighbours, and see why one global distance cut would miss some outliers.
Frauds that sit close to other frauds look normal to a local method, so a method's assumption must match the data.
Score each feature by how far into its own tail a value sits, with ECOD from PyOD, which has no settings to tune.
Choose everything on the training rows, then score the test rows once, so the test result is not flattered.
Take the 100 test transactions with the largest reconstruction error and count how many are really fraud, as a fraud team with a daily budget would, then try budgets of 300 and 1,000.
Put the nine detectors of the section in one table, with what each one looks for, its score and what to watch for, and learn how to choose between them.
Four ideas of what makes a group, and the plan: cluster 10,000 handwritten digits without their labels, then 440 wholesale customers.
Import every tool of the section in one cell and see what each one is used for.
Load the first 10,000 MNIST digits, keep the labels only for grading, and reduce the pixels to 50 PCA components.
The k-means loop of assigning points and moving centers, how unequal the ten clusters come out, and what k-means assumes about the shape of a group.
Grade the ten clusters against the held-back digit labels with a crosstab, then boil the table down to one number, purity.
Beat the laziest baseline of one cluster, grade with the adjusted Rand index, and draw the cluster centres as digit images.
Plot inertia against the number of clusters to look for the elbow, and see why inertia alone can never pick k.
The silhouette score compares each point's own cluster with the nearest other cluster, and it shows why purity rises when you add clusters.
Build the tree of merges by joining the two closest groups, read the dendrogram, and choose the number of clusters afterwards.
Single, complete, average and ward linkage, what closest means for two groups, and agglomerative clustering in scikit-learn.
Clusters as crowded regions: eps, the five-digit crowd rule and noise points, and how three values of eps give three very different pictures of the digits.
HDBSCAN tries every density level and keeps the clusters that last, so there is no eps to set.
Why density methods call most digits noise in 50 dimensions, and how mapping to a few dimensions with UMAP first opens gaps for HDBSCAN.
Gaussian mixtures give each cluster its own centre, spread and tilt, with hard labels from predict and soft shares from predict_proba.
Start part two: load 440 customers of a wholesale food distributor, six yearly spending columns and a held-back Channel column.
Describe the spend with a table and plots, and see how a few big spenders stretch the data.
Same customers, different units, different clusters: why raw spend works badly and how a log transform plus StandardScaler fixes it.
Choose how many segments to ask for, then profile each one by median spend and name it in words a sales team can use.
Draw a dendrogram of the 440 customers and see whether a hierarchy finds the same groups as k-means.
Run HDBSCAN and then a Gaussian mixture on the same customers, and compare what each one finds.
Ask k-means for four segments, profile them with medians, and read them the way a sales team would.
Put k-means, Ward, DBSCAN, HDBSCAN and the Gaussian mixture side by side, with what you set, the groups each one likes and its grade on the digits and on the customers.
A network trained to reproduce its own input: encoder, bottleneck and decoder, and how the rebuild error becomes a fraud score.
Choose PyTorch as the engine for Keras 3 before importing it, import everything the section needs in one cell, and check which engine Keras is running on.
Load and prepare the same credit card transactions as before, and compute the PCA baseline score the autoencoders have to beat.
Build the smallest autoencoder with Sequential and Dense layers, 29 numbers squeezed to 10 and grown back to 29, and count the 619 numbers it still has to learn.
How the weights are adjusted, batch size, epochs and the loss curve, so you can watch the model learn.
Use the reconstruction error as a fraud score, and see why a linear autoencoder ends up where PCA does.
Write one function that builds, trains and scores any autoencoder, and see why the same code gives a different score on each run.
Undercomplete, complete and overcomplete bottlenecks, and what happens when the code is as wide as the input.
Add ReLU activations and more layers, then check whether more power gives a better fraud score.
Stop a wide autoencoder from simply copying its input, with dropout and with a sparsity penalty.
Train on noisy rows with clean targets, so the model cannot copy its input.
Put every autoencoder in one table, keep in mind how much the wide models swing between runs, and check the chosen one once on the test set.
Start the semi-supervised half: train a classifier on a few labelled rows and compare it with the scores that used no labels.
Give the classifier the autoencoder's reconstruction error as one more column, so what the autoencoder learned from every row reaches a model trained on a few.
Fit on the labelled rows, adopt the most confident predictions as pseudo-labels, and repeat until none are confident enough.
Compare the no-label score with models that use a few labels and with a model that uses every label, and see how far a few labels already get.
Change the labelled share of the training rows to 0.5% and 10%, and ask whether the autoencoder's error helps more when labels are scarcer.
Put the whole section in one table, from the PCA baseline to self-training, with the score each way earned and what to watch for.
Cluster whole signals instead of single rows: heartbeats, machine sensors, daily energy load and app activity.
Import every tool of the section in one cell, including the aeon library for time series data and distances.
What one ECG beat looks like, how aeon stores a collection of beats, and how to load ECGFiveDays as a three-dimensional array.
Plot the beats and z-normalise each series, so you compare shapes and not heights.
Euclidean distance compares reading one with reading one, so a beat that comes a little later looks far away: see it fail on a shifted copy.
Two distances that forgive a shift: shape-based distance, which finds the best alignment by cross-correlation, and Dynamic Time Warping.
Averaging beats that sit at different shifts blurs the cluster centre, which is why plain k-means struggles on this data.
How k-Shape rebuilds k-means around shape-based distance, then run it on the beats with aeon.
Run HDBSCAN on the raw readings and see why shifted beats spread out too thinly for a density method.
Meet ECG5000: five classes of beats, one normal and four abnormal, in very uneven numbers.
Run k-means and k-Shape on ECG5000 and learn how to read the adjusted Rand index when the classes are imbalanced.
Add HDBSCAN and open the crosstab to see what each method did to the rare classes, which a score alone hides.
Put the scores of the three methods side by side, then run a lab that asks only whether a beat is normal or abnormal, with k-Shape and k-means.
Where grouping whole curves is used, how to choose a distance and then a method for your own series, and the UCR archive of 128 labeled datasets to practice on.
Where recommenders run, why the only data is who did what and when, how a recommender is graded on the movies hidden from each user, and the five models the section builds with RecTools.
Import every tool of the section in one cell: pandas, PyTorch, the implicit library, the RecTools dataset, metrics and five models, and the thread limit that ALS needs once.
Download MovieLens 1M, about one million ratings from 6,040 users, read the ratings and the movies into pandas tables, and build a lookup from movie number to title.
Why a watch counts as a yes while a missing entry means unknown, not disliked: set every weight to one, turn the timestamps into dates and count how many movies each user watched.
Sort every user's watches by time and hold out the last 10 movies of each user, so you train on the past and are graded on what came next.
Build the users by movies watch matrix with a RecTools Dataset, and see that it is stored as a sparse matrix with only about 4% of its cells filled.
Write the grade function once: recall at 10 and NDCG at 10 for any recommender, on the same users and the same 10 held-out movies.
Recommend the most watched movies a user has not seen, score that list with the grade function, and keep the result as the baseline for every other model.
Score a movie by its cosine similarity to the movies a user watched, and beat the popularity list with nothing but watch counts.
How alternating least squares turns the watch matrix into 64 hidden factors for every user and every movie, fitted with the implicit library through RecTools, and how it scores.
Look at one user instead of an average: what ALS recommends, next to the 10 movies that were held out, and which of them it found.
Find the movies closest to Toy Story among the learned movie vectors, with no genre or plot given to the model.
An autoencoder with no hidden layer and a zero diagonal, solved with one matrix inverse and one setting, with no training loop.
Why the order of watching matters, how SASRec reads each history in order and predicts the next movie with attention, and what 40 epochs of training buy.
Put popularity, item similarity, ALS, EASE and SASRec in one table, with recall at 10, NDCG at 10 and run time, and see where the largest gain came from.
Give SASRec four animated films in the order you watched them, read the ten movies it continues with, then swap in your own taste.
Go through the five recommenders in turn with the recall each one earned, and choose: start with popularity, then add the order when what a user watched last decides what comes next.
Ten bank messages that ask for the same thing, why most text has no labels, and the plan for the section: embed, map, group and name.
Import every tool of the section in one cell, including UMAP, the Ollama library, sentence-transformers and BERTopic.
Load 10,003 customer messages to a bank, and keep the 77 intents out of sight so that they only grade the groups at the end.
What an embedding is, then turn every message into a vector of 384 numbers with the BGE small model from sentence-transformers.
Check that closeness in the numbers is closeness in meaning: two messages about a lost card against one about a top-up.
Tell k-means there are 77 groups, cluster the embeddings, and grade the result with the adjusted Rand index against the held-back intents.
Squeeze the messages from 384 numbers to two with UMAP, color each dot by the held-back intent, and see tight clumps with gaps between them.
Chain embed, reduce and cluster: UMAP down to 5 dimensions, then HDBSCAN, which finds 73 groups by itself and calls about 16% of the messages noise.
Read one clean cluster, where 120 of its 121 messages share one true intent, then read the noise messages and see why noise is a queue for a person, not an error.
Send ten messages from one cluster to a local language model, Qwen3.5 4B on Ollama, and get a short name back, with no account and no key.
Loop over the first ten clusters, name each one with the local model, and compare every name with its most common true intent.
How BERTopic embeds, reduces, clusters and picks keywords in one model, then fit it on the messages and grade it.
Read the keywords of one topic, then put k-means, UMAP with HDBSCAN and BERTopic side by side, and see what the score can and cannot tell you.
Send new messages to their closest BERTopic topic with transform, then write a few of your own and see where they land.
How clusters become a labeled dataset (cluster, review, label, classify), and a starting setup for text clustering, step by step.
This course contains the use of artificial intelligence. The course outline, the explanations, the tool choices and every measured number are my own.
Learn unsupervised machine learning in Python on real data that has no labels. In this hands-on course you use scikit-learn, UMAP, PyOD, Keras, PyTorch, aeon, implicit, BERTopic and Ollama for cluster analysis, PCA and other dimensionality reduction, anomaly detection, credit card fraud detection, autoencoders, semi-supervised learning, time series clustering, recommendation systems and text clustering with a local LLM.
Most real data comes without an answer key. Nobody has marked which customers belong together, which transactions are fraud, which heartbeats look alike, which movie a user will want next or what a pile of bank messages is about. Unsupervised learning is how you find structure in data like this: you compress it, group it, rank what looks unusual and learn representations that other models build on, and then you decide what to do with it.
Unsupervised Learning in Python teaches each method one step at a time. You start with a map of where unsupervised learning sits in machine learning, with no code. Then you work through seven code sections of notebooks on real data: handwritten digits, credit card transactions, wholesale customers, heartbeat recordings, MovieLens movie watches and bank customer messages. New sections keep coming to the course.
What makes this course different
Fraud detection without labels. You score 284,807 real card transactions, of which only 0.17% are fraud, with PCA reconstruction error, Isolation Forest, Local Outlier Factor and ECOD, then with autoencoders. You grade every score with average precision, the precision-recall curve and a daily review budget, because plain accuracy fails on rare fraud.
Cluster analysis, start to finish. k-means, hierarchical clustering and the dendrogram, DBSCAN, HDBSCAN and Gaussian mixtures on 10,000 handwritten digits, then customer segmentation of 440 wholesale customers into segments a sales team can use.
Many ways to reduce dimensions. PCA, Incremental PCA, Sparse PCA, Kernel PCA, Truncated SVD, random projection, ICA, dictionary learning, Isomap, MDS, LLE, t-SNE and UMAP, all on MNIST digits, with a lecture on choosing between them.
A recommendation system built the way it is built now. On MovieLens 1M (6,040 users and 3,706 movies) you build a popularity baseline, item-based collaborative filtering with cosine similarity, matrix factorization with implicit ALS, EASE, which is a linear autoencoder over items, and SASRec, a small transformer that you write in PyTorch to predict the next movie. You hold out each user's last 10 movies and grade every model with recall at 10 and NDCG at 10. In my run, the popularity list scores 0.041 recall at 10 and SASRec scores 0.159.
Text clustering with embeddings and a local LLM. You turn 10,003 bank customer messages into embeddings with a small sentence-transformers model, group them with k-means, with UMAP and HDBSCAN, and with BERTopic, and then ask a small language model, Qwen3.5 4B on Ollama, to name the groups. It runs on your own computer, with no API key and no account.
Honest results. You see methods fail and learn why: standardizing hurts the fraud features, Local Outlier Factor misses grouped fraud, k-means fails on shifted heartbeats, wide autoencoders give different scores from run to run, and on the bank messages UMAP with HDBSCAN scores lower than k-means that is told the right number of groups, so you learn what a score hides.
Judging results with no answer key: purity, the adjusted Rand index, the elbow method, the silhouette score, a daily review budget, and recall at 10 and NDCG at 10 on held-out watches, with the labels used only for grading.
Every line of code is typed and explained on screen, and the real output is read out, so you can follow along and run it yourself. Every dataset downloads inside its notebook, with no account or login.
What you will cover
The map: rules versus machine learning, supervised, semi-supervised and reinforcement learning, the five families of unsupervised learning, how to judge results without labels, and self-supervised learning.
Dimensionality reduction in Python: PCA, t-SNE and UMAP on MNIST digits, and the other methods listed above.
Anomaly detection: credit card fraud detection with reconstruction error, Isolation Forest, Local Outlier Factor and ECOD, and an honest check on the test set.
Cluster analysis: k-means, hierarchical clustering, DBSCAN, HDBSCAN, Gaussian mixtures, UMAP before HDBSCAN, and customer segmentation.
Autoencoders in Keras 3 on the PyTorch backend, and semi-supervised learning with a few labels: the reconstruction error as a feature, self-training and pseudo-labels.
Time series clustering: ECG heartbeats, why Euclidean distance fails on a shifted beat, shape-based distance, Dynamic Time Warping, k-Shape and HDBSCAN.
Recommender systems: implicit feedback, a time-based split, the popularity baseline, item similarity, implicit ALS, EASE and SASRec, and how to choose between them.
Text clustering: text embeddings with sentence transformers, k-means on embeddings, UMAP and HDBSCAN, BERTopic topic modeling, naming clusters with a local LLM in Ollama, sorting new messages and turning clusters into a labeled dataset.
By the end, you will be able to take a table, a signal, a pile of transactions, a log of what people watched or a stack of messages with no labels, find groups, unusual rows, recommendations and compact representations in it, and judge how far to trust each result.
A little Python is enough. You do not need a machine learning background, and a GPU is optional: everything in this course also runs on a CPU. Training the SASRec model is the one step that takes noticeably longer without a GPU, and the small language model in Ollama runs on a plain processor, only more slowly.