Question: PLease COMPLETE THE FOLLOWING IN PYTHON (MACHINE LEARNING COURSE) def accuracy(y_hat, y): Function to calculate the accuracy Inputs: > y_hat: pd.Series of predictions >

PLease COMPLETE THE FOLLOWING IN PYTHON (MACHINE LEARNING COURSE) def accuracy(y_hat, y): """ Function to calculate the accuracy Inputs: > y_hat: pd.Series of predictions > y: pd.Series of ground truth Output: > Returns the accuracy as float """ """ The following assert checks if sizes of y_hat and y are equal. Students are required to add appropriate assert checks at places to ensure that the function does not fail in corner cases. """ assert(y_hat.size == y.size) # TODO: Write here pass def precision(y_hat, y, cls): """ Function to calculate the precision Inputs: > y_hat: pd.Series of predictions > y: pd.Series of ground truth > cls: The class chosen Output: > Returns the precision as float """ pass def recall(y_hat, y, cls): """ Function to calculate the recall Inputs: > y_hat: pd.Series of predictions > y: pd.Series of ground truth > cls: The class chosen Output: > Returns the recall as float """ pass def rmse(y_hat, y): """ Function to calculate the root-mean-squared-error(rmse) Inputs: > y_hat: pd.Series of predictions > y: pd.Series of ground truth Output: > Returns the rmse as float """ pass def mae(y_hat, y): """ Function to calculate the mean-absolute-error(mae) Inputs: > y_hat: pd.Series of predictions > y: pd.Series of ground truth Output: > Returns the mae as float """ pass

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!