Since predicted and expected are integers we shouldn't really need the math.abs check -- we would just do predicted == expected ?