Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views11 pages

DAMA_50_exam_resit_22-23

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

HELLENIC OPEN UNIVERSITY - SCHOOL OF SCIENCE AND TECHNOLOGY

DATA SCIENCE AND MACHINE LEARNING : DAMA50 ACAD. YEAR 2022-23

DAMA50 Resit Exam solutions


(9-7-23)

PART I
Problem 1
 
    +1
2 1 2 3
Given X = ,A = , Y =  +1 , the expression X T AY equals
1 4 5 6
−1
3 +3

• −2

• −2 3
 
−2
•  2 
3
• None of these

Problem 2
For a non-rectangular matrix A, which of the following is true

3 The number of independent rows equals the number of independent columns.

• The rank is not defined.

• The transpose matrix is not defined.

• The determinant always equals zero.

• None of these statements is true.

Problem 3
 
0 1
Given A = , the expression tr(A3 ) equals
1 1
3 4

• 3

• 2

• 1

• 0

1
Problem 4
Consider the function f (x, y, z) = xy + z where x(t) = sin(t), y(t) = cos(t) and z(t) = t. The derivative of
the function with respect to t equals

3 2 cos2 (t)

• cos2 (t) − sin2 (t)

• 1 + sin(2t)

• 1 + sin(t) + cos(t)

• None of these.

Problem 5
The function f (x, y) = x3 + y 3 − 3xy exhibits two stationary points one at (x, y) = (0, 0) and one at
(x, y) = (1, 1). These are, respectively,

3 a saddle point and a minimum.

• two minima.

• two maxima.

• a maximum and a minimum.

• a saddle point and a maximum.

Problem 6 
The gradient of the function f (x, y) = ln x2 + y 2 at (x, y) = (2, 2) equals

3 21 , 12

• 14 , 14

• (4, 4)

• (2, 2)

• (1, 1)

Problem 7
Consider the convex function f (x1 , x2 ) = x21 + 10x22 . Which of the following choices coincides with the
first gradient update x(1) having selected learning rate equal to 0.01 and initial guess x(0) = [0.5, 0.5]T :

3 x(1) = [0.49, 0.40]T

• x(1) = [0.499, 0.49]T

• x(1) = [0.495, 0.45]T

• x(1) = [0.51, 0.60]T

• None of the these.

2
Problem 8
Consider the independent random variables X and Y have variances 0.2 and 0.5, respectively. Let Z =
5X − 2Y . The variance of the random variable Z equals:

3 7

• 2

• 3

• 6

• None of these.

Problem 9
Suppose f⃗(x1 , x2 ) = (4x1 x2 , x1 + 3x2 )T . Which of the following answers is equal to the determinant of
the Jacobian matrix of f⃗(x1 , x2 )?

3 12x2 − 4x1

• 4x2 − 4x1

• 4x2 − 12x1

• 12x2 − x1

• None of these.

Problem 10
Which of the following expressions is the first defivative of the function f (x) = sin(x100 ) + sin100 (x)?

3 100x99 cos(x100 ) + 100 sin99 (x) cos(x)

• x99 sin(x100 ) + sin99 (x) sin(x)

• 100 cos(x100 ) + 100x cos(x)

• 99x100 cos(x100 ) + 99 sin100 (x) cos(x)

• 99x100 sin(x100 ) + 99 cos100 (x) sin(x)

Problem 11
Which of the following functions is/are convex? √
(a) f (x) = ln(1 + ex ) on R , (b) f (x) = sin(x) on R , (c) f (x) = 1 + x2 on R

3 Only (a) and (c).

• All (a),(b) and (c).

• Only (b) and (c).

• Only (b).

• Only (a).

3
Problem 12
 
2
If we rotate the vector X = by 45◦ , we obtain the vector
−2
 √ 
2 2
3
0
 
−2

2
 
2

−2
 √ 
2 √2

−2 2
• None of these.

Problem 13
The probability of obtaining “heads” when a biased coin is tossed is 0.65. The coin is tossed seven times.
What is the probability of obtaining at least four “heads” ?

3 0.80

• 0.27

• 0.65

• 0.92

• 0.57

Problem 14
 
0 a b
For which of the following values of the parameters a, b the eigenvalues of the matrix A =  a b 0 ,
b 0 b
are +1,-1,-2 ?

3 a = 1, b = −1

• a = −1, b = 0

• a = 1, b = 2

• a = 0, b = −1

• a = 1, b = 1

Problem 15
For which value of the parameter λ the system

3x + 2y = 10
6x + 4y = λ

has infinite many solutions ?

4
3 λ = 20

• λ = 10

• λ=0

• λ=4

• λ=6

PART II
The following problems should be solved using by hand calculation. The answers should be handwritten,
scanned and uploaded in pdf format.
Problem 1
Consider the matrix
 
0 2 0
A= 2 0 0 
0 0 1

Using by hand calculation,


(a) find the eigenvalues of A; [40%]
(b) find the associated (normalised) eigenvectors; [40%]
T
(c) find the matrix P that factorises A = P Ad P where Ad is a diagonal matrix. What are the entries of
Ad ? [20%]
Solution
(a) The eigenvalues are the roots of the characteristic polynomial

−λ 2 0  
det(A − λ1) = 0 ⇒ 2 −λ 0 = 0 ⇒ (1 − λ) λ2 − 22 = 0 ⇒
0 0 1−λ
(λ − 1) (λ − 2) (λ + 2) = 0 ⇒ λ = 2, 1, −2 (16.1)

(b) The eigenvectors are solutions of the equation

AX = λX (16.2)

For λ = 2 Equation (16.2) gives


    
−2 2 0 x 0 −2x + 2y = 0
 2 −2 0  y  =  0  ⇒ 2x − 2y = 0 ⇒ x = y, z = 0 (16.3)
0 0 1−2 z 0 −z = 0

Thus the eigenvector is


   
x 1
1 1
v1 =  x  , imposing v1T v1 = 1 ⇒ 2x2 = 1 ⇒ x = √ ⇒ v1 = √  1  (16.4)
0 2 2 0

Similarly, for λ = 1
    
−1 2 0 x 0 −x + 2y = 0
 2 −1 0  y  =  0  ⇒ 2x − y = 0 ⇒x=y=0 (16.5)
0 0 1−1 z 0 0z = 0

5
Thus the eigenvector is
  
0 0
v2 =  0  , imposing v1T v1 = 1 ⇒ z 2 = 1 ⇒ z = 1 ⇒ v2 =  0  (16.6)
z 1

Finally, for λ = −2
    
2 2 0 x 0 2x + 2y = 0
 2 2 0  y  =  0  ⇒ 2x + 2y = 0 ⇒ y = −x, z = 0 (16.7)
0 0 1−2 z 0 −z = 0

and the eigenvector is


   
x 1
1 1
v3 =  −x  , imposing v3T v3 = 1 ⇒ 2x2 = 1 ⇒ x = √ ⇒ v3 = √  −1  (16.8)
0 2 2 0

(c) By definition, the matrix Ad is a diagonal matrix with entries the eigenvalues of A
 
2 0 0
Ad =  0 1 0  (16.9)
0 0 −2

and the matrix P is the matrix whose columns are the eigenvectors of A
 
1 0 1
1
P = √  1 √0 −1  (16.10)
2 0 2 0

Problem 2
Using by hand calculation, compute the Taylor expansion of the function f (x, y) = sin(xy) around the
point ⃗x0 = (0, 0)T taking into account terms up to and including second order in x, y.
Solution
We will use the Taylor expansion

⃗ (⃗x0 )(⃗x − x⃗0 ) + 1 (⃗x − x⃗0 )T H(⃗x0 )(⃗x − x⃗0 ) + . . .


f (⃗x) = f (⃗x0 ) + ∇f (17.1)
2
where ∇f
⃗ stands for the gradient
 
∂f ∂f
∇f
⃗ = , (17.2)
∂x ∂y
and H is the Hessian matrix
!
∂2f ∂2f
∂x2 ∂x∂y
H= ∂2f ∂2f (17.3)
∂y∂x ∂y 2

Computing the first and second partial derivatives of f we get


∂f
= y cos(xy) (17.4)
∂x
∂f
= x cos(xy) (17.5)
∂y

6
and
 
∂2f ∂ ∂f ∂
= = (y cos(xy)) = −y 2 sin(xy) (17.6)
∂x2 ∂x ∂x ∂x
 
∂2f ∂ ∂f ∂
= = (x cos(xy)) = −x2 sin(xy) (17.7)
∂y 2 ∂y ∂y ∂y
 
∂2f ∂ ∂f ∂
= = (x cos(xy)) = cos(xy) − xy sin(xy) (17.8)
∂x∂y ∂x ∂y ∂x
∂2f ∂2f
= = cos(xy) − xy sin(xy) (17.9)
∂y∂x ∂x∂y
Thus

∇f
⃗ (x, y) = (y cos(xy), x cos(xy)) ⇒ ∇f
⃗ (0, 0) = (0, 0) (17.10)

and
   
−y 2 sin(xy) cos(xy) − xy sin(xy) 0 1
H(x, y) = ⇒ H(0, 0) = (17.11)
cos(xy) − xy sin(xy) −x2 sin(xy) 1 0

Substituting back into (17.1) and using f (0, 0) = 0 we find


  
1 0 1 x
f (x, y) = 0 + (x , y) + · · · = xy + . . . (17.12)
2 1 0 y

7
PART III
The following problems should be solved utilising Sagemath and a sagemath/jupyter notebook. The solution
notebook should be uploaded in its original form (.ipynb file).
Problem 1
Consider the following two sets of vectors

(i) b1 = (1, 2, 2)T , b2 = (−1, 2, 1)T , b3 = (0, 8, 0)T


(ii) b1 = (1, 2, 2)T , b2 = (−1, 2, 1)T , b3 = (0, 8, 6)T

Using Sagemath
(a) find which of these sets is/are basis/es in R3 . Comment on the result. [20%]
For the set/s that is/are basis/es
(b) construct the corresponding orthonormal basis e1 , e2 , e3 ; [20%]
(c) verify that the vectors e1 , e2 , e3 are indeed orthonormal; [20%]
(d) write the vector ⃗k = (1, 2, 3) in the basis e1 , e2 , e3 ; [20%]
(e) check whether the change of basis of question (d) preserves the norm of ⃗k. Comment on the result.
[20%]
Solution

8
9
Problem 2
Using sagemath and working numerically
(a) find a local minimum of the function

f (x, y) = (1.5 − x + xy)2 + (2.25 − x + xy 2 )2 + (2.625 − x + xy 3 )2

starting from the point x0 = (5, −1) and utilising two different algorithms (one using the derivatives and
one not using them). Derive the number of function calls utilised in each algorithm and compare the two
algorithms. [40%]
(b) Compute the function value and the gradient value at the minimum. [20%]
(c) Plot the above function using a contour plot (with appropriate parameter bounds) and depict the
position of the minimum. [20%]
(d) find a local minimum of f (x, y) in the region x2 + y 2 < 2 starting from the point x0 = (1/2, 1/2). [20%]

Solution

10
11

You might also like