0% found this document useful (0 votes)
22 views

Week 8

Uploaded by

Subham Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Week 8

Uploaded by

Subham Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Course: Machine Learning - Foundations

8 Test questions
Week 7:

1. (2 points) Two positive numbers have a sum of 60. What is the minimum product of
one number times the square of other number?
A. 0
B. 900
C. 60
D. 240

Answer: A
Let the two numbers be x and y
x+y=60
objective function from the question will be,
f (x) = x2 (60 − x)
For optima f 0 (x) = 0, 120x − 3x2 = 0
x = 0, 40
Product is minimum when x=0.

2. (2 points) (Multiple select) The point on y = x2 + 1 closest to (0,2) is


A. (0.707, 1.5)
B. (0.707, -1.5)
C. (-0.707,1.5)
D. (-0.707, -1.5)

Answer: A,C
Objective function f (x) = (x − 0)2 + (x2 + 1 − 2)2
f (x) = x4 − x2 + 1
For minima f 0 (x) = 0
4x3 − 2x = 0
x = 0, 0.707, −0.707
Corresponding y = 1, 1.5, 1.5

3. (2 points) The volume of the largest cone that can be inscribed in a circle of radius 6 m
is (correct up to two decimal places)

Answer: 268.19 m3
V = 31 πr2 h

r = 36 − x2
h=6+x
Course: Machine Learning - Foundations Page 2 of 5

For maxima, V 0 (x) = 0


− 3x2 − 12x + 36 = 0
x = 2, −6
x can not be nagative.
So r = 5.65
h=8
V = 268.19
(Questions 5-8 have common data) A firm produces two products A and B. Maximum
production capacity is 500 for total production. At least 200 units must be produced
every day. Machine hours consumption per unit is 5 hours for A and 3 hours for B. At
least 1000 machine hours must be used daily. Manufacturing cost is Rs 30 for A and Rs
20 for B.
Let x1 = No of units of A produced per day
and x2 = No of units of B produced per day
4. (1 point) The objective function for above problem is
A. min f (x) = 30x1 + 20x2
B. min f (x) = 15x1 + 55x2
C. min f (x) = 5x1 + 155x2
D. min f (x) = 30x1 − 20x2
Answer: A
We should minimise cost function.
Objective function is
min f (x) = 30x1 + 20x2
5. (2 points) The constraint due to maximum production capacity is
A. x1 + x2 ≥ 500
B. x1 + x2 ≤ 500
C. x1 + x2 6= 500
D. x1 + x2 = 500
Answer: B
Maximum production capacity is 500.
6. (2 points) The constraint due to minimum production capacity is
A. x1 + x2 = 200
B. x1 + x2 ≤ 200
C. x1 + x2 ≥ 200
D. x1 + x2 6= 200
Answer: C
Minimum production capacity is 200.
Course: Machine Learning - Foundations Page 3 of 5

7. (2 points) The constraint due to machine hour consumption is


A. 5x1 + 3x2 ≤ 1000
B. 5x1 + 3x2 6= 1000
C. 5x1 + 3x2 = 1000
D. 5x1 + 3x2 ≥ 1000

Answer: D
1000 machine hours must be used daily.
(Questions 9-11 have common data)
A factory manufactures two products A and B. To manufacture one unit of A, 1 machine
hours and 2 labour hours are required. To manufacture product B, 2 machine hours and
1 labour hours are required. In a month, 200 machine hours and 140 labour hours are
available. Profit per unit for A is Rs. 45 and for B is Rs. 35.
Let x1 =Number of units of A produced per month
and x2 =Number of units of B produced per month

8. (1 point) The objective function for above problem is


A. max f (x) = 45x1 + 35x2
B. min f (x) = 45x1 + 35x2
C. max f (x) = 35x1 + 45x2
D. min f (x) = 35x1 + 45x2

Answer: A
We need to maximize profit.

9. (2 points) The constraint for machine hours is


A. x1 + 2x2 ≥ 200
B. x1 + 2x2 ≤ 200
C. x1 + 2x2 6= 200
D. x1 + 2x2 = 200

Answer: B
Total machine hours available=200.

10. (2 points) The constraint for labour hours is


A. 2x1 + x2 = 140
B. 2x1 + x2 ≤ 140
C. 2x1 + x2 ≥ 140
D. 2x1 + x2 6= 140

Answer: B
Total labour hour available is 140.
Course: Machine Learning - Foundations Page 4 of 5

11. (2 points) (Multiple select) Gradient of a continuous and differentiable function


A. is zero at a minimum
B. is non zero at a maximum
C. is zero at a saddle point
D. decreases as you get closer to minimum

Answer: A,C,D
For critical points gradient of a function is 0.
As we move towards minima gradient decreases.

12. The value of a function at point 10 is 100. The values of the function’s first and second
order derivatives at this point are 20 and 2 respectively. What will be the function’s
approximate value correct up to two decimal places at the point 10.5 (Use second order
approximation)?

Answer: 110.25
According to Taylor’s series,
2 0
f (x + h) = f (x) + hf 0 (x) + h f2 (x) + ......
Here x = 10, h = 0.5
∴ f (x + h) = 110.25

13. (2 points) For the function f (x) = x sin(x) − 1, with an initial guess of x0 = 2.5, and
step size of 0.1, as per gradient descent algorithm, what will be the value of the function
after 4 iterations? (Correct up to 3 decimal places)

Answer: -1.710 (-1.624 to-1.795)


xn+1 = xn − ηf 0 (x)
After first iteration x1 = 2.64
After second iteration x2 = 2.823
After third iteration x3 = 3.059
After fourth iteration x4 = 3.355
f (3.355) = −1.710

14. (2 points) The value of f (x1 , x2 ) = 4x21 − 4x1 x2 + 2x22 with an initial guess of (2, 3)
after two iterations of gradient descent algorithm will be ............... Take the step size
1
η = t+1 , where t= 0,1,2....
Answer: 130
xn+1 =xn − η∇f (x)
8x1 − 4x2
∇f =
 −4x
 1 + 4x2
−2
x1 =
−1
Course: Machine Learning - Foundations Page 5 of 5
 
4
x2 =
−3
f (4, −3) = 130

15. (2 points) The point of minimum for the function f (x1 , x2 ) = x21 − x1 x2 + 2x22 with an
initial guess of (3, 2) with step size=0.5 using gradient descent algorithm after second
iteration will be .............. (correct up to 3 decimal places)

Answer: 2.312 (2.196 to 2.428)


xn+1 =xn − η∇f (x)
2x1 − x2
∇f =
 −x1+ 4x2
1
x1 =
 −0.5 
−0.25
x2 =
1
f (−0.25, 1) = 2.312

16. (2 points) Suppose we have n data points randomly distributed in space given by D =
{x1 , x2 , ....., xn }. A function f (p) is defined to
Pncalculate the sum of distances of data
2
points from a fixed point, say p. Let f (p) = i=1 (p − xi ) . What is the value of p so
that f(p) is minimum?
A. x1 + x2 + ..... + xn
B. x1 − x2 + x3 − x4 ....
x1 + x2 + .... + xn
C.
n
x1 − x2 + x3 − x4 ....
D.
n
Answer: Pn C
f (p) = i=1 (p − xi )2
f (p) = (p − x1 )2 + ...... + (p − xn )2
f 0 (p) = 2p(p − x1 ) + ..... + 2p(p − xn )
For minima f 0 (p) = 0
(p − x1 ) + (p − x2 ) + ..... + (p − xn ) = 0
np − (x1 + x2 + .... + xn ) = 0
x1 + x2 + .... + xn
p=
n

You might also like