Documente Academic
Documente Profesional
Documente Cultură
Model representation
Machine Learning
Andrew Ng
100
0 0 500 1000 1500 2000 (feet2) 2500 3000
Size Supervised Learning Given the right answer for each example in the data.
Andrew Ng
Notation: m = Number of training examples xs = input variable / features ys = output variable / target variable
Andrew Ng
Training Set
How do we represent h ?
Learning Algorithm
Size of house
Estimated price
Linear regression with one variable. Univariate linear regression.
Andrew Ng
Andrew Ng
Cost function
Machine Learning
Andrew Ng
Training Set
Hypothesis:
s:
Parameters
s ?
Andrew Ng
How to choose
2
1 0 0 1 2 3
2
1 0 0 1 2 3
2
1 0 0 1 2 3
Andrew Ng
Andrew Ng
Hypothesis:
Simplified
Parameters:
Cost Function:
Goal:
Andrew Ng
(for fixed
, this is a function of x)
3 2
3
2 1 0 -0.5 0 0.5 1 1.5 2 2.5
y
1 0 0 1
Andrew Ng
(for fixed
, this is a function of x)
3 2
3
2 1 0 -0.5 0 0.5 1 1.5 2 2.5
y
1 0 0 1
Andrew Ng
(for fixed
, this is a function of x)
3 2
3
2 1 0 -0.5 0 0.5 1 1.5 2 2.5
y
1 0 0 1
Andrew Ng
Andrew Ng
Hypothesis: Parameters:
Cost Function:
Goal:
Andrew Ng
(for fixed
500 400
, this is a function of x)
0
0 1000
Size in
feet2
2000
3000
(x)
Andrew Ng
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
Andrew Ng
Machine Learning
Gradient descent
Andrew Ng
J(0,1)
Andrew Ng
J(0,1)
Andrew Ng
Incorrect:
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
If is too large, gradient descent can overshoot the minimum. It may fail to converge, or even diverge.
Andrew Ng
Andrew Ng
Gradient descent can converge to a local minimum, even with the learning rate fixed.
As we approach a local minimum, gradient descent will automatically take smaller steps. So, no need to decrease over time.
Andrew Ng
Andrew Ng
Linear regression with one variable Gradient descent for linear regression
Machine Learning
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
J(0,1)
Andrew Ng
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
(for fixed
, this is a function of x)
Andrew Ng
Batch: Each step of gradient descent uses all the training examples.
Andrew Ng
Andrew Ng