Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Homework Assignment #9 (23 points)
This assignment requires coding in Javascript. Use the template provided in
HW9_template.zip to get started. See param_est.js for the functions you need to
complete.
Use the data points provided in the template for all of the following problems.
Linear Least Squares
1. Complete the function calc_linLSQ_line(): Use linear least squares to
estimate the parameters (a and b) for the following model:
Also, calculate the sum of squared error and include in your report a plot using the
parameter values you found. (4 pts)
2. Similar to problem 1, complete the function calc_linLSQ_poly(): Use linear
least squares to estimate the parameters for various polynomials, such as:
Compare the plots and errors to your results from problem 1. Which of these 4
models (including problem 1) do you think best fits the data? Why? (7 pts)
Non-linear Least Squares
3. Derive the function for the Jacobian matrix for the following non-linear model:
In addition to including this derivation in your report, implement this in the
calc_jacobian() function. (2 pts)
Hint:4. Complete the function calc_nonlinLSQ_gaussnewton(): Use Gauss-Newton
non-linear least squares to estimate the parameters for the function from (3).
Use the following for your initial guess:
a=0.5, b=2, c=0.5, d=0.5
Stop after 10 iterations. (Note, these are the default values in the template.)
As with problems 1-2, find the sum of squared error and create a plot. (Calculate
the sum of squared error after each iteration.) Do you think this model fits the data
better than previous ones? Why or why not? (5 pts)
5. Complete the function calc_nonlinLSQ_gradientdescent(): Use Gradient
Descent non-linear least squares to estimate the parameters for the function from
(3).
Use the same initial guess as (4). Use a learning rate of 0.001 and stop after 5000
iterations.
As with problem 4, create a plot and find the sum of squared error after each
iteration. How does this algorithm compare to (4)
Try different values for learning rate. Can you achieve a better convergence rate
(lower error or less iterations for same error)? What are your observations on how
the algorithm behaves with different values? (5 pts)
Create (and submit in class) a report including answers to the asked questions and a
printout of your code. Also, create a ZIP archive of your code files and submit it in the
Homework 9 dropbox on Carmen.