Write a function to implement regularization based training


Assignment

• Write a function to implement regularization based training procedure for 1D regression. The function should have the following form: function a = mytrain (train_x, train_y,n, lamda), where train_x is a column vector containing all the input points in the training, train_y is a column vector containing all the output points in the training, n is the order of the polynomial model, lamda is a non-negative regularization parameter, and a is a column vector containing coefficients of the polynomial model.

• Write a function to implement testing procedure for 1D regression. The function should have the following form: function test_y = mytest (test_x, a), where test_x is a column vector containing all the input points in the test, a is a column vector containing coefficients of the polynomial model, and test_y is a column vector containing all the output points in the test.

• Write a script to do the following experiment

o Create 10 input points for training. They should be evenly distributed between 0 and 1.
o Create 10 corresponding output points for training as follows: cos(2*pi*x)+0.3*randn(10,1)
o Create 100 input points for testing. They should be evenly distributed between 0 and 1.
o Generate models for lamda = 0, and n = 1, 2, 3, 4,5,6,7,8,9, respectively.
o Generate models for n = 3, and lamda = 1e-8, 1e-5, 1e-2, 1, respectively.
o Generate models for n = 9, and lamda = 1e-8, 1e-5, 1e-2, 1, respectively.
o For each model, superimpose the testing results onto cos(2*pi*x)

• Write a report to summarize and discuss your results.

Request for Solution File

Ask an Expert for Answer!!
Applied Statistics: Write a function to implement regularization based training
Reference No:- TGS02391558

Expected delivery within 24 Hours