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

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
Get step-by-step solutions from verified subject matter experts
