aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lenet.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lenet.py b/lenet.py
index 9b4bb2e..881cfd7 100644
--- a/lenet.py
+++ b/lenet.py
@@ -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)