Skip to content
academia.sh

Course Intermediate

Unsupervised Learning

Published Updated

By the end of this course

Start course

01

Clustering

Counting how far a result of unlabeled grouping of points departs from a random partition: three entirely different partitions that three different similarity definitions draw from the same dataset, the different results that different starting points produce at the same number of clusters, and the uncertainty of the elbow, the number of points that single, complete and average linkage separate and the cut height being a decision, the number of clusters and noise points that the neighborhood radius and the minimum point count move, the uncertainty carried by soft assignment disappearing in hard assignment, three internal validity measures choosing three different numbers of clusters, and finding clusters even in a dataset with no structure.

  1. 01 The Clustering Problem Building the measure itself once the label is removed: the same 756 subscribers are split into four clusters with three different similarity definitions and three entirely different partitions come out — the partitions disagree on a share of point pairs between 0.3750 and 0.4801. Three baselines are defined; under the standard score definition a single cluster gives 6.0000, random assignment 5.9790, slicing by a single column 4.9044 and the method 3.8910, so the method's difference is 2.0880 or 1.0134 depending on which baseline is written. The numbers of the three definitions cannot be compared with each other; the proportional gains are 0.525, 0.349 and 0.295.
  2. 02 k-Means Measuring iteration and the number of clusters separately: thirty random starts at the same k produce 26 distinct partitions, the numbers stay between 3.5649 and 3.7763 but the best and the worst run disagree on 0.2844 of the point pairs — even two runs that give the same number to four decimals disagree on 0.0037 of them. The number of clusters is a hyperparameter; in a sweep of 120 runs the random baseline falls from 6.0000 to 5.9181 while the method falls from 6.0000 to 2.2570, and three separate readings of the elbow choose three separate values of k: 3, 4 and 5.
  3. 03 Hierarchical Clustering A family that turns the number of clusters from an input into a cut decision, and the price of that decision: on the same 200 subscribers, single, complete and average linkage start from the same first merge (0.079) and end at 2.245, 8.917 and 4.994; cut at a height of 2.0 they give 3, 56 and 37 clusters respectively. At four clusters, single linkage beats the random assignment baseline by only 0.1492 with 6.0849 and produces [1, 1, 1, 197], while complete linkage beats it by 1.6922 with 4.5419; the two linkages place 86 of the 200 subscribers in different clusters.
  4. 04 Probabilistic Clustering Measuring a mixture model in which a point is attached to every cluster with a responsibility: the fit score of the random assignment baseline is -4.2424, that of the model found by iterative estimation is -3.7755, a difference of +0.4669. The same difference comes out as +0.3358 on the dataset whose columns are shuffled within themselves, so only +0.1311 of the difference comes from the data. For 74 of the 756 points the largest share is below 0.60, and for these points the mean largest share is 0.5418. On moving to hard assignment the mean uncertainty falls from 0.3797 to zero and the cluster sizes deviate by up to 28.8 points from the soft mass. At a second start, 43.24% of the undecided points and 7.20% of the certain points change cluster.
  5. 05 Clustering Evaluation Measuring the measures that choose the number of clusters: on the same 756 subscribers the silhouette coefficient chooses 3 clusters, the scatter ratio 6 and the gap measure 10, and none of them is more correct than another. On a random cloud that carries no structure the same three measures still choose 9, 7 and 9; the highest silhouette is 0.2142 on the real data and 0.1255 on the structureless cloud. The label is opened for the first and only time in the course, and the pair agreement rate comes out as 0.5235 for the best partition: the single cluster baseline, at 0.6539, beats all nine partitions. Twenty-seven comparisons were made, and none of the internal measures chose the number of clusters that the label points to.

02

Dimensionality Reduction and Anomalies

Measuring what is kept and what is lost when the number of columns is reduced, and how a point that stands alone is flagged: the reconstruction error of the projection that keeps the variability, how much of the pairwise distances survive, and the scaling decision changing the projection; the trade-off between the error that grows as the rank falls and the storage cost; how many of the nearest neighbors remain neighbors in a neighborhood-preserving embedding and the distance between two points being uninterpretable; how many of the flagged anomalies are real and the multivariate anomaly the univariate procedure cannot catch; high-confidence rules coming only from a frequent item and lift correcting this.

  1. 01 Principal Component Analysis Measuring what is kept and what is lost when a twelve-column subscriber table is reduced to fewer numbers: reconstruction with column means gives 3.3411 while reconstruction with two components gives 2.7762, and the difference is only 0.169 of the baseline; the same two components carry 0.341 of the component share, yet the mean of the pairwise distances falls to 0.4965 times the original and only 0.0057 of the 31,626 pairs survive within a 10% margin. In the unscaled set the load of the first component binds to a single column with +0.96 and the share of the first two components rises to 0.863, but the reconstruction error measured in a common unit, 2.8473, stays behind the scaled projection.
  2. 02 Singular Value Decomposition Application Measuring the cost of storing a matrix with a low-rank approximation, in error and in storage cost (in numbers): in a hand-built 6x5 matrix the total error of the rank 2 approximation is 0.6746 and this number equals exactly the root of the squares of the discarded singular values, but at rank 3 the storage cost rises to 36 and exceeds the original 30 numbers. In the 252x12 subscriber table reconstruction with column means gives 3.3411 while the rank 2 approximation gives 2.7464 and stores 554 numbers instead of 3,024; storing two random raw columns with the same budget gives 3.0617, and the advantage of the low-rank approximation is 0.3153 at rank 2 and 0.9663 at rank 8.
  3. 03 Nonlinear Embedding Measuring two-dimensional layouts that aim to preserve neighborhoods against the linear projection: a random layout preserves 0.0390 of the ten nearest neighbors, the linear projection 0.2639, and the neighborhood-targeted embedding 0.5032. The same embedding preserves only 0.0071 of the ten farthest pairs while the linear projection preserves 0.6012; the two methods preserve the opposite of each other. After the mean pairwise distance is equalized, the original distance of pairs standing at the same distance in the embedding varies between 3.47 and 9.46, and in a second run with the same setting the embedded distance of the same pair wanders by a mean relative difference of 0.2906.
  4. 04 Anomaly Detection Measuring flagging on 63 anomalies deliberately planted into the 1,260 rows of the fictional subscriber table: at a 5% rate random flagging gives a precision of 0.0488, flagging by a single column 0.3968, the procedure that looks at each column on its own 0.6190, and the reconstruction error with four components 0.4921. The precision ranking is misleading — the three detectors with the highest precision find none of the 24 multivariate anomalies that go to the extreme in no column, while the one with the lowest precision finds fifteen of them, and when the contamination rate rises to 10% it finds all twenty-four. At a rate of 2% three detectors give a precision of 1.0000 and at the same time catch only 25 of the 63 anomalies.
  5. 05 Association Rules Measuring the 166 rules that pass the support floor in the 1,329 baskets of the fictional subscriber table: all six of the top six rules by confidence name the same frequent item as the consequent and their lifts are between 1.0139 and 1.0489; of the 97 rules with confidence above 0.50, 75 have a lift closer to 1 than 0.05. The baseline is the support that random matching produces — when the item columns are shuffled separately, the support of 0.1279 for delay and installment plan does not exceed 0.0467 in any of sixty shuffles, but the support of a rule with a confidence of 0.9246 stays inside the random range. The course wrap-up gathers the baseline, the method's number and the difference of eleven lessons in a single table.

Final exam

Unsupervised Learning — Final Exam

In preparation

This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.

Start typing to search.

↑↓ ↵ Esc navigate · open · close