0% found this document useful (0 votes)
22 views3 pages

MLDS A1 Spring2025

The document outlines the submission guidelines and tasks for Assignment No. 1 in the Machine Learning for Data Science course at National University of Computer & Emerging Sciences. It includes instructions for submitting code and a report, as well as specific tasks related to regression, gradient descent, normal equations, and logistic regression. Students are required to implement algorithms, visualize results, and discuss their findings while adhering to strict submission and coding rules.
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)
22 views3 pages

MLDS A1 Spring2025

The document outlines the submission guidelines and tasks for Assignment No. 1 in the Machine Learning for Data Science course at National University of Computer & Emerging Sciences. It includes instructions for submitting code and a report, as well as specific tasks related to regression, gradient descent, normal equations, and logistic regression. Students are required to implement algorithms, visualize results, and discuss their findings while adhering to strict submission and coding rules.
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/ 3

National University

of Computer & Emerging Sciences-Islamabad


Chiniot-Faisalabad Campus

Dr. Hashim Yasin


Department of Artificial Intelligence & Data Science.

DS5004 –Machine Learning for Data Science


Assignment No. 1
Assignment Submission Guidelines:

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.

___________________________________________________________________

Question No. 1: Regression & Gradient Descent

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,

a) Gradient Descent Implementation: Implement the gradient descent algorithm


with a learning rate = 0.05. Visualize the results after each iteration.

1
Implement the both
(i) standard gradient descent
(ii) stochastic gradient descent

b) Consider the closed-form solution to a least-square fit given as under.


Implement it in order to calculate the values of the parameters for the same
dataset as mentioned above.

𝜽 = (𝐗 𝑇 𝐗)−1 𝐗 𝑇 y

c) Visualize the data and the results of the linear regression graphically. Also,
discuss the results in detail.

d) Make comparison of both results obtained in case of (a) and (b).

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.

Question No. 2: Normal Equation

We computed the followings equations of 𝜃0 and 𝜃1 in the last lecture,

∑𝑚 𝑖 𝑖
𝑖=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.

You might also like