5.1. Intro To Machine Learning
5.1. Intro To Machine Learning
Learning
Part – 1
Dr. Oybek Eraliev,
Department of Computer Engineering
Inha University In Tashkent.
Email: [email protected]
Machine Learning (ML) – the use and development of computer systems that
are able to learn and adapt without following explicit instructions, by using
algorithms and statistical models to analyse and draw inferences from patterns
in data.
Machine Learning (ML) – Field of study that gives computers the ability to
learn without being explicitly programmed. Arthur Samuel (1959).
Artificial
Intelligence
Deep Learning
Unsupervised learning
Machine learning
Reinforcement learning
Recommender system
Apple
Apple
Output
Model
Banana
(Algorithm)
Input
Temperature Temperature
(°C) (F)
10 50
13 55.4 113 F
22 71.6
35 95
Clustering problem
• K – Means
• MeanShift
Unsupervised learning
Dimensionality reduction
• Principle Component Analysis (PCA)
• Linear Discriminant Analysis (LDA)
• Autoencoders (AEs)
80
F = 32 + 1.8·t
Prices
500
Houses prices 300
(Dataset) 200
1 10 50
2 15 59
Training set of
Temp. Dataset
m 3 x 20 y 68
4 25 77
… … …
x = “input” variable/feature
(x(1), y(1)) = ( , )
y = “output” variable/target
m = Number of training examples (x(2), y(2)) = ( , )
(x, y) – one training example
(x(i), y(i)) – i th training example (x(3), y(3)) = ( , )
Learning
Algorithm
hθ(x) = θ0 + θ1x
Temp Temp
(C°) h (F) x
Hypothesis F = 32 + 1.8·t
1.8 t
y = hθ(x) = θ1 = w =
θ0 = b = Linear Regression with one variable
x=
Dr. Oybek Eraliyev Class: Artificial Intelligence SOC4040 Oybek Eraliev
Hypothesis: hθ(x) = θ0 + θ1 x
Temp (C°), (x) Temp F (y)
Temperature Dataset
h(x) = 1.5 + 0·x 1 h(x) = 010
+ 0.5 · x 50
h(x) = 1 + 0.5 · x
hθ(x) hθ(x) hθ(x)
2 15 59
3 3 3
m = 50 3 20 68
2 2 2
4 25 77
1 1 … … 1 …
x x x
0 1 2 3 0 1 2 3 0 1 2 3
Hypothesis: hθ(x) = θ0 + θ1 x
θ0 = 1.5 θi : Parameters θ0 = 0 θ0 = 1
θ1 = 0 θ1 = 0.5 θ1 = 0.5
y θ0 , θ1 𝒉θ 𝒙 𝒊 = θ𝟎 + θ𝟏 𝒙(𝒊)
x
0
𝐽 θ+ , θ' =
Cost
Idea: Choose θ0 , θ1 so function
that𝒉𝜽(𝒙) is close to y for
our training examples (x, y).
hθ(x) = θ00 + θ1 x
=0
Parameters:
θ0 , θ1
Cost function:
(
1 𝟐
𝑱 θ𝟎 , θ𝟏 = ( 𝒉θ (𝒙 𝒊 ) − 𝒚(𝒊) 𝑱 θ𝟏 =
2𝑚
%&'
Goal:
minimize 𝑱 θ𝟏𝟎 , θ𝟏
θ0θ,1θ1
1 1
𝐽 1 =
2𝑚
( 1 − 1 "+ 2 − 2 "+ 3 − 3 ") =
2·3
·0=0 θ𝟏 1 0.5 0 1.5 2
𝐽 0.5 =
1
2𝑚
( 0.5 − 1 " + 1 − 2 " + 1.5 − 3 " ) =
1
· 3.5 = 0.58 𝑱 θ𝟏 0 0.58 2.33 0.58 2.33
2·3
𝐽 0 =
1
( 0 − 1 "+ 0 − 2 "+ 0 − 3 ") =
1
· 14 = 2.33
minimize 𝑱 θ𝟏
2𝑚 2·3 θ1
Dr. Oybek Eraliyev Class: Artificial Intelligence SOC4040 Oybek Eraliev
,
1 𝒊 (𝒊) 𝟐
Cost function: 𝑱 θ𝟎 , θ𝟏 = U 𝒉θ (𝒙 ) − 𝒚
2𝑚
)*+
Goal: minimize 𝑱 θ𝟎 , θ𝟏
θ0 , θ1
Outline:
• Start with some ( θ0 , θ1 ) 𝜽𝟎 = 𝟎, 𝜽𝟏 = 𝟎
𝑱 θ𝟎 , θ𝟏
θ𝟏
θ𝟎
.
𝜃- = 𝜃- − 𝛼 _ ./ 𝐽(𝜃0, 𝜃+) (for j = 0 and j = 1)
1
}
minimize 𝑱 θ𝟏 θ1 ∈ 𝑅
θ1
𝜃+ = 𝜃+ − 𝛼 _ (𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑣𝑎𝑙𝑢𝑒)
θ!
𝐽 θ! 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒 𝑠𝑙𝑜𝑝𝑒
.
𝜃+ = 𝜃+ − 𝛼 _ 𝐽(𝜃+)
./2
≤0
𝜃+ = 𝜃+ − 𝛼 _ (𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒 𝑣𝑎𝑙𝑢𝑒)
θ!
𝐽 θ!
𝑠𝑙𝑜𝑝𝑒 = 0
θ! 𝑎𝑡 𝑙𝑜𝑐𝑎𝑙 𝑜𝑝𝑡𝑖𝑚𝑎
θ!
.
𝜃+ = 𝜃+ − 𝛼 _ ./ 𝐽(𝜃+)
2
𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓θ! =0
𝜃+ = 𝜃+ − 𝛼 _ 0
𝜃+ = 𝜃+
𝑎
.
𝜃+ = 𝜃+ − 𝛼 _ ./ 𝐽(𝜃+)
2 𝑏
20 68 60
25 77 50
30 86 𝑥
10 15 20 25 30
F = 32 + 1.8·t
θ0 = 32
hθ(x)= 32 + 1.8 · x
θ1 = 1.8
(
/ 1
j=0 /,*
𝐽(𝜃+ , 𝜃' ) = ( ℎ (𝑥 % ) − 𝑦 (%) 𝜃0
𝑚 θ
%&'
(
/ 1
j=1 /,+
𝐽(𝜃+ , 𝜃' ) = ( ℎ (𝑥 % ) − 𝑦 (%) · 𝑥 % 𝜃+
𝑚 θ
%&'
(for j = 0 and j = 1)
}