I am wondering if anyone could help me understand why my code is not passing the tests. Is there a possibility that there might be an issue with the autograder itself, or could I have overlooked some edge cases? Whom should I DM my code to?
Thank you very much for any help or suggestions.
Can you share screenshot of your submission grader output where it explains why you didn’t pass.
Usually the issue would be the way your code implementation differs from the autograder
Regards
DP
Thanks for your reply!
I didn’t pass any of the 3 tests, and the outputs for the 2nd and 3rd tests being exactly as expected.
The grader output did not cover the 2nd and 3rd tests,
it only explained the reason for failing the 1st test, citing the following issue:
Cell #7: Unable to compile the student’s code. Error encountered: TypeError(‘check_for_leakage_test() takes 1 positional argument but 3 were given’)
This is frustrating too because I did not define the check_for_leakage function myself:
def check_for_leakage(df1, df2, patient_col):
And when I tested this function using:
check_for_leakage(test_df, valid_df, 'PatientId')
it executes successfully.
However, the 'check_for_leakage_test() ’ function throws an argument error.
I am just not allowed to modify the arguments for either check_for_leakage_test() or check_for_leakage().
Regarding the specific tests:
For the 1st test, I implemented the set() to make the IDs unique and calculated the length of their intersection to check for any leakage.
For the 2nd test, I used np.sum() and simple Python calculations.
For the 3rd test, I employed K.means() and K.log().
Hello @capybara
Lets address one test at one time and then move to next section, so you do debugging with the hint given, if you still unable to understand we can think around a different way
Note, you using to check_for_leakage using test_df, valid_df, PatientId is incorrect as you are using three positional arguments instead of 1
Note the test cell where you did not write the code
do not edit this code cell
check_for_leakage_test(check_for_leakage)
is using the def check_for_leakage grader cell where you wrote the code and you had to use three arguments df1, df2 and patient_col(str) to create leakage using
-
define patients unique value using patient_col’s values for both dataframe1 and dataframe2.
-
Then using intersection between df1_patients_unique and df2_patiens_unique, you create patients in both groups.
-
Now to check leakage contains true if there is patient overlap, otherwise false.
Use len function to patients_in_both_groups greater than 0
Let me know once you clear test 1, then we will move to next section, but share the error for test 2 which you encountered.
Regards
DP
Hi @Deepti_Prasad,
I’ve finally discovered the issue with this assignment.
It appears that the 1st test cell was edited, which prevented the grader from recognizing it. Since the 1st test cell failed, the subsequent 2 cells were not evaluated.
Thank you for your generous assistance!
Best regards,
CP