CSC 494 · Introduction to Artificial Intelligence
Our notes
2 min readWhat pattern recognition is
Assigning an input (an image, sound, signal, set of measurements) to a class (category), or finding groups in data. Examples: recognising handwritten digits, classifying cassava leaves as healthy or diseased, detecting fraud, recognising voices.
Stages of a pattern recognition system
- Sensing / data acquisition.
- Pre-processing: remove noise, normalise.
- Feature extraction: measurable properties (length, colour, texture, frequency content).
- Classification (or clustering).
- Post-processing / decision.
Supervised and unsupervised
- Supervised (classification): learn from labelled examples, then classify new ones.
- Unsupervised (clustering): find groups in unlabelled data (k-means).
k-nearest neighbour (k-NN)
Classify a new point by the majority class of its k closest training points (Euclidean distance).
Worked example: two features (leaf spot area, yellowing score). Training points: healthy (1, 1), (2, 1), (1, 2); diseased (5, 4), (6, 5), (5, 6). New leaf at (4, 4), k = 3.
- Distances: to (5, 4) = 1.0; (6, 5) = 2.24; (5, 6) = 2.24; (2, 1) = 3.61; (1, 2) = 3.61; (1, 1) = 4.24.
- The three nearest are all diseased: classify as diseased.
Other classifiers
- Minimum-distance (nearest centroid): compare with each class's mean.
- Bayes classifier: choose the class with the highest posterior probability.
- Decision trees: a sequence of feature tests.
- Perceptron / neural networks: weighted sums with a threshold (next topic area).
- Support vector machines: the widest-margin boundary between classes.
Training, testing and evaluation
Split data into training and test sets (or use cross-validation). Measure on the test set:
| Predicted positive | Predicted negative | |
|---|---|---|
| Actually positive | TP | FN |
| Actually negative | FP | TN |
- Accuracy = (TP + TN) / total.
- Precision = TP / (TP + FP); Recall = TP / (TP + FN); F1 = 2PR / (P + R).
Worked example: TP = 40, FP = 10, FN = 20, TN = 130. Accuracy = 170/200 = 0.85; precision = 40/50 = 0.80; recall = 40/60 = 0.667; F1 = 0.727.
Overfitting
A classifier that memorises the training data (including noise) does badly on new data. Remedies: more data, simpler models, regularisation, validation sets.
Exams usually ask
- Describe the stages of a pattern recognition system.
- Classify a point by k-NN.
- Calculate accuracy, precision and recall.
Common mistake
Judging a classifier on its training data. Always test on data it has not seen.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Pattern recognition
(opens en.wikipedia.org in a new tab)
Wikipedia, Pattern recognition, CC BY-SA 4.0 · licence
-
k-nearest neighbors algorithm
(opens en.wikipedia.org in a new tab)
Wikipedia, k-nearest neighbors algorithm, CC BY-SA 4.0 · licence
Watch
-
Best pick Pattern Recognition in AI: A Comprehensive Guide
8 min · ≈ 36 MB · about ₦20
(opens youtube.com in a new tab)
-
What is Pattern Recognition? Simply Explained | AI Nuggets
6 min · ≈ 27 MB · about ₦15
(opens youtube.com in a new tab)
-
How AI Actually Learns — From Zero to Pattern Recognition
9 min · ≈ 41 MB · about ₦23
(opens youtube.com in a new tab)
-
Is AI Really Superintelligence? ANI, AGI & ASI Explained
13 min · ≈ 59 MB · about ₦33
(opens youtube.com in a new tab)
-
Pattern Recognition
8 min · ≈ 36 MB · about ₦20
(opens youtube.com in a new tab)
-
Mod-01 Lec-01 Principles of Pattern Recognition I (Introduction and Uses)
47 min · ≈ 212 MB · about ₦119
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.