Skip to content

Commit

Permalink
EBM predict_proba calibration bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
interpret-ml committed Jun 7, 2019
1 parent 0d50ad1 commit ef59b17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/python/interpret/glassbox/ebm/ebm.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ def __init__(

def predict_proba(self, X):
check_is_fitted(self, "has_fitted_")
return EBMUtils.classifier_predict_proba(X, self)
prob = EBMUtils.classifier_predict_proba(X, self)
return prob

def predict(self, X):
check_is_fitted(self, "has_fitted_")
Expand Down Expand Up @@ -1165,7 +1166,8 @@ def predict_proba(self, X):
check_is_fitted(self, "has_fitted_")
X, _, _, _ = unify_data(X, None, self.feature_names, self.feature_types)
X = self.preprocessor_.transform(X)
return EBMUtils.classifier_predict_proba(X, self)
prob = EBMUtils.classifier_predict_proba(X, self)
return prob

def predict(self, X):
check_is_fitted(self, "has_fitted_")
Expand Down
6 changes: 3 additions & 3 deletions src/python/interpret/glassbox/ebm/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2019 Microsoft Corporation

# Distributed under the MIT software license
# TODO: Test EBMUtils

Expand Down Expand Up @@ -89,9 +90,8 @@ def classifier_predict_proba(X, estimator, skip_attr_set_idxs=[]):
)

# NOTE: Generalize predict when multiclass is supported.
log_odds_trans = np.c_[-log_odds_vector, log_odds_vector]
scores = expit(log_odds_trans)

prob = expit(log_odds_vector)
scores = np.vstack([1 - prob, prob]).T
return scores

@staticmethod
Expand Down

0 comments on commit ef59b17

Please sign in to comment.