W1_Coding grading issue: Got all values in Exercise 5 correct, but was graded as incorrect due to data order

The grader output docked points for my data being sorted sequentially and marked it as failed the unitest. I would appreciate some assistance.

Grader Output:


Filename: compute_training_params

Failed test case: Incorrect ‘probs_dict’ when using the whole ‘df_all_breeds’ dataframe.

Expected: {0: 0.348, 1: 0.391, 2: 0.261}, but got: {2: ‘0.261’, 0: ‘0.348’, 1: ‘0.391’}.

Failed test case: Incorrect ‘probs_dict’ when using dataframe with 3 dogs of breed 0, 1 of breed 1 and 1 of breed 2.

Expected: {0: 0.6, 1: 0.2, 2: 0.2}, but got: {2: ‘0.200’, 0: ‘0.600’, 1: ‘0.200’}.

Hi @Kevin_Shey,

Thanks for flagging this. It does look like a grader issue. @a-zarta, could you take a look at it, please?


Thank you! Appreciate the help.

I also needed to correct my earlier statement. Apologies. I meant didn’t sort the output sequentially but I got all the values correct.

I will go back and fix the sort if that is part of the requirement.

Hi @Kevin_Shey, I think the issue here is not the order of the dict but the types of the values. Notice that the grader expected floats as the values of the dict but it received strings. Values are indeed correct but they are surrounded by quotes.