def probas_to_classes(y_pred):
    if len(y_pred.shape) > 1 and y_pred.shape[1] > 1:
        return categorical_probas_to_classes(y_pred)
    return np.array([1 if p > 0.5 else 0 for p in y_pred])
dataset/ETHPy150Open fchollet/keras/keras/utils/np_utils.py/probas_to_classes/original