Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

No Downloads

Total views

917

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

21

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Mining di dati web Clustering di Documenti Web: Le metriche di similarità A.A 2006/2007
- 2. Learning: What does it Means? <ul><li>Definition from Wikipedia: </li></ul><ul><ul><li>Machine learning is an area of artificial intelligence concerned with the development of techniques which allow computers to "learn". </li></ul></ul><ul><ul><li>More specifically, machine learning is a method for creating computer programs by the analysis of data sets. </li></ul></ul><ul><ul><li>Machine learning overlaps heavily with statistics, since both fields study the analysis of data, but unlike statistics, machine learning is concerned with the algorithmic complexity of computational implementations. </li></ul></ul>
- 3. And… What about Clustering? <ul><li>Again from Wikipedia: </li></ul><ul><ul><li>Data clustering is a common technique for statistical data analysis, which is used in many fields, including machine learning, data mining, pattern recognition, image analysis and bioinformatics. Clustering is the classification of similar objects into different groups, or more precisely, the partitioning of a data set into subsets (clusters), so that the data in each subset (ideally) share some common trait - often proximity according to some defined distance measure. </li></ul></ul><ul><ul><li>Machine learning typically regards data clustering as a form of unsupervised learning . </li></ul></ul>
- 4. What clustering is? d intra d inter
- 5. Clustering <ul><li>Example where euclidean distance is the distance metric </li></ul><ul><li>hierarchical clustering dendrogram </li></ul>
- 6. Clustering: K-Means <ul><li>Randomly generate k clusters and determine the cluster centers or directly generate k seed points as cluster centers </li></ul><ul><li>Assign each point to the nearest cluster center . </li></ul><ul><li>Recompute the new cluster centers. </li></ul><ul><li>Repeat until some convergence criterion is met (usually that the assignment hasn't changed). </li></ul>
- 7. K-means Clustering <ul><li>Each point is assigned to the cluster with the closest center point </li></ul><ul><li>The number K, must be specified </li></ul><ul><li>Basic algorithm </li></ul><ul><li>Select K points as the initial center points. </li></ul><ul><li>Repeat </li></ul><ul><li>2. Form K clusters by assigning all points to the closet center point. </li></ul><ul><li>3. Recompute the center point of each cluster </li></ul><ul><li>Until the center points don’t change </li></ul>
- 8. Example 1: data points image the k-means clustering result.
- 9. K-means clustering result
- 10. Importance of Choosing Initial Guesses (1)
- 11. Importance of Choosing Initial Guesses (2)
- 12. Local optima of K-means <ul><li>The local optima of ‘K-means’ </li></ul><ul><ul><li>Kmeans is to minimize the “sum of point-centroid” distances. The optimization is difficult. </li></ul></ul><ul><ul><li>After each iteration of K-means the MSE (mean square error) decreases. But K-means may converge to a local optimum. So K-means is sensitive to initial guesses. </li></ul></ul>Supplement to K-means
- 13. Example 2: data points
- 14. Image the clustering result
- 15. Example 2: K-means clustering result
- 16. Limitations of K-means <ul><li>K-means has problem when clusters are of differing </li></ul><ul><ul><li>Sizes </li></ul></ul><ul><ul><li>Densities </li></ul></ul><ul><ul><li>Non-globular shapes </li></ul></ul><ul><li>K-means has problems when the data contains outliers </li></ul><ul><li>One solution is to use many clusters </li></ul><ul><ul><li>Find parts of clusters, but need to put together </li></ul></ul>
- 17. Clustering: K-Means <ul><li>The main advantages of this algorithm are its simplicity and speed which allows it to run on large datasets. Its disadvantage is that it does not yield the same result with each run, since the resulting clusters depend on the initial random assignments. </li></ul><ul><li>It maximizes inter-cluster (or minimizes intra-cluster) variance, but does not ensure that the result has a global minimum of variance. </li></ul>
- 18. d_intra or d_inter? That is the question! <ul><li>d_intra is the distance among elements (points or objects, or whatever) of the same cluster. </li></ul><ul><li>d_inter is the distance among clusters. </li></ul><ul><li>Questions: </li></ul><ul><ul><li>Should we use distance or similarity? </li></ul></ul><ul><ul><li>Should we care about inter cluster distance? </li></ul></ul><ul><ul><li>Should we care about cluster shape? </li></ul></ul><ul><ul><li>Should we care about clustering? </li></ul></ul>
- 19. Distance Functions <ul><li>Informal definition: </li></ul><ul><ul><li>The distance between two points is the length of a straight line segment between them. </li></ul></ul><ul><li>A more formal definition: </li></ul><ul><ul><li>A distance between two points P and Q in a metric space is d ( P , Q ), where d is the distance function that defines the given metric space. </li></ul></ul><ul><ul><li>We can also define the distance between two sets A and B in a metric space as being the minimum (or infimum) of distances between any two points P in A and Q in B . </li></ul></ul>
- 20. Distance or Similarity? <ul><li>In a very straightforward way we can define the Similarity function sim: SxS [0,1] as sim(o 1 ,o 2 ) = 1 - d(o 1 ,o 2 ) where o 1 and o 2 are elements of the space S . </li></ul>d = 0.3 sim = 0.7 d = 0.1 sim = 0.9
- 21. What does similar (or distant) really mean? <ul><li>Learning (either supervised or unsupervised) is impossible without ASSUMPTIONS </li></ul><ul><ul><li>Watanabe’s Ugly Duckling theorem </li></ul></ul><ul><ul><li>Wolpert’s No Free Lunch theorem </li></ul></ul><ul><li>Learning is impossible without some sort of bias . </li></ul>
- 22. The Ugly Duckling theorems The theorem gets its fanciful name from the following counter-intuitive statement: assuming similarity is based on the number of shared predicates, an ugly duckling is as similar to a beautiful swan A as a beautiful swan B is to A, given that A and B differ at all. It was proposed and proved by Satosi Watanabe in 1969.
- 23. Satosi’s Theorem <ul><li>Let n be the cardinality of the Universal set S . </li></ul><ul><li>We have to classify them without prior knowledge on the essence of categories. </li></ul><ul><li>The number of different classes, i.e. the different way to group the objects into clusters, is given by the cardinality of the Power Set of S : </li></ul><ul><ul><li>|Pow(S)|=2 n </li></ul></ul><ul><li>Without any prior information, the most natural way to measure the similarity among two distinct objects we can measure the number of classes they share. </li></ul><ul><li>Oooops… They share exactly the same number of classes, namely 2 n-2 . </li></ul>
- 24. The ugly duckling and 3 beautiful swans <ul><li>S={o 1 ,o 2 ,o 3 ,o 4 } </li></ul><ul><li>Pow(S) = { {},{o 1 },{o 2 },{o 3 },{o 4 }, {o 1 ,o 2 },{o 1 ,o 3 },{o 1 ,o 4 }, {o 2 ,o 3 },{o 2 ,o 4 },{o 3 ,o 4 }, {o 1 ,o 2 ,o 3 },{o 1 ,o 2 ,o 4 }, {o 1 ,o 3 ,o 4 },{o 2 ,o 3 ,o 4 }, {o 1 ,o 2 ,o 3 ,o 4 } } </li></ul><ul><li>How many classes have in common o i , o j i<>j? </li></ul><ul><ul><li>o 1 and o 3 </li></ul></ul><ul><ul><ul><li>4 </li></ul></ul></ul><ul><ul><li>o 1 and o 4 </li></ul></ul><ul><ul><ul><li>4 </li></ul></ul></ul>
- 25. The ugly duckling and 3 beautiful swans <ul><li>In binary 0000, 0001, 0010, 0100, 1000,… </li></ul><ul><li>Chose two objects </li></ul><ul><li>Reorder the bits so that the chosen object are represented by the first two bits. </li></ul><ul><li>How many strings share the first two bits set to 1? </li></ul><ul><ul><li>2 n-2 </li></ul></ul>
- 26. Wolpert’s No Free Lunch Theorem <ul><li>For any two algorithms, A and B, there exist datasets for which algorithm A outperform algorithm B in prediction accuracy on unseen instances. </li></ul><ul><li>Proof: Take any Boolean concept. If A outperforms B on unseen instances, reverse the labels and B will outperforms A. </li></ul>
- 27. So Let’s Get Back to Distances <ul><li>In a metric space a distance is a function d:SxS-> R so that if a,b,c are elements of S: </li></ul><ul><ul><li>d(a,b) ≥ 0 </li></ul></ul><ul><ul><li>d(a,b) = 0 iff a=b </li></ul></ul><ul><ul><li>d(a,b) = d(b,a) </li></ul></ul><ul><ul><li>d(a,c) ≤ d(a,b) + d(b,c) </li></ul></ul><ul><li>The fourth property (triangular inequality) holds only if we are in a metric space. </li></ul>
- 28. Minkowski Distance <ul><li>Let’s consider two elements of a set S described by their feature vectors: </li></ul><ul><ul><li>x=(x 1 , x 2 , …, x n ) </li></ul></ul><ul><ul><li>y=(y 1 , y 2 , …, y n ) </li></ul></ul><ul><li>The Minkowski Distance is parametric in p>1 </li></ul>
- 29. p=1 . Manhattan Distance <ul><li>If p = 1 the distance is called Manhattan Distance. </li></ul><ul><li>It is also called taxicab distance because it is the distance a car would drive in a city laid out in square blocks (if there are no one-way streets). </li></ul>
- 30. p=2 . Euclidean Distance <ul><li>If p = 2 the distance is the well known Euclidean Distance. </li></ul>
- 31. p= . Chebyshev Distance <ul><li>If p = then we must take the limit. </li></ul><ul><li>It is also called chessboard Distance . </li></ul>
- 32. 2D Cosine Similarity <ul><li>It’s easy to explain in 2D. </li></ul><ul><li>Let’s consider a=(x 1 ,y 1 ) and b=(x 2 ,y 2 ). </li></ul> a b
- 33. Cosine Similarity <ul><li>Let’s consider two points x, y in R n . </li></ul>
- 34. Jaccard Distance <ul><li>Another commonly used distance is the Jaccard Distance: </li></ul>
- 35. Binary Jaccard Distance <ul><li>In the case of binary feature vector the Jaccard Distance could be simplified to: </li></ul>
- 36. Edit Distance <ul><li>The Levenshtein distance or edit distance between two strings is given by the minimum number of operations needed to transform one string into the other, where an operation is an insertion, deletion, or substitution of a single character </li></ul>
- 37. Binary Edit Distance <ul><li>The binary edit distance , d(x,y) , from a binary vector x to a binary vector y is the minimum number of simple flips required to transform one vector to the other </li></ul>x=(0,1,0,0,1,1) y=(1,1,0,1,0,1) d(x,y)=3 The binary edit distance is equivalent to the Manhattan distance ( Minkowski p=1 ) for binary features vectors.
- 38. The Curse of High Dimensionality <ul><li>The dimensionality is one of the main problem to face when clustering data. </li></ul><ul><li>Roughly speaking the higher the dimensionality the lower the power of recognizing similar objects. </li></ul>
- 39. Volume of the Unit-Radius Sphere
- 40. Sphere/Cube Volume Ratio <ul><li>Unit-radius Sphere / Cube whose edge lenghts is 2. </li></ul>
- 41. Sphere/Sphere Volume Ratio <ul><li>Two embedded spheres. Radiuses 1 and 0.9. </li></ul>
- 42. Concentration of the Norm Phenomenon <ul><li>Gaussian distributions of points (std. dev. = 1). Dimensions (1,2,3,5,10, and 20). </li></ul><ul><li>Probability Density Functions to find a point drawn according to a Gaussian distribution, at distance r from the center of that distribution. </li></ul>
- 43. Web Document Representation <ul><li>The Web can be characterized in three different ways: </li></ul><ul><ul><li>Content. </li></ul></ul><ul><ul><li>Structure. </li></ul></ul><ul><ul><li>Usage. </li></ul></ul><ul><li>We are concerned with Web Content information. </li></ul>
- 44. Bag-of-Words vs. Vector-Space <ul><li>Let C be a collection of N documents d 1 , d 2 , …, d N </li></ul><ul><li>Each document is composed of terms drawn from a term-set of dimension T. </li></ul><ul><li>Each document can be represented in two different ways: </li></ul><ul><ul><li>Bag-of-Words. </li></ul></ul><ul><ul><li>Vector-Space. </li></ul></ul>
- 45. Bag-of-Words <ul><li>In the bag-of-words model the document is represented as d={Apple,Banana,Coffee,Peach} </li></ul><ul><li>Each term is represented. </li></ul><ul><li>No information on frequency. </li></ul><ul><li>Binary encoding. t-dimensional Bitvector </li></ul>d=[1,0,1,1,0,0,0,1]. Apple Peach Apple Banana Apple Banana Coffee Apple Coffee Apple Peach Apple Banana Apple Banana Coffee Apple Coffee d=[ 1 ,0, 1 , 1 ,0,0,0, 1 ].
- 46. Vector-Space <ul><li>In the vector-space model the document is represented as d={<Apple,4>,<Banana,2>,<Coffee,2>,<Peach,2>} </li></ul><ul><li>Information about frequency are recorded. </li></ul><ul><li>t-dimensional vectors. </li></ul>Apple Peach Apple Banana Apple Banana Coffee Apple Coffee Apple Peach Apple Banana Apple Banana Coffee Apple Coffee d=[4,0,2,2,0,0,0,1]. d=[ 4 ,0, 2 , 2 ,0,0,0, 1 ].
- 47. Typical Web Collection Dimensions <ul><li>No. of documents: 20B </li></ul><ul><li>No of terms is approx 150,000,000!!! </li></ul><ul><ul><li>Very high dimensionality… </li></ul></ul><ul><li>Each document contains from 100 to 1000 terms. </li></ul><ul><li>Classical clustering algorithm cannot be used. </li></ul><ul><ul><li>Each document is very similar to the other due to the geometric properties just seen. </li></ul></ul>
- 48. We Need to Cope with High Dimensionality <ul><li>Possible solutions: </li></ul><ul><li>JUST ONE… Reduce Dimensions!!!! </li></ul>
- 49. Dimensionality reduction <ul><li>dimensionality reduction approaches can be divided into two categories: </li></ul><ul><ul><li>feature selection approaches try to find a subset of the original features. Optimal feature selection for supervised learning problems requires an exhaustive search of all possible subsets of features of the chosen cardinality </li></ul></ul><ul><ul><li>feature extraction is applying a mapping of the multidimensional space into a space of fewer dimensions . This means that the original feature space is transformed by applying e.g. a linear transformation via a principal components analysis </li></ul></ul>
- 50. PCA - Principal Component Analysis <ul><li>In statistics, principal components analysis (PCA) is a technique that can be used to simplify a dataset. </li></ul><ul><li>More formally it is a linear transformation that chooses a new coordinate system for the data set such that the greatest variance by any projection of the data set comes to lie on the first axis (then called the first principal component), the second greatest variance on the second axis, and so on. </li></ul><ul><li>PCA can be used for reducing dimensionality in a dataset while retaining those characteristics of the dataset that contribute most to its variance by eliminating the later principal components (by a more or less heuristic decision). </li></ul>
- 51. The Method <ul><li>Suppose you have a random vector population x: </li></ul><ul><ul><li>x=(x 1 ,x 2 , …, x n ) T </li></ul></ul><ul><li>and the mean: </li></ul><ul><ul><li> x =E{x} </li></ul></ul><ul><li>and the covariance matrix: </li></ul><ul><ul><li>C x =E{(x- x )(x- x ) T } </li></ul></ul>
- 52. The Method <ul><li>The components of C x , denoted by c ij , represent the covariances between the random variable components x i and x j . The component c ii is the variance of the component x i . The variance of a component indicates the spread of the component values around its mean value. If two components x i and x j of the data are uncorrelated, their covariance is zero ( c ij = c ji = 0 ). </li></ul><ul><li>The covariance matrix is, by definition, always symmetric. </li></ul><ul><li>Take a sample of vectors x 1 , x 2 , …, x M we can calculate the sample mean and the sample covariance matrix as the estimates of the mean and the covariance matrix. </li></ul>
- 53. The Method <ul><li>From a symmetric matrix such as the covariance matrix, we can calculate an orthogonal basis by finding its eigenvalues and eigenvectors. The eigenvectors e i and the corresponding eigenvalues i are the solutions of the equation: C x e i = i e i ==> | C x - I |=0 </li></ul><ul><li>By ordering the eigenvectors in the order of descending eigenvalues (largest first), one can create an ordered orthogonal basis with the first eigenvector having the direction of largest variance of the data. In this way, we can find directions in which the data set has the most significant amounts of energy. </li></ul>Computationally expensive task
- 54. The Method <ul><li>By ordering the eigenvectors in the order of descending eigenvalues (largest first), one can create an ordered orthogonal basis with the first eigenvector having the direction of largest variance of the data. In this way, we can find directions in which the data set has the most significant amounts of energy. </li></ul><ul><li>To reduce n to k take the first k eigenvectors. </li></ul>
- 55. A Graphical Example
- 56. PCA Eigenvectors Projection <ul><li>Project the data onto the selected eigenvectors: </li></ul>
- 57. Another Example
- 58. Singular Value Decomposition <ul><li>Is a technique used for reducing dimensionality based on some properties of symmetric matrices. </li></ul><ul><li>Will be the subject for a talk given by one of you!!!! </li></ul>
- 59. Locality-Sensitive Hashing <ul><li>The key idea of this approach is to create a small signature for each documents, to ensure that similar documents have similar signatures. </li></ul><ul><li>There exists a family H of hash functions such that for each pair of pages u , v we have Pr [ mh ( u ) = mh ( v )] = sim ( u,v ), where the hash function mh is chosen at random from the family H . </li></ul>
- 60. Locality-Sensitive Hashing <ul><li>Will be a subject of a talk given by one of you!!!!!!! </li></ul>

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment