Professional Documents
Culture Documents
Introduction to
Machine Learning
Mustafa Jarrar
Birzeit University
Jarrar © 2020
1
Watch this lecture
and download the slides
Jarrar © 2020
2
Mustafa Jarrar: Lecture Notes on Introduction to Machine Learning
Birzeit University, 2020
Introduction to
Machine Learning
Mustafa Jarrar
Keywords: Learning, Machine learning, Supervised Learning, unsupervised Learning, Reinforcement learning
Jarrar © 2020
3
Learning Agents
Based on [8]
The agent adapts its action(s) based on feedback (not only sensors).
Jarrar © 2020
4
Introduction
Jarrar © 2020
5
Motivation: Inductive Learning
Jarrar © 2020
6
Motivation: Inductive Learning
Based on [8]
Jarrar © 2020
7
Motivation: Inductive Learning
Based on [8]
Jarrar © 2020
8
Motivation: Inductive Learning
Based on [8]
Jarrar © 2020
9
Motivation: Inductive Learning
Based on [8]
Jarrar © 2020
10
Motivation: Inductive Learning
Based on [8]
Jarrar © 2020
11
What is meant by learning?
Jarrar © 2020
12
Challenges of Machine Learning
High Dimensionality [3]
• Complexity of the data requires bigger models.
• Requires bigger of memory and more time to process.
• Might cause over-fitting.
Choice of Statistical Model [4]
• Choosing the correct model and parameters that satisfy the data
• Can cause under-fitting or over-fitting
Jarrar © 2020
13
Challenges of Machine Learning
Jarrar © 2020
14
Challenges of Machine Learning
Image Reference:
Face Verification
Jarrar © 2020
15
Mustafa Jarrar: Lecture Notes on Introduction to Machine Learning
Birzeit University, 2020
Introduction to
Machine Learning
Mustafa Jarrar
Keywords: Learning, Machine learning, Supervised Learning, unsupervised Learning, Reinforcement learning
Jarrar © 2020
16
Supervised Learning (Regression)
Regression aims to estimate a response.
Input: {x1, x2,…, xn} numeric values, called features
Output: y numeric values, called Target Value
Toy Problem: areas and prices of apartments (training data).
Find a model to predict prices of unseen cases
features Target Value
è 150 ??? 17
Jarrar © 2020
Example (Regression)
Suppose we have the following features
x1 x2 x3 x4 y
Size ft2 bedrooms floors Age Price
2104 5 1 45 460
1416 3 2 40 232
1534 3 2 30 315
852 2 1 36 178
… … … … …
Linear regression
x1 x2 x3 x4 y
Size ft2 bedrooms floors Age Price X Y
2104 5 1 45 460 1 2104 5 1 45 460
1416 3 2 40 232 1 1416 3 2 40 232
1534 3 2 30 315 1 1534 3 2 30 315
852 2 1 36 178 1 852 2 1 36 178
In Octave: In R:
load X.txt X = as.matrix(read.table("~/x.txt", header=F, sep=","))
load y.txt Y = as.matrix(read.table("~/y.txt", header=F, sep=","))
C= pinv(X’*X)*X’ *y thetas = solve( t(X) %*% X ) %*% t(X) %*% Y
Save 𝜃.txt write.table(thetas, file="~/thetas.txt", row.names=F, col.names=F)
Jarrar © 2020
21
Example (Classification) – using Decision Tree
Yes ⇔ (Outlook=Overcast) ∨
Decision Rule: (Outlook=Sunny ∧ Humidity=Normal)∨
(Outlook=Rain ∧ Wind=Weak)
Input.csv DT_example.R
Day,Outlook,Humidity,Wind,Play
D1,Sunny,High,Weak,No
require(C50)
D2,Sunny,High,Strong,No require(gmodels)
D3,Overcast,High,Weak,Yes dataset = read.table(file.choose(), header = T, sep=",")
D4,Rain,High,Weak,Yes dataset = dataset[,-1]
D5,Rain,Normal,Weak,Yes model = C5.0(dataset[, -4], dataset[, 4])
D6,Rain,Normal,Strong,No
D7,Overcast,Normal,Strong,Yes
D8,Sunny,High,Weak,No x
y
D9,Sunny,Normal,Weak,Yes
D10,Rain,Normal,Weak,Yes
D11,Sunny,Normal,Strong,Yes
D12,Overcast,High,Strong,Yes
D13,Overcast,Normal,Weak,Yes
D14,Rain,High,Strong,No
Jarrar © 2020
23
Mustafa Jarrar: Lecture Notes on Introduction to Machine Learning
Birzeit University, 2020
Introduction to
Machine Learning
Mustafa Jarrar
Keywords: Learning, Machine learning, Supervised Learning, unsupervised Learning, Reinforcement learning
Jarrar © 2020
24
Unsupervised Learning
• Training data contain only the input vectors (No target value)
Jarrar © 2020
25
Unsupervised Learning (Clustering)
Jarrar © 2020
26
Unsupervised Learning (Clustering)
Jarrar © 2020
27
Unsupervised Learning
Dimensionality Reduction [7]
• Convert high dimensional data to lower order dimension
• Motivation:
• High Dimensional Data Analysis
• Visualization of high-dimensional data
• Feature Extraction
Jarrar © 2020
28
Mustafa Jarrar: Lecture Notes on Introduction to Machine Learning
Birzeit University, 2020
Introduction to
Machine Learning
Mustafa Jarrar
Keywords: Learning, Machine learning, Supervised Learning, unsupervised Learning, Reinforcement learning
Jarrar © 2020
29
Reinforcement Learning
Jarrar © 2020
30
Reinforcement Learning
Jarrar © 2020
31
Reinforcement Learning
Jarrar © 2020
32
Reinforcement Learning
Jarrar © 2020
33
Reinforcement Learning
Jarrar © 2020
34
Reinforcement Learning
Jarrar © 2020
35
Reinforcement Learning
Left is chosen
randomly since the
weights are equal
Jarrar © 2020
36
Reinforcement Learning
Wrong Destination.
Return by backtracking
Jarrar © 2020
37
Reinforcement Learning
Jarrar © 2020
38
Reinforcement Learning
Jarrar © 2020
39
Reinforcement Learning
Jarrar © 2020
40
Reinforcement Learning
Jarrar © 2020
41
Reinforcement Learning
Jarrar © 2020
42
Other Learning Paradigms
Jarrar © 2020
43
Real World Examples
Jarrar © 2020
44
Online Courses and Material
Jarrar © 2020
45
References
3. Liu H, Han J, Xin D, Shao Z (2006) Mining frequent patterns on very high dimensional data: a top-down
row enumeration approach. In: Proceeding of the 2006 SIAM international conference on data mining
(SDM’06), Bethesda, MD, pp 280–291.
6. http://www.cs.utah.edu/~piyush/teaching/23-8-slides.pdf
7. Carreira-Perpinan, M., Lu, Z.: Dimensionality Reduction by Unsupervised Learning Computer Vision and
Pattern Recognition (CVPR), 2010 IEEE Conference, 1895 -1902 13 June 2010 .
8. S. Russell and P. Norvig: Artificial Intelligence: A Modern Approach Prentice Hall, 2003, Second Edition
9. Sami Ghawi, Mustafa Jarrar: Lecture Notes on Introduction to Machine Learning, Birzeit University, 2018
10. Mustafa Jarrar: Lecture Notes on Decision Tree Machine Learning, Birzeit University, 2018
11. Mustafa Jarrar: Lecture Notes on Linear Regression Machine Learning, Birzeit University, 2018
Jarrar © 2020
46