Question: ` ` ` In [ 3 6 ] : #Run this self - test cell to check your code def calculate _ S _ dimensions

```
In [36]: #Run this self-test cell to check your code
def calculate_S_dimensions():
X = np.random.rand(700,100) # define random inputs
Z = np.random.rand(800,100) # define random inputs
n,d1=X.shape
m,d2=Z.shape
S1= calculate_S(X, n, m) # compute distances from your solutions
o1,o2=S1.shape
return (o1==n) and (o2==m)
def calculate_S_accuracy():
X = np.random.rand(700,100) # define random inputs
S1= calculate_S(X, X.shape[0],800) # compute distances from your solutions
S2= calculate_S_grader(X, X.shape[0],800) #compute distance from ground truth
test = np.linalg.norm(S1- S2) # compare the two
return test1e-5 # difference should be small
def calculate_R_dimensions():
X = np.random.rand(700,100) # define random inputs
Z = np.random.rand(800,100) # define random inputs
n,d1=X.shape
m,d2=Z.shape
R1= calculate_R(Z, n, m) # compute distances from your solutions
o1,o2=R1.shape
return (o1==n) and (o2==m)
def calculate_R_accuracy():
Z = np.random.rand(800,100) # define random inputs
R1= calculate_R(Z,700, Z.shape[0]) # compute distances from your solutions
R2= calculate_R_grader(Z,700, Z.shape[0]) #compute distance from ground truth
test = np.linalg.norm(R1- R2) # compare the two
return test1e-5 # difference should be small
runtest(calculate_S_dimensions,'calculate_S_dimensions')
runtest(calculate_S_accuracy,'calculate_S_accuracy')
runtest(calculate_R_dimensions,'calculate_R_dimensions')
runtest(calculate_R_accuracy,'calculate_R_accuracy')
```
Rnning Test: ralrulate & dimencinns ... X FailedI
` ` ` In [ 3 6 ] : #Run this self - test cell to

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 Programming Questions!