CS 534: Homework #0

1. (Written) Have you read through the course website, noted the important dates, and the

class policies?

2. (Written) Which of the following courses have you taken?

(i) Have you taken any courses on Probability/Statistics? If yes, please write down the

institution name, course department, course name, and course grade.

(ii) Have you taken any courses on Linear Algebra? If yes, please write down the institution

name, course department, course name, and course grade.

(iii) Have you taken any courses on Optimization? If yes, please write down the institution

name, course department, course name, and course grade.

(iv) Have you taken any courses on Data Mining/Pattern Recognition/Machine Learning?

If yes, please write down the institution name, course department(s), course name(s),

and your course grade(s).

3. (Written) An urn has 3 red balls, 4 blue balls, and 5 green balls. Alice draws a ball from

the urn, and then Bob draws a ball. What is the probability that Bob got a green ball?

4. (Written) Let X ∈ R

n×p and y ∈ R

n be given.

1

(i) Find the optimal vector w∗ ∈ R

p which solves the following problem:

min

w∈Rp

1

2

∥y − Xw∥

2

(Hint) Consult the Matrix Cookbook if you want to look up expressions for derivatives

in matrix/vector form.

(ii) Does your solution above work if X is not full rank? If not, name one way to compute

w∗

6. (Code) Consider a 3-valued random variable X such that P(X = 1) = 0.35, P(X = 0) = 0.45

and P(X = −1) = 0.2. Write a Python function draw samples that takes in an integer n

and draws n random samples from X.

7. (Code) Given a numpy 1-d array (e.g., array([1,2,3,4])), write a Python function sum squares

that takes the array and computes the sum of squares of this array using numpy.dot.

8. (Code) Your 3-year-old daughter and 7-year-old son are troublemakers. While you are busy

grading assignments, they came up with this game of mixing her apple juice and his oreo

milkshake. She first pours 35% of her apple juice into the cup that has his milkshake, then

he pours 20% of whatever-it-is-now in the milkshake into the apple juice cup. They started

with exactly 1 cup of apple juice and 1 cup of oreo milkshake. Write a python function

troublemakers that takes in an integer n denoting the number of cycles and returns a 1-d

numpy array of 2 values with the first value containing the liquid in the apple juice cup and

the second value containing the liquid in the milkshake cup.

2

## Reviews

There are no reviews yet.