Assignment 0
Assignment 0
Assignment-0
Assigned Date: 21/01/2025
11:59pm, Due Date:08/02/2025
Instructions
• Work on the assignments on your own. You are free to discuss among your selves,but
don’t copy. If we find the assignments of a group of (two or more) students very similar,
the group will get zero points towards this assignment. Plagiarism will be cheked with
tools. Please use Python for writing code. You can submit the code as a Jupyter notebook
and For the theory questions, please submit your work to TAs. Use piazza to discuss, if
you have any doubts.
1 Programming
• Q1(12 Marks)-Let f : R2 → R, (x1 , x2 ) 7→ − cos(x21 + x22 + x1 x2 )
4. Find the local minimum x∗ of f|Sr (Identify on the contour plot) (local minimum:
It will be minimum in that region only)
5. Is x∗ a global minimum of f ? (Minimum in the entire domain of the function)
• Q2(10 Marks)- Implement the gradients for the following functions in 2 methods 1) Us-
ing derivative function 2) Numerical gradient (hint is given)
1
– With a sufficiently small value of epsilon, this function should be a good approxi-
mation of the gradient. Verify that both gradients (the numerical computation and
the one implemented with derivative functions) as the same
(a) Create your own dataset of XOR gate by adding noise to all the samples.marks)
(b) Implement a Neural Network (2 input nodes and 2 hidden nodes) from scratch with-
out using any library. (you can use numpy)
2 Theory
1. Q0 (5 Marks)
• In deep learning frameworks, are numerical gradients or true gradients used for
optimization? Which method is more computationally efficient, and what are the
key differences between numerical and true gradients?
• how does autograd in pytorch work?
• State any real time applications for numerical gradients?
2. Q1(10 marks) Consider the bivariate function f : R2 → R, (x1 , x2 ) 7→ x21 +0.5x22 +x1 x2 .