Skip to main content

Graph Keras training history object

Project description

Keras History Graph

Uses matplotlib to generate a simple graph of the history object. Particularly useful with Jupyter

It will show the accuracy and loss for both training data and validation data. It will also print the maximum validation accuracy reached during the training.

Example output


pip install keras-hist-graph


Requires Keras

from keras_hist_graph import plot_history

history =, y, ...)



plot_history now accepts any of these arguments (in any order)

argument default possible details
fig_size (10, 6) (float, float) Indicates width and height of the resulting graph
min_accuracy 0.5 [0, 1) Minimum accuracy to graph (often we don't care if acuracy is below 50%)
smooth_factor 0.75 [0, 1] Zero to one, inclusive. Smooths out the curves by averaging previous points. Consider makeing smaller if number of epochs is small.
start_epoch 5 integer >= 0 Plot the history starting at this epoch. Useful since the first epochs can have very high loss that makes the later loss hard to analyze visually
xkcd True True False Whether to render in the XKCD style. You might need to render twice for all properties to update if you change the boolean after using the method before


plot_history(history, fig_size = (11, 8.5), min_accuracy = 0.8, start_epoch = 2, smooth_factor = 0.1)


Why use the XKCD style?

It’s a great way to communicate the imprecision of the underlying data!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for keras-hist-graph, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size keras_hist_graph-0.0.3-py3-none-any.whl (4.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size keras-hist-graph-0.0.3.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page