Solved-Assignment 3- Solution

$35.00 $24.00

Submit your 3 rendered ipynb files and 1 pdf file at: https://forms.gle/gRuj4XnegwyoB8T49 Q1. Use python to generate the plots for this question. Put together your plots in a pdf file (copy from ipynb). Plots should be labelled properly. A fan is rotating with a constant angular velocity, ω” = 2π( + 2) radians/s, where is…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

Submit your 3 rendered ipynb files and 1 pdf file at:

https://forms.gle/gRuj4XnegwyoB8T49

Q1.

Use python to generate the plots for this question. Put together your plots in a pdf file (copy from ipynb). Plots should be labelled properly.

A fan is rotating with a constant angular velocity, ω” = 2π( + 2) radians/s, where is the last digit of your roll number. You are measuring the angle of the fan, θ( ) = ” ; θ( ) ∈ [0,2π), with respect to time , sampled at a frequency Fs=128Hz for a duration of 1s.
a. Plot the angle [ ] w.r.t. n
b. Split the set of data samples ( , [ ]) into (mutually exclusive and exhaustive) training set 6789: and test set 6;<6, randomly. The size of training set, | 6789:| = 10. Plot the training samples ( , [ ]); ∈ 6789:. Set np.random.seed(R+2), where R is defined above.

c. Consider a model = ∑DCE” C C ; C ∈ ℝ. Find the optimal weights for = 5,11,20, using least squares solution. Plot ( , θ[ ]) and ( , [ ]) for training samples, as well as test samples. These graphs will look like the ones shown in slide no. 8 of lecture 7 (linear regression). So, you will get 3 × 2 plots. Save the code in LS.ipynb and plots in plots.pdf

d. Re-do part c with gradient descent. Plot ( , θ[ ]) and ( , [ ]) for training samples, as well as test samples. These graphs will look like the ones shown in slide no. 8 of lecture 7 (linear regression). So, you will get 3 × 2 plots. Save the code in GD.ipynb and plots in plots.pdf

e. Re-do part c with LASSO (section 3.1.4 of PRML book). Take = 10. Plot the reconstruction error L w.r.t. . Also, plot the values of weights w.r.t. . Vary in a range 0 to a value when half the weights become 0. Save the code in LASSO.ipynb and plots in plots.pdf

Note: in case your algorithm has stability problems, print different values to debug it. You will need to do something smart to make it stable.