-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes
More file actions
58 lines (42 loc) · 1.46 KB
/
notes
File metadata and controls
58 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
important notations for machine learning:
h = hypothesis
m = number of training examples
x = input variable/features
y = output variable/target variable
(x,y) = one training example
(x (i), y (i)) = i-th training example (i is superscript)
:= assignment
= truth assertion
α learning rate
“𝛛” means partial derivative
“𝓭” means derivative
Hypothesis:
h 𝛉(x) = 𝛉0 + 𝛉1 x
Parameters:
𝛉0, 𝛉1
Cost Function:
J(𝛉0, 𝛉1) = 1/2m ∑ (i=1 to m) (h 𝛉(x^(i)) - y^(i))^2
Goal:
minimize J(𝛉0, 𝛉1)
over 𝛉0, 𝛉1
The first hypothesis is given as:
h 𝛉(x) = 𝛉1 x
𝛉0 = 0
for fixed 𝛉1, this is a function of x
Derivative: The slope of the line that is tangent to the function at certain point
𝛉1 := 𝛉1 - α(𝓭/𝓭𝛉1)J(𝛉1)
where alpha is the learning rate
When the slope has a positive value:
The derivative takes a positive value
𝛉1 := 𝛉1 - α(positive number)
We are going to decrease 𝛉1 to get closer to the minimum.
When the slope has a negative value:
The derivate is negative
𝛉1 := 𝛉1 - α(negative number)
When α is too small, gradient descent can be slow:
𝛉1 := 𝛉1 - α(𝓭/𝓭𝛉1)J(𝛉1)
When α is small, the derivative multiplies with a small number
When α is too large, gradient descent can overshoot the minimum:
𝛉1 := 𝛉1 - α(𝓭/𝓭𝛉1)J(𝛉1)
If 𝛉 is close to the minimum and α is too big, it can fail to converge or diverge.
Reading images: imread(‘img.png’);