diff options
author | Vasil Zlatanov <v@skozl.com> | 2019-03-10 18:30:33 +0000 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2019-03-10 18:30:33 +0000 |
commit | 717da7a7e173cd971baddd9f8edb6de668b1e815 (patch) | |
tree | c3bae02a30111fcc2541409c0f242f8a3a6b6b1d | |
parent | f60cf0650f8a1a4872308edff8ab2deb8503bb76 (diff) | |
download | e4-gan-717da7a7e173cd971baddd9f8edb6de668b1e815.tar.gz e4-gan-717da7a7e173cd971baddd9f8edb6de668b1e815.tar.bz2 e4-gan-717da7a7e173cd971baddd9f8edb6de668b1e815.zip |
Add plot probas function
-rw-r--r-- | lenet.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -17,6 +17,7 @@ from sklearn.decomposition import PCA from classifier_metrics_impl import classifier_score_from_logits from sklearn.utils import shuffle from sklearn.manifold import TSNE +import scikitplot as skplt def import_mnist(): from tensorflow.examples.tutorials.mnist import input_data @@ -142,6 +143,13 @@ def train_classifier(x_train, y_train, x_val, y_val, batch_size=128, epochs=100, model.save_weights('./weights.h5') return model +def plot_probas(model, x_test, y_true): + probas = model.predict(x_test) + skplt.metrics.plot_roc(y_true, probas) + plt.show() + skplt.metrics.plot_precision_recall_curve(y_true, probas) + plt.show() + def test_classifier(model, x_test, y_true, conf_mat=False, pca=False, tsne=False): x_test = np.pad(x_test, ((0,0),(2,2),(2,2),(0,0)), 'constant') logits = model.predict(x_test) |