Calculate the weighted F-measure

def _F_measure(self, alpha, TP, FP, FN, return_num_den=False):
        """Calculate the weighted F-measure"""
        num = np.float64(TP)
        den = np.float64(alpha * (TP + FP) + (1 - alpha) * (TP + FN))
        with np.errstate(divide='ignore', invalid='ignore'):
            F_measure = num/den
        #F_measure = num/den

        if return_num_den:
            return F_measure, num, den
        else:
            return F_measure