C2W1 Assignment - Exercise 5: eval_stats hardcoded in anomalies detection convenience method

I got caught with an unmatched output for the serving anomalies in exercise 6 and realized that the issue was coming from the calculate_and_display_anomalies function defined for the grader in exercise 5 (since using tfdv.validate_statistics and tdfv.display_anomalies yielded the expected output of 3 anomalies).

It appears that the calculate_and_display_anomalies function does not use its statistics argument when calling the tdfv methods and instead uses eval_stats as a hard coded value. Simple fix that then allowed me to use the function later on with serving_stats successfully.

Hello @pimpam87 Thank you for this
Was it a bug or a suggestion on how we might improve the assignment?

Well it’s more of a code inaccuracy :grinning:
The code lab does not mention or require students to use this function, as it is only used in one of the grader cell to validate results. So it is not a bug in the context of the code lab since no behavior is broken.
However, since the calculate_and_display_anomalies function takes in a statistics argument and that argument is never used (in favor of the global variable eval_stats), one could say it is a bug in the limited context of the function? :man_shrugging: