Master 1 AI Univ.
Blida 1
Module : ML & NN Computer science department
1st DW Series – Regression-
Exercise 1(linear regression)
Consider the following training set table for predicting the sales of the items.
Items (x) Sales (y)
I1 80
I2 90
I3 100
I4 110
I5 120
Consider two new items I6 and I7, whose actual values are: 80 and 75 respectively.
A regression model predict the values of the items I6 and I7 as: 75 and 85 respectively.
Find the following metrics: MSE, MAE, RMSE, RelMSE and CV.
Exercise 2 (linear regression)
A researcher is interested in understanding the relationship between the number of hours studied
(X) and the final exam scores (Y) for a group of students.
Hours Studied (X) Grade on Final (Y)
1 51
2 55
3 61
4 63
5 66
6 70
7 72
8 75
9 78
10 82
1. Plot the data points on a graph where the x axis represents the hours studied and the y axis
represents the exam score.
2. Perform a simple linear regression analysis to find the equation of the best fit line
The equation should be in the form: 𝑌 = 𝑏0 + 𝑏1 ∗ 𝑋 where:
o Y is the predicted exam score
o X is the number of hours studied
o b0 is the intercept
1/2
Master 1 AI Univ. Blida 1
Module : ML & NN Computer science department
o b1 is the slope
3. Use the regression equation to predict the exam score of a student who studied for 12 hours.
4. Use matrix form to find the regression equation.
Exercise 4 (logistic regression)
The following table represent the dataset of pass or fail in an exam for 5 students. Use logistic
regression as a classifier to answer the following questions.
Hours Study Pass(1)/Fail(0)
29 0
15 0
33 1
28 1
39 1
1. Calculate the probability of pass for the students who studied 33 hours.
2. At least how many hours student should study that makes he will pass the course with the
probability of more than 95%
Assume the model suggested by the optimizer for odds of passing the course is:
𝐥𝐨𝐠(𝒐𝒅𝒅𝒔) = −𝟔𝟒 + 𝟐 ∗ 𝒉𝒐𝒖𝒓𝒔
2/2