Closed lucyleeow closed 4 years ago
In SoftAccuracy what is the purpose of y_proba = np.clip(y_proba, 0, 1) in:
SoftAccuracy
y_proba = np.clip(y_proba, 0, 1)
def __call__(self, y_true_proba, y_proba): # Clip negative probas y_proba_positive = np.clip(y_proba, 0, 1) # Normalize rows y_proba = np.clip(y_proba, 0, 1) y_proba_normalized = y_proba_positive / np.sum( y_proba_positive, axis=1, keepdims=True) # Smooth true probabilities with score_matrix y_true_smoothed = y_true_proba.dot(self.score_matrix) # Compute dot product between the predicted probabilities and # the smoothed true "probabilites" ("" because it does not sum to 1) scores = np.sum(y_proba_normalized * y_true_smoothed, axis=1) scores = np.nan_to_num(scores) score = np.mean(scores) # to pick up all zero probabilities score = np.nan_to_num(score) return score
It appears to define the same thing as y_proba_positive and it is not used later in the function?
y_proba_positive
@agramfort @kegl
indeed the line:
is useless
In
SoftAccuracy
what is the purpose ofy_proba = np.clip(y_proba, 0, 1)
in:It appears to define the same thing as
y_proba_positive
and it is not used later in the function?@agramfort @kegl