Introduction to machine learning
Introduction to machine learning
Introduction
Mohamed FARAH
Machine Learning
Traditional Programming
Data
Computer Output
Data driven Program
Automating automation
Getting computers to Machine Learning
programme themselves
Data
Computer Program
Output
4
Machine Learning
Example :
• Experience (data): games played by the program (with itself) Tom Mitchell
6
Data – Example
Anderson’s Iris data (oldest dataset, in stat/ML 1936)
23
https://en.wikipedia.org/wiki/Iris_flower_data_set
Dataset Assumptions
Accuracy
Precision
Recall
F-score
etc.
12
After the task is learned
13
Related Domains
14
Applications of Machine Learning
15
Computer Vision
16
Computer Vision
17
Computer Vision
18
Natural Language Processing (NLP)
19
20
Natural Language Processing (NLP)
Translating machine
21
22
Natural Language Processing (NLP)
Example : Chatbots
23
Bio-Informatics
24
Signal processing
Speech recognition, person identification, speech to text, text to
speech, etc.
Model ‘Hello’
Speech recognition
25
26
Learning Types
(based on tasks)
27
Learning Types
Supervised Unsupervised
Learning Learning
Reinforcement
Learning
28
Supervised learning
29
Supervised learning
Given: a dataset that contains samples
1 , 1 ,…( , )
Task: if a residence has square feet, predict its price?
15th sample
( 15 , 15 )
= 800
=?
Housing price prediction
Supervised learning
Given: a dataset that contains samples
1 , 1 ,…( , )
Task: if a residence has square feet, predict its price?
= 800
=?
Housing price prediction
Regression vs Classification
regression: if ∈ ℝ is a continuous variable
e.g., price prediction
= house or
townhouse?
Supervised Learning – Model Types
2 types of models:
• Discriminative model:
• it is estimated that ( | )
• we're learning the decision boundary
• Generative model:
• it is estimated that ( │ ) is used to deduce ( | )
• we learn probability distributions of data 33
Image Classification
= raw pixels of the image, = the main object
36
Supervised learning in NLP
Machine translation
Unsupervised learning
38
Unsupervised Learning
supervised unsupervised
Clustering
Density Estimation
42
Density Estimation
43
Representation learning
44
Word Embedding
Rome
Represent words by vectors
Paris
encode Italy
word vector
Berlin
encode
relation direction France
Germany
[Arora-Ge-Liang-M.-Risteski, TACL’17,18]
Dimensionality reduction
“swiss roll”
dataset
47
https://link.springer.com/article/10.1007/s00477-016-1246-2/figures/1
Reinforcement learning
50
Reinforcement learning
Go
• 2016: AlphaGo (DeepMind) defeated 18-time world champion Lee
Sedol 4-1 in a five-game match.
• 2017: AlphaGo Master defeated world champion Ke Jie
• 2017: AlphaGo Zero (a more advanced version) surpassed all previous
versions
Reinforcement learning
Problem Data
A state describes a situation
An action allows you to switch between states
A policy allows you to choose the action to be taken based on your
current state
At the end of each action, a + or - reward is observed
Objectives
Guide an agent to define a policy: Improve the policy of choice of
action at time t+1
Avoid failure situations
53
Challenges
Validation Loss
Training loss
57
Data augmentation
What ?
increase the size and diversity of a training dataset
apply various transformations to the original data
used when the original dataset is small or lacks diversity.
Why ?
Prevents overfitting by exposing the model to more varied
data.
Improves the model's ability to generalize to unseen data.
Enhances performance in tasks like image classification,
object detection, natural language processing, etc. 60
Data augmentation
Common Techniques:
1. Image Data:
1. Rotation, flipping, cropping, scaling, and translation.
2. Color jittering (adjusting brightness, contrast, saturation).
3. Adding noise or blurring.
4. Random erasing or cutout.
2. Text Data:
1. Synonym replacement, random insertion, or deletion of words.
2. Back-translation (translating text to another language and back).
3. Shuffling sentences or phrases.
3. Audio Data:
1. Time stretching, pitch shifting, or adding background noise.
4. Tabular Data:
1. Adding noise to numerical features.
61
2. Synthetic minority oversampling techniques (e.g., SMOTE).
Data augmentation
62
Imbalanced datasets
Prerequisites
• Knowledge of programming
64
References
• A. Geron. Hands-On Machine Learning with Scikit-Learn,
Keras, and TensorFlow Concepts, Tools, and Techniques to
Build Intelligent Systems. O'Reilly Media Inc., 2019.
• C. Bishop. Pattern Recognition and Machine Learning.
Springer 2006.
• R. Duda, P. Storck and D. Hart. Pattern Classification.
Prentice Hall, 2002).
• ...
65