CISC 4631 Data Mining
Lecture 03:
- Introduction to classification
- Linear classifier
Theses slides are based on the slides by
- Tan, Steinbach and Kumar (textbook authors)
- Eamonn Koegh (UC Riverside)
1
Data Mining Lecture 03: Introduction to classification Linear - - PowerPoint PPT Presentation
CISC 4631 Data Mining Lecture 03: Introduction to classification Linear classifier Theses slides are based on the slides by Tan, Steinbach and Kumar (textbook authors) Eamonn Koegh (UC Riverside) 1 Classification:
1
– Each record contains a set of attributes, one of the attributes is the class.
– 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.
2
Apply Model
Induction Deduction
Learn Model
Model
Tid Attrib1 Attrib2 Attrib3 Class 1 Yes Large 125K No 2 No Medium 100K No 3 No Small 70K No 4 Yes Medium 120K No 5 No Large 95K Yes 6 No Medium 60K No 7 Yes Large 220K No 8 No Small 85K Yes 9 No Medium 75K No 10 No Small 90K Yes
10Tid Attrib1 Attrib2 Attrib3 Class 11 No Small 55K ? 12 Yes Medium 80K ? 13 Yes Large 110K ? 14 No Small 95K ? 15 No Large 67K ?
10Test Set Learning algorithm Training Set
3
4
5
Katydid or Grasshopper?
6
Thorax Thorax Length Length Abdomen Abdomen Length Length Antennae Antennae Length Length Mandible Mandible Size Size Spiracle Diameter Leg Length
Color Color {Green, Brown, Gray, Other} {Green, Brown, Gray, Other} Has Wings? Has Wings?
7
Insect Insect ID ID Abdomen Abdomen Length Length Antennae Antennae Length Length Insect Class
Grasshopper
Katydid
Grasshopper
Grasshopper
Katydid
Grasshopper
Katydid
Grasshopper
Katydid
Katydids
??????? ???????
My_Collection My_Collection
(My_Collection), predict the class label of a previously unseen instance previously unseen instance previously unseen instance = =
8
Antenna Length Antenna Length
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Abdomen Length Abdomen Length
9
Antenna Length Antenna Length
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Abdomen Length Abdomen Length Each of these data
examples
10
11
Examples of class A 3 4 1.5 5 6 8 2.5 5 Examples of class B 5 2.5 5 2 8 3 4.5 3
12
Examples of class A 3 4 1.5 5 6 8 2.5 5 Examples of class B 5 2.5 5 2 8 3 4.5 3 8 1.5 4.5 7 What class is this What class is this
What about this one, What about this one, A or B?
13
Examples of class A 4 4 5 5 6 6 3 3 Examples of class B 5 2.5 2 5 5 3 2.5 3 8 1.5
Oh! This ones hard! Oh! This ones hard!
14
Examples of class A 4 4 1 5 6 3 3 7 Examples of class B 5 6 7 5 4 8 7 7 6 6
This one is really hard! What is this, This one is really hard! What is this, A or B?
15
16
Examples of class A 3 4 1.5 5 6 8 2.5 5 Examples of class B 5 2.5 5 2 8 3 4.5 3
Here is the rule again. If the left bar is smaller 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 Left Bar
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 Right Bar Right Bar
17
Examples of class A 4 4 5 5 6 6 3 3 Examples of class B 5 2.5 2 5 5 3 2.5 3
Left Bar Left Bar
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 Right Bar Right Bar
Let me look it up… here it is.. Otherwise it is a 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.
18
Examples of class A 4 4 1 5 6 3 3 7 Examples of class B 5 6 7 5 4 8 7 7
Left Bar Left Bar
100 10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 Right Bar Right Bar
The rule again:
is a
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.
19
Antenna Length Antenna Length
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Abdomen Length Abdomen Length
20
Antenna Length Antenna Length
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Abdomen Length Abdomen Length
unseen instance into the same space as the database.
details of our particular problem. It will be much easier to talk about points in space.
unseen instance into the same space as the database.
details of our particular problem. It will be much easier to talk about points in space.
??????? ???????
previously unseen instance previously unseen instance = =
21
If previously unseen instance above the line then class is Katydid else class is Grasshopper
Katydids Grasshoppers
R.A. Fisher 1890-1962
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
22
Predicted class Class = Katydid (1) Class = Grasshopper (0) Actual Class Class = Katydid (1) f11 f10 Class = Grasshopper (0) f01 f00 Number of correct predictions f11 + f00 Accuracy = --------------------------------------------- = ----------------------- Total number of predictions f11 + f10 + f01 + f00 Number of wrong predictions f10 + f01 Error rate = --------------------------------------------- = ----------------------- Total number of predictions f11 + f10 + f01 + f00
23
entities: TP (true positive), TN (true negative), FP (false positive), FN (false negative) Positive (+) Negative (-) Predicted positive (Y) TP FP Predicted negative (N) FN TN
24
The simple linear classifier is defined for higher dimensional spaces…
25
… we can visualize it as being an n-dimensional hyperplane
26
It is interesting to think about what would happen in this example if we did not have the 3rd dimension…
27
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…
28
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
100 10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90
10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Which of the “Problems” can be solved by the Simple Linear Classifier?
Problems that can be solved by a linear classifier are call linearly separable.
29
The task is to classify Iris plants into one of 3 varieties using the Petal Length and Petal Width. Iris Setosa Iris Versicolor Iris Virginica Setosa Versicolor Virginica
30
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 > 3.272 – (0.325 * petal length) then class = Virginica Elseif petal width…
31
– time to construct the model – time to use the model – efficiency in disk-resident databases
– handling noise, missing values and irrelevant features, streaming data
– understanding and insight provided by the model
32