Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Created September 13, 2018 21:57
Show Gist options
  • Select an option

  • Save SkalskiP/8964912137acd442a8efbecc91324700 to your computer and use it in GitHub Desktop.

Select an option

Save SkalskiP/8964912137acd442a8efbecc91324700 to your computer and use it in GitHub Desktop.
# Auxiliary function creating graph of classification boundaries
def save_model_prediction_graph(epoch, logs):
prediction_probs = model.predict_proba(grid_2d, batch_size=32, verbose=0)
plt.figure(figsize=(10,10))
sns.set_style("whitegrid")
plt.title('Binary classification with KERAS - epoch: ' + makeIndexOfLength(epoch, 3), fontsize=20)
plt.xlabel('X', fontsize=15)
plt.ylabel('Y', fontsize=15)
plt.contourf(X, Y, prediction_probs.reshape(100, 100), alpha = 0.7, cmap=cm.Spectral)
plt.scatter(X_train[:, 0], X_train[:, 1], c=y_train.ravel(), s=50, cmap=plt.cm.Spectral, edgecolors='black')
plt.savefig("./" + OUTPUT_DIR + "/keras" + makeIndexOfLength(epoch, 3) + ".png")
plt.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment