首页 >
> 详细

Fall 2021 CS 5340/4340 Project 6

Points 100 (UG) or 200 (G)

Due: Dec 9, 11:59 pm

r>This project is on implementing regression with regularization, with the regularization

parameter estimated from cross-validation. Do not use any package, except for the use of

random number generators and matrix operations (if any). That is, do not use any package

where regression, cross-validation, ridge or lasso are implemented as built-in functions. Use the

function y = f(x) = x2 + 10 to create a random sample (xj, yj) (training data) of size 12 (that is, j = 1

to 12) by uniform random sampling of x in -2 <= x <= 10. Obtain another five points (x-y pairs)

(by uniform random sampling of x in the same interval) to be used as the test set. Make sure

that the training set and the test set have no points in common; in the unlikely event of an

overlap, just re-sample.

1. Obtain a non-linear (quadratic) regression of y on x. Do this without regularization.

2. Next, implement linear regression of y on x with regularization (use “ridge” regression,

λ∑

2

), obtaining your λ from three-fold cross validation. Try the following values of λ

and choose one using cross-validation: 0.1, 1, 10, 100.

3. [For the grad section only; this part will require you to look up, read and implement

algorithms not covered in class] Finally, replace ridge in part 2 above with “lasso,”

λ∑ || , and re-do the computation. See the ISLR book for a good description of lasso.

Note that this project uses no single, fixed validation set because 3-fold cross-validation

arranges for multiple validation sets to be implicitly obtained from the training set; that is, we

are not using the traditional three-set (train/validate/test) scenario, but we are using the two-

set (train/cross-validate/test) scenario.

Clearly provide the following in your report as an itemized list (in addition to the source code):

(a) The twelve (x,y) values in the training set and the five (x,y) values in the test set.

(b) The equation of the non-linear regression relation you obtained in part 1; the in-sample

error; and the test error.

(c) The values of λ and the corresponding cross-validation errors (four such pairs) obtained

from the cross-validation phase in part 2 (also in part 3 for the grad section).

(d) The final (best) λ you chose after performing cross-validation in part 2 (and part 3 for

the grad section).

(e) The final equation of the regression relation you obtained after regularization (you

should have re-trained with the final λ on all 12 points in the training set); the

corresponding (final) in-sample error (state how many points were used in the

calculation of this error); and the corresponding test error.

(f) State whether or not you obtained your final (best) λ analytically. Just state (no

explanation).

(g) For ridge (and lasso for the grad section), arrange your three numerical errors (the

cross-validation error, the final in-sample (training) error, the test error) in ascending

order.

Plot your data points and the final solutions (by hand or with a plotting software; no extra

credit for using the software). Specifically, your plot should show 12 + 5 points on the x-y plane

and two (three for the grad section) final solutions (along with their respective equations) – one

curve for regression without regularization and two (three) lines for regression with

regularization – on the same plot.

Note that our original x is one-dimensional here. Take the average of squared differences as the

error.

Submission instructions as before. Please submit a single pdf (or Word or text) file on Canvas. If

you find it hard to merge text/figure and code into a single file, please submit multiple pdf files

(do NOT upload a zip file). Do not just provide a link to your code somewhere on the web.

Please write legibly if you are submitting any hand-written (and scanned) stuff.

联系我们

- QQ：99515681
- 邮箱：99515681@qq.com
- 工作时间：8:00-21:00
- 微信：codinghelp

- Cmpsc 131代写、Python语言程序辅导 2023-05-04
- Coursework 2: 2D Led Array编程代写 2023-05-04
- 代做coursework 2 2023-05-04
- Kit107代写、辅导c++语言编程 2023-05-04
- 辅导program、辅导java/Python编程 2023-05-03
- Cs520编程代写、辅导c/C++设计程序 2023-05-03
- Event Search Android App编程代做、辅导c++，Jav 2023-05-03
- Program辅导、辅导java，C++编程 2023-05-03
- 代写stat3010、辅导r编程设计 2023-05-03
- 代做comp5310、辅导java，Python编程 2023-05-03
- 代写qbus6820、辅导c++，Java编程 2023-05-02
- 代做com3504、辅导python，C++程序 2023-05-02
- 代写finc6021、辅导python，C++编程 2023-05-02
- Fit2099代写、辅导python，Java程序 2023-05-02
- 代做math60082、辅导java，Python程序 2023-05-02
- 代写comp30024、辅导python语言程序 2023-05-01
- 代做csc246/446、辅导python，Java编程 2023-05-01
- 代写comp30023、辅导c++程序设计 2023-05-01
- Comp2006代写、辅导c/C++编程设计 2023-05-01
- 代写finm7409、辅导java，C++编程 2023-05-01