Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Birla Institute of Technology & Science, Pilani

Regression - Assignment 1
Course No. : AIML_Oct_2023_C1_PCAMZC211
Course Title : PG Program in AI & Machine Learning
Total Marks: 36
==================================

1) Two different mathematical formulations were discussed in class for closed form
solution of Linear regression. Python code implementation was shown in contact
hour session for method (b) below. Do a similar implementation for method (a)

Test the implementation for the below data points and highlight your
observations.

X = np.array([[1, 2], [3, 4], [5, 6]])


y = np.array([1, 3, 5])

[2+2 Marks = 4 Marks]

2) Implement closed form solution for Ridge regression.


X = np.array([[1, 2], [3, 4], [5, 6]])
Y = np.array([1, 3, 5])

What are values of betas (coefficients) observed with ridge regression.

[4 Marks]

3) Another alternative that is smoother than both MSE and MAE. It's defined as the
logarithm of the hyperbolic cosine of the prediction error.

Prove that the function is a convex function. [2 Marks]


4) Download the data set and do following. [16 Marks]
DATASET LINK
https://drive.google.com/file/d/1wpayvaCAAGeCKMMGLpsAKE9f7q7xrjKD/
view?usp=sharing

a. Split the data in train and test with test size = 20%
[0.25 Marks]

b. Perform a simple linear regression using Scikit-Learn library and compute.


i. MSE
ii. Estimated Model coefficients.
[3+0.5+0.5 Marks]

c. Perform Ridge regression using Scikit-Learn library and compute –


i. MSE
ii. Estimated Model coefficients.
[3+0.5+0.5 Marks]

d. Perform Lasso regression using Scikit-Learn library and compute –


i. MSE
ii. Estimated Model coefficients.
[3+0.5+0.5 Marks]

e. Perform Polynomial regression using Scikit-Learn library for various


degrees in range of 1-5 and compute following.
i. MSE for degree 1
ii. MSE for degree 2
iii. MSE for degree 5
[3+0.25+0.25+0.25 Marks]

5) Record a short video explaining you code and observations [10 Marks]

Required deliverables –
1) Clean code implementation in ipynb file
2) Any observations or mathematical solution can be presented on pen and paper
and a image can be shared in a word / pdf file.
3) A short video is required explaining you code and observations. A flat 10 Marks
will be deducted without the video.

You might also like