Skip to content

Commit

Permalink
added labels to threshold charts and confusion matrix (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubczakon authored Aug 27, 2019
1 parent 4838a7e commit 831f624
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# The short X.Y version
version = '0.12'
# The full version, including alpha/beta/rc tags
release = '0.12.3'
release = '0.12.4'

# -- General configuration ---------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions neptunecontrib/monitoring/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,13 @@ def expand_prediction(prediction):


def _plot_confusion_matrix(y_true, y_pred_class, ax=None):
if not ax:
_, ax = plt.subplots()
cmap = plt.get_cmap('Blues')
cm = sk_metrics.confusion_matrix(y_true, y_pred_class)
sns.heatmap(cm, cmap=cmap, annot=True, fmt='g', ax=ax)
ax.set_xlabel('predicted values')
ax.set_ylabel('actual values')


def _plot_class_metrics_by_threshold(y_true, y_pred_positive):
Expand All @@ -714,6 +718,8 @@ def _plot_class_metrics_by_threshold(y_true, y_pred_positive):
ax.text(x=best_thres + 0.01, y=0.98 * best_score,
s='thres={:.4f}\nscore={:.4f}'.format(best_thres, best_score),
color='red')
ax.set_xlabel('threshold')
ax.set_ylabel(name)
figs.append(fig)
return figs

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():

setup(
name='neptune-contrib',
version='0.12.3',
version='0.12.4',
description='Neptune Python library contributions',
author='neptune.ml',
author_email='[email protected]',
Expand Down

0 comments on commit 831f624

Please sign in to comment.