Skip to content

Commit

Permalink
Update KDELogisticRegression.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaher22 authored May 14, 2020
1 parent c10ca27 commit 11914a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions KDELogisticRegression.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def smooth_labels(self, X, y):
platt_pos = 1 / (N1 + 2)
for i in range(len(y)):
sample = X[i].reshape(1, -1)
score_pos = np.exp(self.pos_kde.score_samples(sample))
score_neg = np.exp(self.neg_kde.score_samples(sample))
score_pos = self.pos_kde.score_samples(sample)
score_neg = self.neg_kde.score_samples(sample)
if y[i] > 0:
y_smoothed[i] = 1 - platt_pos * score_pos / (score_pos + score_neg)
else:
Expand Down Expand Up @@ -132,4 +132,4 @@ def predict_ece_logloss(self, X, y, bins = 10):
preds_probs = self.predict_proba(X)
ece = ECE(bins)
calibrated_score = ece.measure(preds_probs, y)
return calibrated_score, log_loss(y, preds_probs, labels = [0, 1])
return calibrated_score, log_loss(y, preds_probs, labels = [0, 1])

0 comments on commit 11914a7

Please sign in to comment.