clustering unsupervised learning
play

Clustering / Unsupervised Learning The target features are not given - PowerPoint PPT Presentation

Clustering / Unsupervised Learning The target features are not given in the training examples The aim is to construct a natural classification that can be used to predict features of the data. D. Poole and A. Mackworth 2010 c Artificial


  1. Clustering / Unsupervised Learning The target features are not given in the training examples The aim is to construct a natural classification that can be used to predict features of the data. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 1

  2. Clustering / Unsupervised Learning The target features are not given in the training examples The aim is to construct a natural classification that can be used to predict features of the data. The examples are partitioned in into clusters or classes. Each class predicts feature values for the examples in the class. ◮ In hard clustering each example is placed definitively in a class. ◮ In soft clustering each example has a probability distribution over its class. Each clustering has a prediction error on the examples. The best clustering is the one that minimizes the error. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 2

  3. k -means algorithm The k -means algorithm is used for hard clustering. Inputs: training examples the number of classes, k Outputs: a prediction of a value for each feature for each class an assignment of examples to classes � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 3

  4. k -means algorithm formalized E is the set of all examples the input features are X 1 , . . . , X n val ( e , X j ) is the value of feature X j for example e . there is a class for each integer i ∈ { 1 , . . . , k } . The k -means algorithm outputs a function class : E → { 1 , . . . , k } . class ( e ) = i means e is in class i . a pval function where pval ( i , X j ) is the prediction for each example in class i for feature X j . The sum-of-squares error for class and pval is n � � ( pval ( class ( e ) , X j ) − val ( e , X j )) 2 . e ∈ E j =1 Aim: find class and pval that minimize sum-of-squares error. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 4

  5. Minimizing the error The sum-of-squares error for class and pval is n � � ( pval ( class ( e ) , X j ) − val ( e , X j )) 2 . e ∈ E j =1 Given class , the pval that minimizes the sum-of-squares error is � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 5

  6. Minimizing the error The sum-of-squares error for class and pval is n � � ( pval ( class ( e ) , X j ) − val ( e , X j )) 2 . e ∈ E j =1 Given class , the pval that minimizes the sum-of-squares error is the mean value for that class. Given pval , each example can be assigned to the class that � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 6

  7. Minimizing the error The sum-of-squares error for class and pval is n � � ( pval ( class ( e ) , X j ) − val ( e , X j )) 2 . e ∈ E j =1 Given class , the pval that minimizes the sum-of-squares error is the mean value for that class. Given pval , each example can be assigned to the class that minimizes the error for that example. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 7

  8. k -means algorithm Initially, randomly assign the examples to the classes. Repeat the following two steps: For each class i and feature X j , � e : class ( e )= i val ( e , X j ) pval ( i , X j ) ← |{ e : class ( e ) = i }| , For each example e , assign e to the class i that minimizes n � ( pval ( i , X j ) − val ( e , X j )) 2 . j =1 until the second step does not change the assignment of any example. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 8

  9. Example Data 10 8 6 4 2 0 0 2 4 6 8 10 � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 9

  10. Random Assignment to Classes 10 8 6 4 2 0 0 2 4 6 8 10 � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 10

  11. Assign Each Example to Closest Mean 10 8 6 4 2 0 0 2 4 6 8 10 � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 11

  12. Ressign Each Example to Closest Mean 10 8 6 4 2 0 0 2 4 6 8 10 � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 12

  13. Properties of k -means An assignment of examples to classes is stable if running both the M step and the E step does not change the assignment. This algorithm will eventually converge to a stable local minimum. Any permutation of the labels of a stable assignment is also a stable assignment. It is not guaranteed to converge to a global minimum. It is sensitive to the relative scale of the dimensions. Increasing k can always decrease error until k is the number of different examples. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 13

  14. EM Algorithm Used for soft clustering — examples are probabilistically in classes. k -valued random variable C Model Data Probabilities ➪ X 1 X 2 X 3 X 4 P ( C ) t f t t P ( X 1 | C ) C f t t f P ( X 2 | C ) f f t t P ( X 3 | C ) X1 X2 X3 X4 · · · P ( X 4 | C ) � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 14

  15. EM Algorithm M-step X 1 X 2 X 3 X 4 C count . . . . . . P ( C ) . . . . . . . . . . . . P ( X 1 | C ) t f t t 1 0.4 P ( X 2 | C ) t f t t 2 0.1 P ( X 3 | C ) t f t t 3 0.5 P ( X 4 | C ) . . . . . . . . . . . . . . . . . . E-step � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 15

  16. EM Algorithm Overview Repeat the following two steps: E-step give the expected number of data points for the ◮ unobserved variables based on the given probability distribution. M-step infer the (maximum likelihood or maximum ◮ aposteriori probability) probabilities from the data. Start either with made-up data or made-up probabilities. EM will converge to a local maxima. � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 16

  17. Augmented Data — E step Suppose k = 3, and dom ( C ) = { 1 , 2 , 3 } . P ( C = 1 | X 1 = t , X 2 = f , X 3 = t , X 4 = t ) = 0 . 407 P ( C = 2 | X 1 = t , X 2 = f , X 3 = t , X 4 = t ) = 0 . 121 P ( C = 3 | X 1 = t , X 2 = f , X 3 = t , X 4 = t ) = 0 . 472: A [ X 1 , . . . , X 4 , C ] � �� � X 1 X 2 X 3 X 4 C Count . . . . . . X 1 X 2 X 3 X 4 Count . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 40 . 7 t f t t − → t f t t 100 t f t t 2 12 . 1 . . . . . 3 47 . 2 . . . . . t f t t . . . . . . . . . . . . . . . . . . . . . . . � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 17

  18. M step C X 1 X 2 X 3 X 4 C Count . . . . . . . . . . . . . . . . . . X1 X2 X3 X4 1 40 . 7 t f t t − → t f t t 2 12 . 1 3 47 . 2 t f t t . . . . . . . . . . . . . . . . . . � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 18

  19. M step C X 1 X 2 X 3 X 4 C Count . . . . . . . . . . . . . . . . . . X1 X2 X3 X4 1 40 . 7 t f t t − → t f t t 2 12 . 1 3 47 . 2 t f t t . . . . . . . . . . . . . . . . . . � = C = v i Count ( t ) t | P ( C = v i ) = � t Count ( t ) � = C = v i ∧ X k = v j Count ( t ) t | P ( X k = v j | C = v i ) = � = C = v i Count ( t ) t | ...perhaps including pseudo-counts � D. Poole and A. Mackworth 2010 c Artificial Intelligence, Lecture 11.1, Page 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend