Question: please only use numpy package in python here's an output sample Fill in the body of the functions below following their descriptions def getAccuracy(predictions, actual):

 please only use numpy package in python here's an output sample

please only use numpy package in python

here's an output sample

Fill in the body of the functions below following their descriptions def

Fill in the body of the functions below following their descriptions def getAccuracy(predictions, actual): IF IT IT (5 pts) function receives two single dimensional numpy arrays (predictions and actual) then returns the accuracy of the predictions compared with the actual labels. Note: accuracy is out of 100 percent. Parameters: predictions: 1-D numpy array with predictions (either 1, or -1) actual: 1-D numpy array with actual labels (either 1, or -1) return None def getError(predictions, actual): (3 pts) function receives two single dimensional numpy arrays (predictions and actual) then returns the ERROR of the predictions compared with the actual Labels. Note: error is out of 100 percent. Parameters: predictions: 1-D numpy array with predictions (either 1, or -1) actual: 1-D numpy array with actual labels (either 1, or -1) return None In [1]: import numpy as np In [2]: pred = np.array([1, -1, -1]) In [3]: actuals = np.array([1, 1, -1]) In [4]: import homework1solution as hw1 In [5]: hw1.getAccuracy(pred, actuals) Out[5]: 66.66666666666666 In [6]: hw1.getError(pred, actuals) Out[6]: 33.33333333333334

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!