MLDS A1 Spring2025
MLDS A1 Spring2025
1. Submit your assignment in soft form (Code + Report) within the due date and time. Soft
form does not mean submitting photos of the hardcopy.
2. The report must include a discussion, comments, and a conclusion about your solution.
Submitting without a report will result in a loss of full marks.
3. Name the zip or other folder/file that you submit using the following format:
MLDS_A1_RollNo_FirstName.
4. Ensure that you solve each task of the assignment on your own.
5. Late submissions will result in a deduction of marks.
6. There is no restriction on the programming language used for the tasks.
7. For programming tasks, you are NOT allowed to use any built-in functions or libraries for
specific tasks.
___________________________________________________________________
Download training dataset, which consists of the input X file and the corresponding
output Y file. The input X file has three attributes: the living area, the number of
bedrooms, and the number of floors, while the output Y file represents the house
prices in response to these attributes. There are 𝑚 = 50 training examples.
Perform the following tasks,
1
Implement the both
(i) standard gradient descent
(ii) stochastic gradient descent
𝜽 = (𝐗 𝑇 𝐗)−1 𝐗 𝑇 y
c) Visualize the data and the results of the linear regression graphically. Also,
discuss the results in detail.
Note:
• If the solution is not computable in question (b) due to the costly inverse
matrix, you may then reduce the number of training examples in the given
dataset, and try it again with both methods ((a) and (b)).
• In both questions (a) and (b), find your solutions with and without
preprocessing of the data and then justify the reason if you are performing
preprocessing.
∑𝑚 𝑖 𝑖
𝑖=1 𝑥 𝑦 − 𝑚. 𝑥̅ 𝑦
̅
𝜃0 = 𝑦̅ − 𝜃1 𝑥̅ 𝜃1 = 𝑚 2,𝑖
∑𝑖=1 𝑥 − 𝑚. 𝑥̅ 2
Your task is to compute step-by-step the following normal equation in matrix form
from the equations of 𝜃0 and 𝜃1 as mentioned earlier,
𝑚 ∑𝑚
𝑖=1 𝑥
𝑖
𝜃0 ∑𝑚
𝑖=1 𝑦
𝑖
( 𝑚 𝑖 ) ( ) = ( 𝑚 𝑖 𝑖)
∑𝑖=1 𝑥 ∑𝑚
𝑖=1 𝑥 2,𝑖 𝜃1 ∑𝑖=1 𝑥 𝑦 2
Question No. 3: Logistic Regression
Implement the logistic regression in order to classify the houses into two classes,
“Costly” and “Not Costly”, using the same input data “DataX” and the classes in
“ClassY” file provided in Question 1. The “ClassY” file contains two values: 1 for
“Costly” class and 0 for “Not Costly” class.