Dear SIR, I am Mr. John Coleman and my sister is Miss Rose Colemen, we are the children of late Chief Paul Colemen from Sierra Leone. I am writing you.

Slides:



Advertisements
Similar presentations
1 Classification using instance-based learning. 3 March, 2000Advanced Knowledge Management2 Introduction (lazy vs. eager learning) Notion of similarity.
Advertisements

Data Mining Classification: Alternative Techniques
1 CS 391L: Machine Learning: Instance Based Learning Raymond J. Mooney University of Texas at Austin.
Indian Statistical Institute Kolkata
Instance Based Learning
1 Machine Learning: Lecture 7 Instance-Based Learning (IBL) (Based on Chapter 8 of Mitchell T.., Machine Learning, 1997)
Theoretical Probability Distributions We have talked about the idea of frequency distributions as a way to see what is happening with our data. We have.
Mining Time Series.
Nearest Neighbor. Predicting Bankruptcy Nearest Neighbor Remember all your data When someone asks a question –Find the nearest old data point –Return.
x – independent variable (input)
Tirgul 10 Rehearsal about Universal Hashing Solving two problems from theoretical exercises: –T2 q. 1 –T3 q. 2.
Classification Dr Eamonn Keogh Computer Science & Engineering Department University of California - Riverside Riverside,CA Who.
1 Classification: Definition Given a collection of records (training set ) Each record contains a set of attributes, one of the attributes is the class.
Naïve Bayes Classifier
Classification Continued
Pattern Classification All materials in these slides were taken from Pattern Classification (2nd ed) by R. O. Duda, P. E. Hart and D. G. Stork, John Wiley.
1 Confidence Interval for the Population Mean. 2 What a way to start a section of notes – but anyway. Imagine you are at the ground level in front of.
Aprendizagem baseada em instâncias (K vizinhos mais próximos)
KNN, LVQ, SOM. Instance Based Learning K-Nearest Neighbor Algorithm (LVQ) Learning Vector Quantization (SOM) Self Organizing Maps.
Pattern Classification All materials in these slides were taken from Pattern Classification (2nd ed) by R. O. Duda, P. E. Hart and D. G. Stork, John Wiley.
Dear SIR, I am Mr. John Coleman and my sister is Miss Rose Colemen, we are the children of late Chief Paul Colemen from Sierra Leone. I am writing you.
Classification.
CS Instance Based Learning1 Instance Based Learning.
Learning at Low False Positive Rate Scott Wen-tau Yih Joshua Goodman Learning for Messaging and Adversarial Problems Microsoft Research Geoff Hulten Microsoft.
Module 04: Algorithms Topic 07: Instance-Based Learning
Nearest Neighbor Learning
GEOMETRIC VIEW OF DATA David Kauchak CS 451 – Fall 2013.
§ 4.3 Equations and Inequalities Involving Absolute Value.
ADVANCED CLASSIFICATION TECHNIQUES David Kauchak CS 159 – Fall 2014.
CISC 4631 Data Mining Lecture 03: Introduction to classification Linear classifier Theses slides are based on the slides by Tan, Steinbach and Kumar (textbook.
Extending the Definition of Exponents © Math As A Second Language All Rights Reserved next #10 Taking the Fear out of Math 2 -8.
UCR CS 235 Data Mining Winter 2011 TA: Abdullah Mueen Eamonn Keogh.
Nearest Neighbor (NN) Rule & k-Nearest Neighbor (k-NN) Rule Non-parametric : Can be used with arbitrary distributions, No need to assume that the form.
SOLIDWORKS: Lesson II – Revolutions, Fillets, & Chamfers UCF Engineering.
1 Learning Chapter 18 and Parts of Chapter 20 AI systems are complex and may have many parameters. It is impractical and often impossible to encode all.
1 E. Fatemizadeh Statistical Pattern Recognition.
The Game of Algebra or The Other Side of Arithmetic The Game of Algebra or The Other Side of Arithmetic © 2007 Herbert I. Gross by Herbert I. Gross & Richard.
Decision Trees Binary output – easily extendible to multiple output classes. Takes a set of attributes for a given situation or object and outputs a yes/no.
METU Informatics Institute Min720 Pattern Classification with Bio-Medical Applications Part 6: Nearest and k-nearest Neighbor Classification.
Support Vector Machines and Gene Function Prediction Brown et al PNAS. CS 466 Saurabh Sinha.
CZ5225: Modeling and Simulation in Biology Lecture 7, Microarray Class Classification by Machine learning Methods Prof. Chen Yu Zong Tel:
Chapter 13 (Prototype Methods and Nearest-Neighbors )
Multiplication of Common Fractions © Math As A Second Language All Rights Reserved next #6 Taking the Fear out of Math 1 3 ×1 3 Applying.
Machine Learning ICS 178 Instructor: Max Welling Supervised Learning.
5 INTEGRALS.
The inference and accuracy We learned how to estimate the probability that the percentage of some subjects in the sample would be in a given interval by.
SUPERVISED AND UNSUPERVISED LEARNING Presentation by Ege Saygıner CENG 784.
Machine Learning Machine learning explores the study and construction of algorithms that can learn from data. Basic Idea: Instead of trying to create a.
Pattern Classification All materials in these slides were taken from Pattern Classification (2nd ed) by R. O. Duda, P. E. Hart and D. G. Stork, John Wiley.
Blame Canada. What features can we cheaply measure from coins? 1.Diameter 2.Thickness 3.Weight 4.Electrical Resistance 5.? Probably not color or other.
Stock Market Application: Review
Data Mining Introduction to Classification using Linear Classifiers
It is expanded, starting on page 50….
2- Syllable Classification
The Classification Problem
MIRA, SVM, k-NN Lirong Xia. MIRA, SVM, k-NN Lirong Xia.
Instance Based Learning
*Currently, self driving cars do a bit of both.
Data Mining (and machine learning)
CS 4/527: Artificial Intelligence
*Currently, self driving cars do a bit of both.
K Nearest Neighbor Classification
Data Mining Practical Machine Learning Tools and Techniques
Nearest Neighbor Classifiers
Machine Learning: UNIT-4 CHAPTER-1
Nearest Neighbors CSC 576: Data Mining.
Nearest Neighbor Classifiers
Memory-Based Learning Instance-Based Learning K-Nearest Neighbor
MIRA, SVM, k-NN Lirong Xia. MIRA, SVM, k-NN Lirong Xia.
Data Mining CSCI 307, Spring 2019 Lecture 6
Presentation transcript:

Dear SIR, I am Mr. John Coleman and my sister is Miss Rose Colemen, we are the children of late Chief Paul Colemen from Sierra Leone. I am writing you in absolute confidence primarily to seek your assistance to transfer our cash of twenty one Million Dollars ($21, ) now in the custody of a private Security trust firm in Europe the money is in trunk boxes deposited and declared as family valuables by my late father as a matter of fact the company does not know the content as money, although my father made them to under stand that the boxes belongs to his foreign partner. …

This mail is probably spam. The original message has been attached along with this report, so you can recognize or block similar unwanted mail in future. See for more details. Content analysis details: (12.20 points, 5 required) NIGERIAN_SUBJECT2 (1.4 points) Subject is indicative of a Nigerian spam FROM_ENDS_IN_NUMS (0.7 points) From: ends in numbers MIME_BOUND_MANY_HEX (2.9 points) Spam tool pattern in MIME boundary URGENT_BIZ (2.7 points) BODY: Contains urgent matter US_DOLLARS_3 (1.5 points) BODY: Nigerian scam key phrase ($NN,NNN,NNN.NN) DEAR_SOMETHING (1.8 points) BODY: Contains 'Dear (something)' BAYES_30 (1.6 points) BODY: Bayesian classifier says spam probability is 30 to 40% [score: ]

Grasshoppers Katydids The Classification Problem (informal definition) Given a collection of annotated data. In this case 5 instances Katydids of and five of Grasshoppers, decide what type of insect the unlabeled example is. Katydid or Grasshopper?

Thorax Length AbdomenLength AntennaeLength MandibleSize Spiracle Diameter Leg Length For any domain of interest, we can measure features Color {Green, Brown, Gray, Other} Has Wings?

Insect ID AbdomenLengthAntennaeLength Insect Class Grasshopper Katydid Grasshopper Grasshopper Katydid Grasshopper Katydid Grasshopper Katydid Katydids ??????? We can store features in a database. My_Collection The classification problem can now be expressed as: Given a training database (My_Collection), predict the class label of a previously unseen instance Given a training database (My_Collection), predict the class label of a previously unseen instance previously unseen instance =

Antenna Length Grasshoppers Katydids Abdomen Length

Antenna Length Grasshoppers Katydids Abdomen Length We will also use this lager dataset as a motivating example… Each of these data objects are called… exemplars (training) examples instances tuples

We will return to the previous slide in two minutes. In the meantime, we are going to play a quick game. I am going to show you some classification problems which were shown to pigeons! Let us see if you are as smart as a pigeon! We will return to the previous slide in two minutes. In the meantime, we are going to play a quick game. I am going to show you some classification problems which were shown to pigeons! Let us see if you are as smart as a pigeon!

Examples of class A Examples of class B Pigeon Problem 1

Examples of class A Examples of class B What class is this object? What about this one, A or B? Pigeon Problem 1

Examples of class A Examples of class B This is a B! Pigeon Problem 1 Here is the rule. If the left bar is smaller than the right bar, it is an A, otherwise it is a B. Here is the rule. If the left bar is smaller than the right bar, it is an A, otherwise it is a B.

Examples of class A Examples of class B Even I know this one Pigeon Problem 2 Oh! This ones hard!

Examples of class A Examples of class B Pigeon Problem 2 So this one is an A. The rule is as follows, if the two bars are equal sizes, it is an A. Otherwise it is a B.

Examples of class A Examples of class B Pigeon Problem 3 This one is really hard! What is this, A or B? This one is really hard! What is this, A or B?

Examples of class A Examples of class B Pigeon Problem 3 It is a B! The rule is as follows, if the square of the sum of the two bars is less than or equal to 100, it is an A. Otherwise it is a B.

Why did we spend so much time with this game? Because we wanted to show that almost all classification problems have a geometric interpretation, check out the next 3 slides…

Examples of class A Examples of class B Pigeon Problem 1 Here is the rule again. If the left bar is smaller than the right bar, it is an A, otherwise it is a B. Here is the rule again. If the left bar is smaller than the right bar, it is an A, otherwise it is a B. Left Bar Right Bar

Examples of class A Examples of class B Pigeon Problem 2 Left Bar Right Bar Let me look it up… here it is.. the rule is, if the two bars are equal sizes, it is an A. Otherwise it is a B.

Examples of class A Examples of class B Pigeon Problem 3 Left Bar Right Bar The rule again: if the square of the sum of the two bars is less than or equal to 100, it is an A. Otherwise it is a B. The rule again: if the square of the sum of the two bars is less than or equal to 100, it is an A. Otherwise it is a B.

Antenna Length Grasshoppers Katydids Abdomen Length

Antenna Length Abdomen Length Katydids Grasshoppers previously unseen instance We can “project” the previously unseen instance into the same space as the database. We have now abstracted away the details of our particular problem. It will be much easier to talk about points in space. previously unseen instance We can “project” the previously unseen instance into the same space as the database. We have now abstracted away the details of our particular problem. It will be much easier to talk about points in space ??????? previously unseen instance =

Simple Linear Classifier previously unseen instance If previously unseen instance above the line then class is Katydid else class is Grasshopper Katydids Grasshoppers R.A. Fisher

The simple linear classifier is defined for higher dimensional spaces…

… we can visualize it as being an n-dimensional hyperplane

It is interesting to think about what would happen in this example if we did not have the 3 rd dimension…

We can no longer get perfect accuracy with the simple linear classifier… We could try to solve this problem by user a simple quadratic classifier or a simple cubic classifier.. However, as we will later see, this is probably a bad idea…

Which of the “Pigeon Problems” can be solved by the Simple Linear Classifier? 1)Perfect 2)Useless 3)Pretty Good Problems that can be solved by a linear classifier are call linearly separable.

A Famous Problem R. A. Fisher’s Iris Dataset. 3 classes 50 of each class The task is to classify Iris plants into one of 3 varieties using the Petal Length and Petal Width. Iris SetosaIris VersicolorIris Virginica Setosa Versicolor Virginica

Setosa Versicolor Virginica We can generalize the piecewise linear classifier to N classes, by fitting N-1 lines. In this case we first learned the line to (perfectly) discriminate between Setosa and Virginica/Versicolor, then we learned to approximately discriminate between Virginica and Versicolor. If petal width > – (0.325 * petal length) then class = Virginica Elseif petal width…

Predictive accuracy Speed and scalability –time to construct the model –time to use the model –efficiency in disk-resident databases Robustness –handling noise, missing values and irrelevant features, streaming data Interpretability: –understanding and insight provided by the model We have now seen one classification algorithm, and we are about to see more. How should we compare them ?

Predictive Accuracy I How do we estimate the accuracy of our classifier? We can use K-fold cross validation Insect ID AbdomenLengthAntennaeLength Insect Class Grasshopper Katydid Grasshopper Grasshopper Katydid Grasshopper Katydid Grasshopper Katydid Katydids We divide the dataset into K equal sized sections. The algorithm is tested K times, each time leaving out one of the K section from building the classifier, but using it to test the classifier instead Accuracy = Number of correct classifications Number of instances in our database K = 5

Predictive Accuracy II Using K-fold cross validation is a good way to set any parameters we may need to adjust in (any) classifier. We can do K-fold cross validation for each possible setting, and choose the model with the highest accuracy. Where there is a tie, we choose the simpler model. Actually, we should probably penalize the more complex models, even if they are more accurate, since more complex models are more likely to overfit (discussed later) Accuracy = 94%Accuracy = 100%

Predictive Accuracy III Accuracy = Number of correct classifications Number of instances in our database Accuracy is a single number, we may be better off looking at a confusion matrix. This gives us additional useful information… CatDogPig Cat10000 Dog9901 Pig45 10 Classified as a… True label is...

We need to consider the time and space requirements for the two distinct phases of classification : Time to construct the classifier In the case of the simpler linear classifier, the time taken to fit the line, this is linear in the number of instances. Time to use the model In the case of the simpler linear classifier, the time taken to test which side of the line the unlabeled instance is. This can be done in constant time. Speed and Scalability I As we shall see, some classification algorithms are very efficient in one aspect, and very poor in the other.

Speed and Scalability II For learning with small datasets, this is the whole picture However, for data mining with massive datasets, it is not so much the (main memory) time complexity that matters, rather it is how many times we have to scan the database. This is because for most data mining operations, disk access times completely dominate the CPU times. For data mining, researchers often report the number of times you must scan the database.

Robustness I We need to consider what happens when we have: Noise For example, a persons age could have been mistyped as 650 instead of 65, how does this effect our classifier? (This is important only for building the classifier, if the instance to be classified is noisy we can do nothing). Missing values For example suppose we want to classify an insect, but we only know the abdomen length (X-axis), and not the antennae length (Y-axis), can we still classify the instance?

Robustness II We need to consider what happens when we have: Irrelevant features For example, suppose we want to classify people as either Suitable_Grad_Student Unsuitable_Grad_Student And it happens that scoring more than 5 on a particular test is a perfect indicator for this problem… 10 If we also use “hair_length” as a feature, how will this effect our classifier?

Robustness III We need to consider what happens when we have: Streaming data For many real world problems, we don’t have a single fixed dataset. Instead, the data continuously arrives, potentially forever… (stock market, weather data, sensor data etc) 10 Can our classifier handle streaming data?

Interpretability Some classifiers offer a bonus feature. The structure of the learned classifier tells use something about the domain. Height Weight As a trivial example, if we try to classify peoples health risks based on just their height and weight, we could gain the following insight (Based of the observation that a single linear classifier does not work well, but two linear classifiers do). There are two ways to be unhealthy, being obese and being too skinny.

Nearest Neighbor Classifier previously unseen instance If the nearest instance to the previously unseen instance is a Katydid class is Katydid else class is Grasshopper Katydids Grasshoppers Joe Hodges Evelyn Fix Antenna Length Abdomen Length

This division of space is called Dirichlet Tessellation (or Voronoi diagram, or Theissen regions). We can visualize the nearest neighbor algorithm in terms of a decision surface… Note the we don’t actually have to construct these surfaces, they are simply the implicit boundaries that divide the space into regions “belonging” to each instance.

The nearest neighbor algorithm is sensitive to outliers… The solution is to…

We can generalize the nearest neighbor algorithm to the K- nearest neighbor (KNN) algorithm. We measure the distance to the nearest K instances, and let them vote. K is typically chosen to be an odd number. K = 1K = 3

Suppose the following is true, if an insects antenna is longer than 5.5 it is a Katydid, otherwise it is a Grasshopper. Using just the antenna length we get perfect classification! Suppose the following is true, if an insects antenna is longer than 5.5 it is a Katydid, otherwise it is a Grasshopper. Using just the antenna length we get perfect classification! The nearest neighbor algorithm is sensitive to irrelevant features… Training data Suppose however, we add in an irrelevant feature, for example the insects mass. Using both the antenna length and the insects mass with the 1-NN algorithm we get the wrong classification! Suppose however, we add in an irrelevant feature, for example the insects mass. Using both the antenna length and the insects mass with the 1-NN algorithm we get the wrong classification!

How do we mitigate the nearest neighbor algorithms sensitivity to irrelevant features? Use more training instances Ask an expert what features are relevant to the task Use statistical tests to try to determine which features are useful Search over feature subsets (in the next slide we will see why this is hard)

Why searching over feature subsets is hard Suppose you have the following classification problem, with 100 features, where is happens that Features 1 and 2 (the X and Y below) give perfect classification, but all 98 of the other features are irrelevant… Using all 100 features will give poor results, but so will using only Feature 1, and so will using Feature 2! Of the –1 possible subsets of the features, only one really works. Only Feature 1 Only Feature 2

1234 3,42,41,42,31,31,2 2,3,41,3,41,2,41,2,3 1,2,3,4 Forward Selection Backward Elimination Bi-directional Search

The nearest neighbor algorithm is sensitive to the units of measurement X axis measured in centimeters Y axis measure in dollars The nearest neighbor to the pink unknown instance is red. X axis measured in millimeters Y axis measure in dollars The nearest neighbor to the pink unknown instance is blue. One solution is to normalize the units to pure numbers. Typically the features are Z-normalized to have a mean of zero and a standard deviation of one. X = (X – mean(X))/std(x)

We can speed up nearest neighbor algorithm by “throwing away” some data. This is called data editing. Note that this can sometimes improve accuracy! One possible approach. Delete all instances that are surrounded by members of their own class. We can also speed up classification with indexing

Manhattan (p=1) Max (p=inf) Mahalanobis Weighted Euclidean Up to now we have assumed that the nearest neighbor algorithm uses the Euclidean Distance, however this need not be the case…

…In fact, we can use the nearest neighbor algorithm with any distance/similarity function IDNameClass 1GunopulosGreek 2PapadopoulosGreek 3KolliosGreek 4DardanosGreek 5 KeoghIrish 6GoughIrish 7GreenhaughIrish 8HadleighIrish For example, is “Faloutsos” Greek or Irish? We could compare the name “Faloutsos” to a database of names using string edit distance… edit_distance(Faloutsos, Keogh) = 8 edit_distance(Faloutsos, Gunopulos) = 6 Hopefully, the similarity of the name (particularly the suffix) to other Greek names would mean the nearest nearest neighbor is also a Greek name. Specialized distance measures exist for DNA strings, time series, images, graphs, videos, sets, fingerprints etc…

Peter Piter Pioter Piotr Substitution (i for e) Insertion (o) Deletion (e) Edit Distance Example It is possible to transform any string Q into string C, using only Substitution, Insertion and Deletion. Assume that each of these operators has a cost associated with it. The similarity between two strings can be defined as the cost of the cheapest transformation from Q to C. Note that for now we have ignored the issue of how we can find this cheapest transformation How similar are the names “Peter” and “Piotr”? Assume the following cost function Substitution1 Unit Insertion1 Unit Deletion1 Unit D( Peter,Piotr ) is 3 Piotr Pyotr Petros Pietro Pedro Pierre Piero Peter