Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):

image text in transcribed

please only use numpy package in python

here's an output sample

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

List the components of a business model of a business problem.

Answered: 1 week ago