C1_W2 Week 2

Can someone please help me? My grading output keeps showing the following and I don’t know what to do. I am frustrated. It keeps grading me 40%, yet I got all the output right. Thank you.

Function “true_positives” not found in Code Cell UNQ_C2.
Function “false_positives” not found in Code Cell UNQ_C2.
Function “true_negatives” not found in Code Cell UNQ_C2.
Function “false_negatives” not found in Code Cell UNQ_C2.
Function “true_positives” not found in Code Cell UNQ_C4.
Function “false_negatives” not found in Code Cell UNQ_C4.
Function “false_positives” not found in Code Cell UNQ_C4.
Function “true_negatives” not found in Code Cell UNQ_C4.
Function “true_positives” not found in Code Cell UNQ_C5.
Function “false_positives” not found in Code Cell UNQ_C5.
Function “true_negatives” not found in Code Cell UNQ_C5.
Function “false_negatives” not found in Code Cell UNQ_C5.
Code Cell UNQ_C1: Function ‘false_positives’ is correct.
Code Cell UNQ_C1: Function ‘true_negatives’ is correct.
Code Cell UNQ_C1: Function ‘false_negatives’ is correct.
Code Cell UNQ_C2: Function ‘get_accuracy’ is correct.
Code Cell UNQ_C3: Function ‘get_prevalence’ is correct.
Code Cell UNQ_C4: Function ‘get_sensitivity’ is correct.
Code Cell UNQ_C4: Function ‘get_specificity’ is correct.
Code Cell UNQ_C5: Function ‘get_ppv’ is correct.
Code Cell UNQ_C5: Function ‘get_npv’ is correct.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.

Hello @Odutola_Olujim

While recalling true negative, false positive, true positive and false negative you must have recalled it different than what the grader wants you to recall them TP, FP, TN AND FN.

Notice for the same cell you are passing on the function test for the same recall. So check how you are recalling them in the function recall is same way grader wants you to recall those.

Regards
DP

Is your issue resolved @Odutola_Olujim ??

Hi DP,
I have been offline deep learning for a little while. My issue is not solved yet. This is the code I am talking about:

UNQ_C2 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)
def get_accuracy(y, pred, th=0.5):
Compute accuracy of predictions at threshold.
Args:
y (np.array): ground truth, size (n_examples)
pred (np.array): model output, size (n_examples)
th (float): cutoff value for positive prediction from model
Returns:
accuracy (float): accuracy of predictions at threshold
accuracy = 0.0
START CODE HERE (REPLACE INSTANCES OF ‘None’ with your code)

{CODES REMOVED BY MODERATOR AS GRADER CELL CODES ARE USED TO GRADE YOUR ASSIGNMENT, POSITING ON PUBLIC POST IS AGAINST CODE OF CONDUCT}
END CODE HERE
return accuracy

Could you kindly look and point to where I made a mistake? Please this is very important to me. Thank you.

Hello @Odutola_Olujim

Please don’t post codes here on public post threads it is against community guidelines. Kindly remove the codes.

The way you recalling the TP, FP, FN and TN using numpy sum is incorrect.

Use the def statements from UNQ-C1, true_positives, false_positives, true_negatives and false negatives as the y, pred values are already defined in the previous grader cell.

So just defining them with the y, pred and threshold should be enough to calculate the right way for TP, FP, TN and FN.

Notice the header instruction in the code mentions below
get TP, FP, TN, FN using our previously defined functions

Let me know if you still have issue.

Regards
DP

Hi DP. I apologize for the codes posted on the forum. I have done all you asked me to do, but the same issues are still happening. At this point, I don’t know what else I can do. I am a paying student, is there a way I can have access to a tutor to show what is happening? I believe if I can get a tutor to see what I am doing, then the issue should be solved.

There are no tutors for DLAI courses.
The mentors are volunteers.

You just need to recall TP using the true_positives defined from previous grade cell using a tuple of y, pred, th(threshold, don’t need to assign values to these three arguments.
Same way recall others FP, TN and FN.

This is more direct of giving hint on how to write the codes. If still unable to understand then let me know

Can I DM you my code?

I already saw your codes and explained you what is the mistake.

TP=previously recalled def statement with a tuple of y, pred, th
Same applied for others