Question: Implement a function that returns an mn matrix whose entries are uniformly randomly distributed in the interval, [0,] for a given value of . Hint:

Implement a function that returns an mn matrix whose entries are uniformly randomly distributed in the interval, [0,] for a given value of .

Hint: Check out Numpy's module for generating (pseudo)random numbers: numpy.random

Implement a function that returns an mn matrix whose entries are uniformly

randomly distributed in the interval, [0,] for a given value of .

Use random_mat() function to write another function, perturb_system(X, y, eps), that creates two "perturbations" to the system defined by X and y.

  1. Let X be the first perturbation. It should have the same dimensions as X, and its entries should lie in the interval [,]. The value of is given by eps.
  2. The second is y, a small perturbation to the response variable, y. Its entries should also lie in the same interval, [,]

The function should return a perturbed system, X+X and y+y, as a pair.

Hint: Check out Numpy's module for generating (pseudo)random numbers: numpy.random Use random_mat()function to write another function, perturb_system(X, y, eps), that creates two "perturbations"

def random mat (m, n, eps): ### YOUR CODE HERE print(random mat (3, 2, 1e-3)) # Test cell: randepstest - - Z - random mat (5, 3, le-2) assert Z.shape(5, 3) assert ((Z >- 0) & (Z ]".format (EPSILON, EPSI - assert Delta y.shapey.shape, elta y has shape instead of .".format (Delta y.shape, y.shape) assert (np.abs (Delta_y) ]".format (EPSILON, EPSI print ("n(Passed.)") 007 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!