2 What is Unsupervised Learning? In supervised learning we were given attributes & targets (e.g. class labels).In unsupervised learning we are only given attributes.Our task is to discover structure in the data.Example I: the data may be structured in clusters:Example II: the data may live on alower dimensional manifold:Is this a good clustering?
3 Why Discover Structure ? Data compression: If you have a good model you can encode thedata more cheaply.Example: To encode the data I haveto encode the x and y position of each data-case.However, I could also encode the offset and angleof the line plus the deviations from the line.Small numbers can be encoded more cheaply thanlarge numbers with the same precision.This idea is the basis for model selection:The complexity of your model (e.g. the number of parameters) should besuch that you can encode the data-set with the fewest number of bits(up to a certain precision).Homework: Argue why a larger dataset will require a more complex modelto achieve maximal compression.
4 Why Discover Structure ? theaon...54713...Why Discover Structure ?Often, the result of an unsupervised learning algorithm is a new representationfor the same data. This new representation should be more meaningfuland could be used for further processing (e.g. classification).Example I: Clustering. The new representation is now given by the label of acluster to which the data-point belongs. This tells us how similar data-cases are.Example II: Dimensionality Reduction. Instead of a 100 dimensional vectorof real numbers, the data are now represented by a 2 dimensional vectorwhich can be drawn in the plane.The new representation is smaller and hence more convenient computationally.Example I: A text corpus has about 1M documents. Each document is representedas a 20,000 dimensional count vector for each word in the vocabulary.Dimensionality reduction turns this into a (say) 50 dimensional vector for each doc.However: in the new representation documents which are on the same topic,but do not necessarily share keywords have moved closer together!
5 Clustering: K-means We iterate two operations: 1. Update the assignment of data-cases to clusters2. Update the location of the cluster.Denote the assignment of data-case “i” to cluster “c”.Denote the position of cluster “c” in a d-dimensional space.Denote the location of data-case iThen iterate until convergence:1. For each data-case, compute distances to each cluster and the closest one:2. For each cluster location, compute the mean location of all data-casesassigned to it:Nr. of data-cases in cluster cSet of data-cases assigned to cluster c
6 K-means Cost function: Each step in k-means decreases this cost function.Often initialization is very important since there are very many local minima in C.Relatively good initialization: place cluster locations on K randomly chosen data-cases.How to choose K?Add complexity term: and minimize also over KOr X-validationOr Bayesian methodsHomework: Derive the k-means algorithm by showing that:step 1 minimizes C over z, keeping the cluster locations fixed.step 2 minimizes C over cluster locations, keeping z fixed.
7 Vector QuantizationK-means divides the space up in a Voronoi tesselation.Every point on a tile is summarized by the code-book vector “+”.This clearly allows for data compression !
8 Mixtures of GaussiansK-means assigns each data-case to exactly 1 cluster. But what ifclusters are overlapping?Maybe we are uncertain as to which cluster it really belongs.The mixtures of Gaussians algorithm assigns data-cases to cluster witha certain probability.
9 MoG Clustering Covariance determines the shape of these contours Idea: fit these Gaussian densities to the data, one per cluster.
10 EM Algorithm: E-step“r” is the probability that data-case “i” belongs to cluster “c”.is the a priori probability of being assigned to cluster “c”.Note that if the Gaussian has high probability on data-case “i”(i.e. the bell-shape is on top of the data-case) then it claims highresponsibility for this data-case.The denominator is just to normalize all responsibilities to 1:Homework: Imagine there are only two identical Gaussians and they both have theirmeans equal to Xi (the location of data-case “i”). Compute the responsibilities fordata-case “i”. What happens if one Gaussian has much larger variance than the other?
11 EM Algorithm: M-Steptotal responsibility claimed by cluster “c”expected fraction of data-cases assigned to this clusterweighted sample mean where every data-case is weightedaccording to the probability that it belongs to that cluster.weighted sample covarianceHomework: show that k-means is a special case of the E and M steps.
12 EM-MoGEM comes from “expectation maximization”. We won’t go through the derivation.If we are forced to decide, we should assign a data-case to the cluster whichclaims highest responsibility.For a new data-case, we should compute responsibilities as in the E-stepand pick the cluster with the largest responsibility.E and M steps should be iterated until convergence (which is guaranteed).Every step increases the following objective function (which is the totallog-probability of the data under the model we are learning):
13 Dimensionality Reduction Instead of organized in clusters, the data may be approximately lying on a(perhaps curved) manifold.Most information in the data would be retained if we project the data on thislow dimensional manifold.Advantages: visualization, extracting meaning attributes, computational efficiency
14 Principal Components Analysis We search for those directions in space that have the highest variance.We then project the data onto the subspace of highest variance.This structure is encoded in the sample co-variance of the data:
15 PCAWe want to find the eigenvectors and eigenvalues of this covariance:( in matlab [U,L]=eig(C) )eigenvalue = variancein direction eigenvectorOrthogonal, unit-length eigenvectors.
16 PCA properties check this (U eigevectors) (u orthonormal U rotation) (rank-k approximation)(projection)Homework: What projection z has covariance C=I in k dimensions ?
17 PCA propertiesis the optimal rank-k approximation of C in Frobenius norm.I.e. it minimizes the cost-function:Note that there are infinite solutions that minimize this norm.If A is a solution, then is also a solution.The solution provided by PCA is unique because U is orthogonal and orderedby largest eigenvalue.Solution is also nested: if I solve for a rank-k+1 approximation, I will find thatthe first k eigenvectors are those found by an rank-k approximation (etc.)
18 Homework Imagine I have 1000 20x20 images of faces. Each pixel is an attribute Xi and can take continuousvalues in the interval [0,1].Let’s say I am interested in finding the four “eigen-faces” that span mostof the variance in the data.Provide pseudo-code of how to find these four eigen-faces.