Lecture pptParameterEstimation
Lecture pptParameterEstimation
Shyan-Shiou Chen
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 1 / 24
Outline
Outline
1 lsqcurvefit in Matlab
Gradient Descent Method
Newton’s Method for finding zeros
Newton’s method in optimization
The Levenberg-Marquardt Algorithm
2 fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 2 / 24
lsqcurvefit in Matlab
lsqcurvefit 內含的演算法
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 3 / 24
lsqcurvefit in Matlab Gradient Descent Method
Outline
1 lsqcurvefit in Matlab
Gradient Descent Method
Newton’s Method for finding zeros
Newton’s method in optimization
The Levenberg-Marquardt Algorithm
2 fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 4 / 24
lsqcurvefit in Matlab Gradient Descent Method
Example
Consider f (x, y) = x2 + y 2 /4. Here, x = (x, y).
2 2 2 2
Gradient Descent on f(x,y) = x + y /4 Gradient Descent on f(x,y) = x + y /4
3 3
2 2
1 1
0 0
y
-1 y -1
Contour Contour
-2 Iteration Points -2 Iteration Points
Gradient Directions Gradient Directions
-3 -3
-3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3
x x
(a) (b)
Outline
1 lsqcurvefit in Matlab
Gradient Descent Method
Newton’s Method for finding zeros
Newton’s method in optimization
The Levenberg-Marquardt Algorithm
2 fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 6 / 24
lsqcurvefit in Matlab Newton’s Method for finding zeros
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 7 / 24
lsqcurvefit in Matlab Newton’s Method for finding zeros
f (xn )
xn+1 = xn −
f ′ (xn )
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 8 / 24
lsqcurvefit in Matlab Newton’s method in optimization
Outline
1 lsqcurvefit in Matlab
Gradient Descent Method
Newton’s Method for finding zeros
Newton’s method in optimization
The Levenberg-Marquardt Algorithm
2 fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 9 / 24
lsqcurvefit in Matlab Newton’s method in optimization
min f (x)
x∈R
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 10 / 24
lsqcurvefit in Matlab Newton’s method in optimization
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 11 / 24
lsqcurvefit in Matlab Newton’s method in optimization
f ′ (xk )
xk+1 = xk + t = xk −
f ′′ (xk )
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 12 / 24
lsqcurvefit in Matlab Newton’s method in optimization
∑
n
S(θ) = [yi − f (xi , θ)]2
i=1
∂S(θ)
∇S(θ) =
∂θ
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 13 / 24
lsqcurvefit in Matlab Newton’s method in optimization
Example
∑
Let θ be a parameter. S(θ) = 2i=1 [yi − f (xi , θ)]2 . Find that ∇S(θ).
Let ri = yi − f (xi , θ). Find J(θ) such that ∇S(θ) = −J(θ) · (r1 , r2 )t .
∂ 2 S(θ)
H(θ) =
∂θ2
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 14 / 24
lsqcurvefit in Matlab Newton’s method in optimization
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 15 / 24
lsqcurvefit in Matlab Newton’s method in optimization
θk+1 = θk + ∆θ
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 16 / 24
lsqcurvefit in Matlab Newton’s method in optimization
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 17 / 24
lsqcurvefit in Matlab The Levenberg-Marquardt Algorithm
Outline
1 lsqcurvefit in Matlab
Gradient Descent Method
Newton’s Method for finding zeros
Newton’s method in optimization
The Levenberg-Marquardt Algorithm
2 fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 18 / 24
lsqcurvefit in Matlab The Levenberg-Marquardt Algorithm
Here, λ is the damping factor that controls the step size and direction.
When λ is large, the algorithm behaves more like gradient descent,
ensuring stability. When λ is small, it behaves more like the
Gauss-Newton method, promoting faster convergence.
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 19 / 24
lsqcurvefit in Matlab The Levenberg-Marquardt Algorithm
Example
Consider a simple curve-fitting problem where we want to fit a model
y = aebx to some data points (xi , yi ) The residuals are given by
ri (a, b) = yi − aebxi
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 20 / 24
lsqcurvefit in Matlab The Levenberg-Marquardt Algorithm
Observed Data
6 Fitted Model
5.5
y 4.5
3.5
2.5
2
1 1.5 2 2.5 3 3.5 4 4.5 5
x
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 21 / 24
fminsearch in Matlab
150
y
100
50
0
1 2 3 4 5 6
x
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 23 / 24
fminsearch in Matlab
S-S Chen (Dep. of Math., NTNU) Parameter Estimation August 12, 2024 24 / 24