ML Classification (Lecture 10) (Các khái niệm cơ bản, thuật toán KNN và cây quyết định)

UN
Uni24h
0 téléchargements
124
0

Contenu du document

Page 3

Classification: Definition • Given a collection of records (training set ) – Each record contains a set of attributes, one of the attributes is the class. • Find a model for class attribute as a function of the values of other attributes. • Goal: previously unseen records should be assigned a class as accurately as possible. – A test set is used to determine the accuracy of the model. Usually, the given data set is divided into training and test sets, with training set used to build the model and test set used to validate it.

Page 4

Illustrating Classification Task Tid Attrib1 Attrib2 Attrib3 Class Learning 1 Yes Large 125K No algorithm 2 No Medium 100K No 3 No Small 70K No 4 Yes Medium 120K No Induction 5 No Large 95K Yes 6 No Medium 60K No 7 Yes Large 220K No Learn 8 No Small 85K Yes Model 9 No Medium 75K No 10 No Small 90K Yes 10 Training Set Model Apply Model Tid Attrib1 Attrib2 Attrib3 Class 11 No Small 55K ? 12 Yes Medium 80K ? 13 Yes Large 110K ? Deduction 14 No Small 95K ? 15 No Large 67K ? 10 Test Set

Page 5

Examples of Classification Task • Predicting tumor cells as benign or malignant • Classifying credit card transactions as legitimate or fraudulent • Classifying secondary structures of protein as alpha-helix, beta-sheet, or random coil • Categorizing news stories as finance, weather, entertainment, sports, etc

Page 6

Classification Using Distance • Place items in class to which they are “closest”. • Must determine distance between an item and a class. • Classes represented by – Centroid: Central value. – Medoid: Representative point. – Individual points • Algorithm: KNN

Page 7

Classification Techniques • Decision Tree based Methods • Rule-based Methods • Memory based reasoning • Neural Networks • Naïve Bayes and Bayesian Belief Networks • Support Vector Machines

Page 8

A first example Database of 20,000 images of handwritten digits, each labeled by a human [28 x 28 greyscale; pixel values 0-255; labels 0-9] Use these to learn a classifier which will label digit-images automatically…

Page 9

The learning problem Input space X = {0,1,…,255}784 Output space Y = {0,1,…,9} Training set Learning Classifier (x1, y1), …, (xm, ym) Algorithm f: X ! Y m = 20000 To measure how good f is: use a test set [Our test set: 100 instances of each digit.]

Page 10

A possible strategy Input space X = {0,1,…,255}784 Output space Y = {0,1,…,9} Treat each image as a point in 784-dimensional Euclidean space To classify a new image: find its nearest neighbor in the database (training set) and return that label f = entire training set + search engine

Page 11

K Nearest Neighbor (KNN): • Training set includes classes. • Examine K items near item to be classified. • New item placed in class with the most number of close items. • O(q) for each tuple to be classified. (Here q is the size of the training set.)

Page 13

Nearest neighbor Image to label Nearest neighbor Overall: error rate = 6% (on test set) Question: what is the error rate for random guessing?

Page 14

What does it get wrong? Who knows… but here’s a hypothesis: Each digit corresponds to some connected region of R784. Some of the regions come close to each other; problems occur at these boundaries. R1 R 2 e.g. a random point in this ball has only a 70% chance of being in R2

Page 15

Nearest neighbor: pros and cons Pros Simple Flexible Excellent performance on a wide range of tasks Cons Algorithmic: time consuming – with n training points in Rd, time to label a new point is O(nd) Statistical: memorization, not learning! no insight into the domain would prefer a compact classifier

Page 16

Prototype selection A possible fix: instead of the entire training set, just keep a “representative sample” Voronoi cells “Decision boundary”

Page 17

Prototype selection A possible fix: instead of the entire training set, just keep a “representative sample” Voronoi cells “Decision boundary”

Page 18

How to pick prototypes? They needn’t be actual data points Idea 2: one prototype per class: mean of training points Examples: Error = 23%

Page 19

Postscript: learning models Batch learning On-line learning Training data See a new point x Learning Algorithm predict label Classifier f See y Update test classifer

Page 20

Example of a Decision Tree Splitting Attributes Tid Refund Marital Taxable Status Income Cheat 1 Yes Single 125K No 2 No Married 100K No Refund Yes No 3 No Single 70K No 4 Yes Married 120K No NO MarSt 5 No Divorced 95K Yes Single, Divorced Married 6 No Married 60K No 7 Yes Divorced 220K No TaxInc NO 8 No Single 85K Yes < 80K > 80K 9 No Married 75K No NO YES 10 No Single 90K Yes 10 Training Data Model: Decision Tree

Affichage des 20 premières pages. Téléchargez le document pour le voir en entier.

Commentaires (0)

Se connecter pour rejoindre la discussion

Aucun commentaire pour le moment. Soyez le premier !