• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 23 pages
Exam (elaborations)

CS-7641-Machine-Learning-Final Notes

Document preview thumbnail
Preview 3 out of 23 pages

CS-7641-Machine-Learning-Final Notes

Content preview

CS7641 UL02. Clustering Mohamed Ameen Amer




UL02. Clustering

Clustering Problem:
• Unsupervised learning: Making sense out of unlabeled data (data description).
• The clustering problem:
- Given: A set of objects 𝑋
Inter-object distances 𝐷(𝑥, 𝑦) = 𝐷(𝑦, 𝑥) 𝑥, 𝑦 ∈ 𝑋
- Output: Partition 𝑃𝐷 (𝑥) = 𝑃𝐷 (𝑦) 𝑖𝑓 𝑥 𝑎𝑛𝑑 𝑦 𝑎𝑟𝑒 𝑖𝑛 𝑡ℎ𝑒 𝑠𝑎𝑚𝑒 𝑐𝑙𝑢𝑠𝑡𝑒𝑟


Single Linkage Clustering – SLC:
• Consider each object a cluster (𝑛 objects).
• Define inter-cluster distance as the distance between the closest points in the two clusters.
• Merge the two closest clusters.
• Repeat 𝑛 − 𝑘 times to make 𝑘 clusters.
- 𝑘 is an input.
• How you define the inter-cluster distance is a domain knowledge.
• Running time of SLC: 𝑂(𝑛3 )
• Issues with SLC: It might end up with wrong clusters, depending on the distance definition.


𝑘-Means Clustering:
• Pick 𝑘 random center points.
• Each center claims its closest points.
• Recompute the centers by averaging the clustered points.
• Repeat until converge.
• 𝑘-means in Euclidean space:
− 𝑃𝑡 (𝑥): Partition/cluster of object 𝑥.
− 𝐶𝑖𝑡 : Set of all points in cluster 𝑖 = {𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑃(𝑥) = 𝑖}
∑𝑦∈𝐶 𝑡 𝑦
− 𝑐𝑒𝑛𝑡𝑒𝑟𝑖𝑡 : 𝑖 ⁄
|𝐶𝑖 |
2
𝑃𝑡 (𝑥) = 𝑎𝑟𝑔𝑚𝑖𝑛𝑖 ‖𝑥 − 𝑐𝑒𝑛𝑡𝑒𝑟𝑖𝑡−1 ‖2
∑𝑦∈𝐶 𝑡 𝑦
𝑐𝑒𝑛𝑡𝑒𝑟𝑖𝑡 = 𝑖 ⁄
|𝐶𝑖 |
𝑡 (𝑥).
Use the new center to re-compute 𝑃




Page | 1

,CS7641 UL02. Clustering Mohamed Ameen Amer


• 𝑘-means as an optimization problem:
- Configurations:
𝑐𝑒𝑛𝑡𝑒𝑟
𝑃
- Scores: How much error you introduce by representing these points as centers.
2
𝐸(𝑃, 𝑐𝑒𝑛𝑡𝑒𝑟) = ∑‖𝑐𝑒𝑛𝑡𝑒𝑟𝑃(𝑥) − 𝑥‖2
𝑥
- Neighborhood: The neighborhood of a configuration is the set of pairs where you keep the
centers the same and you change the partitions, or you keep the partitions the same and you
move the centers.
𝑃, 𝑐𝑒𝑛𝑡𝑒𝑟 = {(𝑃′ , 𝑐𝑒𝑛𝑡𝑒𝑟)} ⋃{𝑃, 𝑐𝑒𝑛𝑡𝑒𝑟 ′ }
- Looking into 𝑘-means this way, we can notice that it follows the same procedures of Hill
Climbing:
1. The first function that updates 𝑃𝑡 (𝑥) moves the cluster only if the error goes down.
2. The second function that updates 𝑐𝑒𝑛𝑡𝑒𝑟𝑖𝑡 can never bring the error up because average
minimizes squared error.
• Properties of 𝑘-means clustering:
- Each iteration is polynomial 𝑂(𝑘𝑛).
- Finite (exponential) iterations 𝑂(𝑘 𝑛 ).
- Error decreases (if ties are broken consistently).
- Can get stuck, if it started with wrong centers. This is similar to converging to a local optima. One
solution to this problem is to use random restarts.


Soft Clustering:
• Soft Clustering attaches cluster probability to each point, instead of a specific cluster.
• Assume the data was generated by:
- Select one of 𝑘 possible Gaussians (Fixed know variance) uniformly.
- Sample 𝑥𝑖 from that Gaussian.
- Repeat 𝑛 times.
• Task: Find a hypothesis ℎ = 〈𝜇1 , … , 𝜇𝑘 〉 (𝜇1 , … , 𝜇𝑘 are Gaussian means) that maximizes the
probability of the data (Maximum likelihood).
• Maximum Likelihood Gaussian: The Maximum Likelihood mean of the Gaussian 𝜇 is the mean of the
data.




Page | 2

, CS7641 UL02. Clustering Mohamed Ameen Amer


Expectation Maximization – EM:
• EM assigns a cluster probability to each point.
𝑃(𝑥 = 𝑥𝑖 |𝜇 = 𝜇𝑗 )
𝐸[𝑍𝑖𝑗 ] =
∑𝑘𝑖=1 𝑃(𝑥 = 𝑥𝑖 |𝜇 = 𝜇𝑗 )
∑𝑖 𝐸[𝑍𝑖𝑗 ]𝑥𝑖
𝜇𝑗 =
∑𝑖 𝐸[𝑍𝑖𝑗 ]
−1 2 2
𝑃(𝑥 = 𝑥𝑖 |𝜇 = 𝜇𝑗 ) = 𝑒 2 𝜎 (𝑥𝑖−𝜇𝑗)
- Use the new 𝜇𝑗 to re-compute 𝐸[𝑍𝑖𝑗 ].
- Expectation: 𝐸[𝑍𝑖𝑗 ] defines the probability that element 𝑖 was produced by cluster 𝑗.
- Maximization: 𝜇𝑗 defines the mean of cluster 𝑗.
• EM properties:
- Monotonically non-decreasing likelihood: It’s not getting worse.
- Does not converge (practically converge).
- Will not diverge.
- Most probably, it will get stuck in a local optima: Use random restarts.
- Works with any distribution (if 𝐸 and 𝜇 are solvable).


Clustering Properties:
• Richness: For any assignment 𝐶 of objects to clusters, there’s some distance matrix 𝐷 such that 𝑃𝐷
returns that clustering 𝐶.
• Scale-invariance: Scaling distances by a positive value doesn’t change the clustering:
∀𝐷 ∀𝑘>0 𝑃𝐷 = 𝑃𝑘𝐷
• Consistency: shrinking intra-cluster distances (Moving points towards each other) and expanding
inter-cluster (Moving clusters away from each other) distances doesn’t change the clustering:
𝑃𝐷 = 𝑃́𝐷 .
• Impossibility Theorem: There’s no clustering algorithm that can achieve these three properties.




Page | 3

Document information

Uploaded on
November 9, 2026
Number of pages
23
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$36.39

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ScholarDocsUS
4.4
(311)
Sold
283
Followers
1
Items
1279
Last sold
3 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions