0% found this document useful (0 votes)
5 views4 pages

Homework #1 (100 Points) : A. Theory Problems

This document outlines Homework #1 for ELEC 3701, assigned by Prof. Golkowski for Spring 2024, with a total of 100 points. It includes theory problems on linear regression, coding problems involving Ohm's Law, multi-linear regression for MPG prediction, and digit classification using a Perceptron classifier. Each problem requires data analysis, model building, and performance evaluation, with specific data files provided for the tasks.

Uploaded by

Usman Ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Homework #1 (100 Points) : A. Theory Problems

This document outlines Homework #1 for ELEC 3701, assigned by Prof. Golkowski for Spring 2024, with a total of 100 points. It includes theory problems on linear regression, coding problems involving Ohm's Law, multi-linear regression for MPG prediction, and digit classification using a Perceptron classifier. Each problem requires data analysis, model building, and performance evaluation, with specific data files provided for the tasks.

Uploaded by

Usman Ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ELEC 3701 Spring 2024 Prof.

Golkowski

Homework #1 (100 points)


Assigned: 01/18/2024
Due: 02/01/2024

A. Theory Problems

1. Linear Regression with Intercept: Consider the problem of a single input variable 𝑥𝑥 and
output variable 𝑦𝑦. Assume we want to fit a simple linear model of the form 𝑦𝑦� = 𝜃𝜃1 𝑥𝑥 +
𝜃𝜃0 , and accordingly find the best value of 𝜃𝜃1 and 𝜃𝜃0 . Assume we have 𝑁𝑁 measurements
of the input and output where the 𝑛𝑛-th measurement is given by 𝑥𝑥 (𝑛𝑛) and 𝑦𝑦 (𝑛𝑛) with
corresponding estimate 𝑦𝑦� (𝑛𝑛) = 𝜃𝜃1 𝑥𝑥 (𝑛𝑛) + 𝜃𝜃0 . To find the best model, we want to
1 2
minimize the mean square error (MSE), 𝑀𝑀𝑀𝑀𝑀𝑀 = 𝑁𝑁 ∑𝑁𝑁 � (𝑛𝑛) − 𝑦𝑦 (𝑛𝑛) � .
𝑛𝑛=1�𝑦𝑦

Find the optimum values of θ1 and θ0 that minimizes the MSE. Make sure to show all
your work.
ELEC 3701 Spring 2024 Prof. Golkowski

B. Coding Problems

2. Ohm’s Law with Linear Regression: In this problem, you will determine the resistance
(R) or resistor based on noisy current measurement data. Consider an experiment
where the applied voltage (V) in Volts and measured current (I) in Amps are measured
across a resistor as shown in the figure below.

It is known from Ohm’s law that the relationship between current and voltage in a
resistor is given by 𝑉𝑉 = 𝐼𝐼𝐼𝐼.

a) Using the data file on CANVAS ‘OhmsLaw.csv’, estimate the resistance R. Make sure
to include your code with your submission. *Hint you can turn off the intercept term
on linear regression using with the regression object:
linear_model.LinearRegression(fit_intercept=False)

b) Make a plot of the regression line along with a scatterplot of the original data.

3. Miles Per Gallon Prediction using Multi-Linear Regression: In this problem, you will
build a linear model to predict the miles per gallon of a vehicle using four features:
number of cylinders, weight, 0-60 acceleration, and model year.

a) Using the data file ‘auto_dataset_train.csv’ (on CANVAS), compute the standard
deviation (𝑆𝑆𝑆𝑆) in miles per gallon of the training data. Note* The 𝑆𝑆𝑆𝑆 is a measure of
the spread of your data around it’s average, you can use numpy.std

b) Create a multi-linear regression model that predicts miles per gallon based on the
above mentioned features. State the root mean square error (𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅) of the training
data.
ELEC 3701 Spring 2024 Prof. Golkowski

c) Compare the 𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅 to the 𝑆𝑆𝑆𝑆, what does this imply about the linear model?

d) Using the data file ‘auto_dataset_test.csv’, test your model on the new data set.
State the root mean square error (𝑅𝑅𝑅𝑅𝑅𝑅𝐸𝐸𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 ) of the model on the test data. How
does this compare to the training 𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅?

e) Discuss some improvements or changes you would make to this model.

4. Digit Classification: For this problem, you will used a Perceptron classifier to detect the
number of a handwritten digit between 0 and 9. An example digit (sampled on an 8x8
pixel grid) looks like the following:

The testing data arrays for this problem contain 1257 labeled cases and are given in the
Python .npy files as ‘X_Train.npy’ and ‘y_train.npy’ (on CANVAS). The X_train array has
size 1257x64. Each row of the array corresponds to one image (as the example above),
however, the 8x8 grid of pixels has been reordered to 64x1. Note* you can view the n-th
training example using matplotlib.pyplot.imshow(X_train[n,:].reshape([8,8])). The array
y_train contains the 1257 integers between 0 and 9 which correspond accordingly to
each training example.

a) Build a perceptron model using the training data. Show images of the 5th , 111th,
584th and, 1200th training examples along with the true label and predicted label.
Note*: You can use the default regularization (𝛼𝛼 = 0.0001) for this problem.

b) Determine the accuracy of the model on the training set using the .score method.
ELEC 3701 Spring 2024 Prof. Golkowski

c) Test the model from part (a) on test data given in ‘X_test.npy’ and ‘Y_test.npy’.
Show images of the 19th , 48th, 336th , and 529th testing examples along with the true
label and predicted label.

d) Determine the accuracy of the model on the test set using the .score method. How
does this compare to the training data accuracy?
e) Discuss any changes you would make to the model.

You might also like