Skip to content

Commit

Permalink
fix for #159 (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
DJCordhose authored Sep 9, 2021
1 parent 9b2776e commit 20d5c15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dtreeviz/classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ def _predict_proba(model, X):
if len(X.shape)==1:
X = X.reshape(-1,1)
# Keras wants predict not predict_proba and still gives probabilities
if model.__class__.__module__.startswith('tensorflow.python.keras'):
if model.__class__.__module__.startswith('tensorflow.python.keras') or \
model.__class__.__module__.startswith('keras'):
proba = model.predict(X)
if proba.shape[1]==1:
proba = np.hstack([1-proba,proba]) # get prob y=0, y=1 nx2 matrix like sklearn
Expand Down

0 comments on commit 20d5c15

Please sign in to comment.