Pattern Recognition in Data Science

 
Pattern Recognition
Chapter 2: 
Pattern Representation
 
Chumphol Bunkhumpornpat
Department of Computer Science
Faculty of Science
Chiang Mai University
 
Learning Objectives
 
KDD Process
Know that patterns can be represented as
Vectors
Strings
Logical descriptions
Fuzzy sets
 
204453: Pattern Recognition
 
2
 
Learning Objectives (cont.)
 
Have found out what is involved in abstract of
data
Know the parameters involved in evaluation of
classifiers
 
204453: Pattern Recognition
 
3
 
Learning Objectives (cont.)
 
Have found out what is involved in abstract of
data
Know the parameters involved in evaluation of
classifiers
 
204453: Pattern Recognition
 
4
 
KDD (Knowledge Discovery in Databases) Process
 
204453: Pattern Recognition
 
5
 
Representation
 
Pattern
Physical Object
Abstract Notion
Pattern: A Set of Descriptions
Animal: ?
Ball: Size, Material
 
204453: Pattern Recognition
 
6
 
Pattern is the representation of an object by
the values taken by the attributes (features)
 
204453: Pattern Recognition
 
7
 
204453: Pattern Recognition
 
8
 
Classification
 
A dataset has a set of classes, and each object
belongs to one of these classes.
Animals (Pattern): Mammals, Reptiles (Classes)
Balls (Pattern): Football, Table Tennis Ball (Classes)
Common technique that separates patterns
into different classes.
 
204453: Pattern Recognition
 
9
 
Iris Dataset
 
204453: Pattern Recognition
 
10
 
Patterns as Vectors
 
An Obvious Representation of a Pattern
Each element of the vector can represent one
attribute of the pattern.
 
204453: Pattern Recognition
 
12
 
Spherical Objects
 
(30, 1): 30 units of weight and 1 unit diameter
(30, 1, 1): The last element represents the
class of the objet (spherical objects).
 
204453: Pattern Recognition
 
13
 
Example 1
 
   
1.0, 1.0, 1 ;
  
1.0, 2.0, 1
   
2.0, 1.0, 1 ;
  
2.0, 2.0, 1
   
4.0, 1.0, 2 ;
  
5.0, 1.0, 2
   
4.0, 2.0, 2 ;
  
5.0, 2.0, 2
   
1.0, 4.0, 2 ;
  
1.0, 5.0, 2
   
2.0, 4.0, 2 ;
  
2.0, 5.0, 2
   
4.0, 4.0, 1 ;
  
5.0, 5.0, 1
   
4.0, 5.0, 1 ;
  
5.0, 4.0, 1
 
204453: Pattern Recognition
 
14
 
Example Data Set:
The Square Represents a Test Pattern
 
204453: Pattern Recognition
 
15
 
Patterns as Strings
 
A gene can be defined as a region of the
chromosomal DNA constructed with four
nitrogenous bases:
Adenine: A
Guanine : G
Cytosine: C
Thymine: T
GAAGTCCAG
 
204453: Pattern Recognition
 
16
 
204453: Pattern Recognition
 
17
 
Logical Descriptions
 
x
1
 and x
2
 : The attributes of the pattern
a
i
 and b
i
 : The values taken by the attribute
A Conjunction of Logical Disjunctions
(x
1
 = a
1
..a
2
) 
 
(x
2
 = b
1
..b
2
) 
Cricket Ball
(colour = red 
 white
) 
 (make = leather) 
 (shape = sphere)
 
204453: Pattern Recognition
 
18
 
204453: Pattern Recognition
 
19
 
Fuzzy Sets
 
Fuzziness is used where it is not possible to
make precise statements.
X = (small, large)
X = (?, 6.2, 7)
The objects belong to the set depending on a
membership value which varies from 0 to 1.
X = ([0,1], 6.2, 7)
 
204453: Pattern Recognition
 
20
 
Distance Measure
 
Find the dissimilarity between pattern
representations
Patterns which are more similar should be
closer.
 
204453: Pattern Recognition
 
23
 
Distance Function
 
Metric
Non-Metric
 
204453: Pattern Recognition
 
24
 
Metric
 
Positive Reflexivity: d(x, x) = 0
Symmetry: d(x, y) = d(y, x)
Triangular Inequality: d(x, y) 
 d(x, z) + d(z, y)
 
204453: Pattern Recognition
 
25
 
Minkowski Metric
 
204453: Pattern Recognition
 
26
 
Euclidean Distance (L
2
; m = 2)
 
204453: Pattern Recognition
 
27
 
 
d
2
(x, y) = 
 (x
1
 – y
1
)
2
 + (x
2
 – y
2
)
2
 + … + (x
d
 – y
d
)
2
 
 
X = (4, 1, 3); Y = (2, 5, 1)
 
204453: Pattern Recognition
 
29
 
 
d(X, Y) = 
 (4 – 2)
2
 + (1 – 5)
2
 + (3 – 1)
2
 = 4.9
 
204453: Pattern Recognition
 
Distance Measure (cont.)
 
It should be ensure that all the features have
the same range of values, failing which
attributes with larger ranges will be treated as
more important.
To ensure that all features are in the same
range, normalisation of the feature values has
to be carried out.
 
204453: Pattern Recognition
 
32
 
Example of Data
 
  
X
1
 : (2, 120)
  
X
2
 : (8, 533)
  
X
3
 : (1, 987)
  
X
4
 : (15, 1121)
  
X
5
 : (18, 1023)
 
204453: Pattern Recognition
 
33
 
Example of Data (Cont.)
 
It gives the equal importance to every feature.
If the 2
nd
 feature (much larger) is used for
computing distances, the 1
st
 feature will be
insignificant and will  not have any bearing on
the classification.
 
204453: Pattern Recognition
 
34
 
Normalisation of Data
 
It divides every value of the feature by its
maximum value.
All the values will lie between 0 and 1.
 
204453: Pattern Recognition
 
35
 
Normalisation of Data (cont.)
 
  
X
1
 : (2, 120)
  
X’
1
 : (0.11, 0.11)
  
X
2
 : (8, 533)
  
X’
2
 : (0.44, 0.48)
  
X
3
 : (1, 987)
  
X’
3
 : (0.06, 0.88)
  
X
4
 : (15, 1121)
  
X’
4
 : (0.83, 1.0)
  
X
5
 : (18, 1023)
  
X’
5
 : (1.0, 0.91)
 
  
MAX : 18, 1121
 
204453: Pattern Recognition
 
36
 
Weighted Distance Measure
 
When attributes need to treated as more
important, a weight can be added to their
values.
w
k
 is the weight associated with
the k
th
 dimension (or feature).
 
204453: Pattern Recognition
 
37
 
Weighted Distance Measure (cont.)
 
204453: Pattern Recognition
 
38
 
X = (4, 2, 3); Y = (2, 5, 1)
w
1
 = 0.3; w
2
 = 0.6; w
3
 = 0.1
 
204453: Pattern Recognition
 
39
 
 
d(X, Y) = 
 0.3
(4 – 2)
2
 + 0.6 
(1 – 5)
2
 + 0.1 
(3 – 1)
2
  
 = 3.35
 
Example of Data (Cont.)
 
  
X
1
 : (2, 120)
  
X
2
 : (8, 533)
  
X
3
 : (1, 987)
  
X
4
 : (15, 1121)
  
X
5
 : (18, 1023)
 
  
 w
1
 = ? ; w
2
 = ?
 
204453: Pattern Recognition
 
40
 
Non-Metric Similarity Functions
 
They do not obey either the 
triangular
inequality
 or 
symmetry
 come under this
category.
They are useful for images or string data.
They are robust to outliers or to extremely
noisy data.
 
204453: Pattern Recognition
 
41
 
Non-Metric Similarity Functions (cont.)
 
k-Median Distance
Mutual Neighbourhood Distance
 
204453: Pattern Recognition
 
42
 
k-Median Distance
 
k-median operator returns the k
th
 value of the
ordered difference vector.
X = (x
1
, x
2
, …, x
n
) and Y = (y
1
, y
2
, …, y
n
)
d(X, Y) = k-median{sort(|x
1
 – y
1
|, …, |x
n
 – y
n
|)}
 
204453: Pattern Recognition
 
43
 
X = (50, 3, 100, 29, 62, 140);
Y = (55, 15, 80, 50, 70, 170)
 
Difference Vector = {5, 12, 20, 21, 8, 30}
d(X, Y) = k-median {5, 8, 12, 20, 21, 30}
If k = 3, then d(X, Y) = 12
 
204453: Pattern Recognition
 
44
 
Mutual Neighbourhood Distance
 
For each data point
All other data points are numbered from 1 to
N – 1 in increasing order of some distance
measure.
The nearest neighbour is assigned value 1.
Te farthest point is assigned the value N – 1.
 
204453: Pattern Recognition
 
45
 
Mutual Neighbourhood Distance (cont.)
 
MND(u, v) = NN(u, v) + NN(v, u)
NN(u, v): The number of data point v w.r.t. u.
NN(u, u) = 0
Symmetric
Reflexive
Not
 Triangular Inequality
 
204453: Pattern Recognition
 
46
 
Ranking of A, B and C
 
204453: Pattern Recognition
 
47
 
1
 
2
A
 
B
 
C
B
 
A
 
C
C
 
B
 
A
 
MND(A, B) = 2
MND(B, C) = 3
MND(A, C) = 4
 
Ranking of A, B, C, D, E and F
 
204453: Pattern Recognition
 
48
 
1
 
2
 
3
 
4
 
5
A
 
D
 
E
 
F
 
B
 
C
B
 
A
 
C
 
D
 
E
 
F
C
 
B
 
A
 
D
 
E
 
F
 
MND(A, B) = 5
MND(B, C) = 3
MND(A, C) = 7
 
Abstractions of the Data Set
 
A set of training patterns where the class label
for each pattern is given, is used for
classification.
The complete training set may not be used
because the processing time may be too long
but an abstraction of the training set can be
used.
 
204453: Pattern Recognition
 
49
 
Abstractions of the Data Set (cont.)
 
No Abstraction of Patterns
Single Representative per Class
Multiple Representative per Class
 
204453: Pattern Recognition
 
50
 
No Abstraction of Patterns
 
All the training patterns are used.
k-Nearest  Neighbour
It uses the neighbours of the test pattern from all
the training patterns.
 
204453: Pattern Recognition
 
51
 
Single representative per class
 
Centroid
The sample mean of the points in the cluster
Medoid
The most centrally located point in the cluster
 
204453: Pattern Recognition
 
52
 
Multiple representative per class
 
Cluster Representative
Cluster Centres
 
204453: Pattern Recognition
 
53
 
A Set of Data Points
 
204453: Pattern Recognition
 
54
 
Evaluation of Classifiers
 
Accuracy of the Classifier
Design Time and Classification Time
Space Required
Explanation Ability
Noise Tolerance
 
204453: Pattern Recognition
 
55
 
Accuracy of the Classifier
 
The main aim of using a classifier is to
correctly classify unknown patterns.
The accuracy of the classifier is the parameter
usually taken into account.
 
204453: Pattern Recognition
 
56
 
Design Time and Classification Time
 
Design Time
Time to build the classifier from the training data
Classification Time
Time to classify a pattern using the design
classifier
If the classification time is too large and it is
required to carry out the classification task
quickly, it may be better to sometimes sacrifice
the accuracy and use a classifier which is faster.
 
204453: Pattern Recognition
 
57
 
Space Required
 
Abstraction: Less
No Abstraction: High
Hand-Held Devices
It is good to use a classifier requiring little space.
 
204453: Pattern Recognition
 
58
 
Explanation Ability
 
The reason for the classifier in choosing the
class of a pattern is clear to the user.
Medical Diagnostics
Explanation ability may be necessary in a classifier
so that the doctors are sure that the classifier is
doing the right thing.
 
204453: Pattern Recognition
 
59
 
Noise Tolerance
 
The ability of the classifier to take care of
outliers and patterns wrongly classified
 
204453: Pattern Recognition
 
60
 
Training and Test Sets
 
A training set is recognized to construct a
classifier.
A test set is used to validate a classifier.
 
204453: Pattern Recognition
 
61
 
Experiment
 
Re-Substitution Estimate
Holdout Method
K-Fold Cross-Validation
 
204453: Pattern Recognition
 
62
 
Re-Substitution Estimate
 
An estimate can be made using the training
set itself.
It assumes that the training data is a good
representative of the data.
 
204453: Pattern Recognition
 
63
 
Holdout Method
 
The training set is divided into two sub-sets.
Two-thirds of the data is used for training.
One-thirds of the data is used for validation.
It could also be one-half for training and
one-half for testing or any other proportion.
 
204453: Pattern Recognition
 
64
 
K-Fold Cross-Validation
 
The data is divided into k equal sub-sets.
During each run
One sub-set is used for testing.
The rest of the sub-sets are used for training.
This procedure is carried out k times so that
each sub-set is used for testing once.
 
204453: Pattern Recognition
 
65
 
Reference
 
Murty, M. N., Devi, V. S.: Pattern Recognition:
An Algorithmic Approach (Undergraduate
Topics in Computer Science). Springer (2012)
 
204453: Pattern Recognition
 
66
Slide Note
Embed
Share

Explore the concept of pattern recognition through chapters on pattern representation, learning objectives, KDD process, and classification. Dive into the Iris dataset and learn how patterns are represented and classified based on their attributes.

  • Pattern Recognition
  • Data Science
  • Learning Objectives
  • Classification
  • Iris Dataset

Uploaded on Apr 06, 2024 | 6 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Pattern Recognition Chapter 2: Pattern Representation Chumphol Bunkhumpornpat Department of Computer Science Faculty of Science Chiang Mai University

  2. Learning Objectives KDD Process Know that patterns can be represented as Vectors Strings Logical descriptions Fuzzy sets 2 204453: Pattern Recognition

  3. Learning Objectives (cont.) Have found out what is involved in abstract of data Know the parameters involved in evaluation of classifiers 3 204453: Pattern Recognition

  4. Learning Objectives (cont.) Have found out what is involved in abstract of data Know the parameters involved in evaluation of classifiers 4 204453: Pattern Recognition

  5. KDD (Knowledge Discovery in Databases) Process 5 204453: Pattern Recognition

  6. Representation Pattern Physical Object Abstract Notion Pattern: A Set of Descriptions Animal: ? Ball: Size, Material 6 204453: Pattern Recognition

  7. Pattern is the representation of an object by the values taken by the attributes (features) 7 204453: Pattern Recognition

  8. 8 204453: Pattern Recognition

  9. Classification A dataset has a set of classes, and each object belongs to one of these classes. Animals (Pattern): Mammals, Reptiles (Classes) Balls (Pattern): Football, Table Tennis Ball (Classes) Common technique that separates patterns into different classes. 9 204453: Pattern Recognition

  10. Iris Dataset 10 204453: Pattern Recognition

  11. Patterns as Vectors An Obvious Representation of a Pattern Each element of the vector can represent one attribute of the pattern. 12 204453: Pattern Recognition

  12. Spherical Objects (30, 1): 30 units of weight and 1 unit diameter (30, 1, 1): The last element represents the class of the objet (spherical objects). 13 204453: Pattern Recognition

  13. Example 1 1.0, 1.0, 1 ; 2.0, 1.0, 1 ; 4.0, 1.0, 2 ; 4.0, 2.0, 2 ; 1.0, 4.0, 2 ; 2.0, 4.0, 2 ; 4.0, 4.0, 1 ; 4.0, 5.0, 1 ; 1.0, 2.0, 1 2.0, 2.0, 1 5.0, 1.0, 2 5.0, 2.0, 2 1.0, 5.0, 2 2.0, 5.0, 2 5.0, 5.0, 1 5.0, 4.0, 1 14 204453: Pattern Recognition

  14. Example Data Set: The Square Represents a Test Pattern 15 204453: Pattern Recognition

  15. Patterns as Strings A gene can be defined as a region of the chromosomal DNA constructed with four nitrogenous bases: Adenine: A Guanine : G Cytosine: C Thymine: T GAAGTCCAG 16 204453: Pattern Recognition

  16. 17 204453: Pattern Recognition

  17. Logical Descriptions x1and x2: The attributes of the pattern aiand bi: The values taken by the attribute A Conjunction of Logical Disjunctions (x1= a1..a2) (x2= b1..b2) Cricket Ball (colour = red white) (make = leather) (shape = sphere) 18 204453: Pattern Recognition

  18. 19 204453: Pattern Recognition

  19. Fuzzy Sets Fuzziness is used where it is not possible to make precise statements. X = (small, large) X = (?, 6.2, 7) The objects belong to the set depending on a membership value which varies from 0 to 1. X = ([0,1], 6.2, 7) 20 204453: Pattern Recognition

  20. Distance Measure Find the dissimilarity between pattern representations Patterns which are more similar should be closer. 23 204453: Pattern Recognition

  21. Distance Function Metric Non-Metric 24 204453: Pattern Recognition

  22. Metric Positive Reflexivity: d(x, x) = 0 Symmetry: d(x, y) = d(y, x) Triangular Inequality: d(x, y) d(x, z) + d(z, y) 25 204453: Pattern Recognition

  23. Minkowski Metric 26 204453: Pattern Recognition

  24. Euclidean Distance (L2; m = 2) d2(x, y) = (x1 y1)2+ (x2 y2)2+ + (xd yd)2 27 204453: Pattern Recognition

  25. X = (4, 1, 3); Y = (2, 5, 1) d(X, Y) = (4 2)2+ (1 5)2+ (3 1)2= 4.9 29 204453: Pattern Recognition

  26. 204453: Pattern Recognition

  27. Distance Measure (cont.) It should be ensure that all the features have the same range of values, failing which attributes with larger ranges will be treated as more important. To ensure that all features are in the same range, normalisation of the feature values has to be carried out. 32 204453: Pattern Recognition

  28. Example of Data X1: (2, 120) X2: (8, 533) X3: (1, 987) X4: (15, 1121) X5: (18, 1023) 33 204453: Pattern Recognition

  29. Example of Data (Cont.) It gives the equal importance to every feature. If the 2ndfeature (much larger) is used for computing distances, the 1stfeature will be insignificant and will not have any bearing on the classification. 34 204453: Pattern Recognition

  30. Normalisation of Data It divides every value of the feature by its maximum value. All the values will lie between 0 and 1. 35 204453: Pattern Recognition

  31. Normalisation of Data (cont.) X1: (2, 120) X2: (8, 533) X3: (1, 987) X4: (15, 1121) X5: (18, 1023) X 1: (0.11, 0.11) X 2: (0.44, 0.48) X 3: (0.06, 0.88) X 4: (0.83, 1.0) X 5: (1.0, 0.91) MAX : 18, 1121 36 204453: Pattern Recognition

  32. Weighted Distance Measure When attributes need to treated as more important, a weight can be added to their values. wkis the weight associated with the kthdimension (or feature). 37 204453: Pattern Recognition

  33. Weighted Distance Measure (cont.) 38 204453: Pattern Recognition

  34. X = (4, 2, 3); Y = (2, 5, 1) w1= 0.3; w2= 0.6; w3= 0.1 d(X, Y) = 0.3 (4 2)2+ 0.6 (1 5)2+ 0.1 (3 1)2 = 3.35 39 204453: Pattern Recognition

  35. Example of Data (Cont.) X1: (2, 120) X2: (8, 533) X3: (1, 987) X4: (15, 1121) X5: (18, 1023) w1= ? ; w2= ? 40 204453: Pattern Recognition

  36. Non-Metric Similarity Functions They do not obey either the triangular inequality or symmetry come under this category. They are useful for images or string data. They are robust to outliers or to extremely noisy data. 41 204453: Pattern Recognition

  37. Non-Metric Similarity Functions (cont.) k-Median Distance Mutual Neighbourhood Distance 42 204453: Pattern Recognition

  38. k-Median Distance k-median operator returns the kthvalue of the ordered difference vector. X = (x1, x2, , xn) and Y = (y1, y2, , yn) d(X, Y) = k-median{sort(|x1 y1|, , |xn yn|)} 43 204453: Pattern Recognition

  39. X = (50, 3, 100, 29, 62, 140); Y = (55, 15, 80, 50, 70, 170) Difference Vector = {5, 12, 20, 21, 8, 30} d(X, Y) = k-median {5, 8, 12, 20, 21, 30} If k = 3, then d(X, Y) = 12 44 204453: Pattern Recognition

  40. Mutual Neighbourhood Distance For each data point All other data points are numbered from 1 to N 1 in increasing order of some distance measure. The nearest neighbour is assigned value 1. Te farthest point is assigned the value N 1. 45 204453: Pattern Recognition

  41. Mutual Neighbourhood Distance (cont.) MND(u, v) = NN(u, v) + NN(v, u) NN(u, v): The number of data point v w.r.t. u. NN(u, u) = 0 Symmetric Reflexive Not Triangular Inequality 46 204453: Pattern Recognition

  42. Ranking of A, B and C MND(A, B) = 2 MND(B, C) = 3 MND(A, C) = 4 1 B A B 2 C C A A B C 47 204453: Pattern Recognition

  43. Ranking of A, B, C, D, E and F MND(A, B) = 5 MND(B, C) = 3 MND(A, C) = 7 1 D A B 2 E C A 3 F D D 4 B E E 5 C F F A B C 48 204453: Pattern Recognition

  44. Abstractions of the Data Set A set of training patterns where the class label for each pattern is given, is used for classification. The complete training set may not be used because the processing time may be too long but an abstraction of the training set can be used. 49 204453: Pattern Recognition

  45. Abstractions of the Data Set (cont.) No Abstraction of Patterns Single Representative per Class Multiple Representative per Class 50 204453: Pattern Recognition

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#