handle division by zero like in sklearn.metrics
corrected docstrings