0% found this document useful (0 votes)
4 views2 pages

Assignment 0

The document outlines the assignment details for DS411 - Optimization for Data Science, assigned on January 21, 2025, with a due date of February 8, 2025. It includes programming tasks related to contour plots, gradients, and neural networks, as well as theory questions on gradient optimization and specific bivariate functions. Students are instructed to work independently, use Python, and submit their work in specified formats while adhering to plagiarism policies.

Uploaded by

b21102
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)
4 views2 pages

Assignment 0

The document outlines the assignment details for DS411 - Optimization for Data Science, assigned on January 21, 2025, with a due date of February 8, 2025. It includes programming tasks related to contour plots, gradients, and neural networks, as well as theory questions on gradient optimization and specific bivariate functions. Students are instructed to work independently, use Python, and submit their work in specified formats while adhering to plagiarism policies.

Uploaded by

b21102
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/ 2

DS411 - Optimization for Data Science

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 )

1. Create a contour plot of f in the range [−2, 2] × [−2, 2] with Python.


2. Compute ∇f and Compute ∇2 f

Now, we define the restriction of f to Sr = {(x1 , x2 ) ∈ R2 | x21 + x22 + x1 x2 < r} with


r ∈ R, r > 0, i.e., f|Sr : Sr → R, (x1 , x2 ) 7→ f (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

1. Q3.(5 Marks) Neural Networks - Scratch Implementation

(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 .

(a) Find the direction of greatest increase of f at x = (1, 1).


(b) Find the direction of greatest decrease of f at x = (1, 1).
(c) Find a direction in which f does not instantly change at x = (1, 1).

3. Q3(10 marks) Consider the bivariate function f : R2 → R, (x1 , x2 ) 7→ exp(π · x1 ) −


sin(π · x2 ) + π · x1 · x2

(a) Compute the gradient of f for an arbitrary x.


(b) Compute the Hessian of f for an arbitrary x.

You might also like