csce585-mlsystems / project-athena

This is the course project for CSCE585: ML Systems. Students will build their machine learning systems based on the provided infrastructure --- Athena.
MIT License
13 stars 19 forks source link

Error Rate function is broken #18

Closed andrewwunderlich closed 4 years ago

andrewwunderlich commented 4 years ago

Describe the bug The provided method to calculate error rate (in src\utils\metrics.py) is broken after the last update. It throws a runtime warning and returns nan.

To Reproduce Simply run the tutorial craft_adversarial_examples.py, which now calls the error rate function and prints it to console.

Screenshots image

Desktop:

Additional Context The score returned is score = float(num_incorrections / amount) which evaluates to nan in my case because both num_incorrections and amount are zero. The divide-by-zero can be easily fixed, but the real issue is that amount should not be zero in the first place.

Supposing input parameter correct_on_bs takes the default value of None, then we will have num_incorrect = y_pred.shape[0], and amount = (y_pred.shape[0] - num_incorrect) will also by default return zero. Thus the function will always return nan unless correct_on_bs is supplied.

MENG2010 commented 4 years ago

good catch! I updated the algorithm at the last minute before submitted. It was computed using the incorrections and I changed it to use corrections and forgot to update the amount.