Added tolerance to gradient computation fails (as for FMeasure), and modified FMeasure to be splitted into micro avg and macro avg