https://github.com/whyboris/keras-hist-graph
Keras Loss & Accuracy Plot Helper Function
https://github.com/whyboris/keras-hist-graph
Last synced: 8 months ago
JSON representation
Keras Loss & Accuracy Plot Helper Function
- Host: GitHub
- URL: https://github.com/whyboris/keras-hist-graph
- Owner: whyboris
- License: mit
- Created: 2018-08-07T18:33:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-09T15:50:18.000Z (almost 7 years ago)
- Last Synced: 2025-01-31T02:36:30.231Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.

# Installation
`pip install keras-hist-graph`
# Usage
Requires _Keras_
```py
from keras_hist_graph import plot_history
history = model.fit(x, y, ...)
plot_history(history)
```
# Arguments
_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 |
Example:
```py
plot_history(history, fig_size = (11, 8.5), min_accuracy = 0.8, start_epoch = 2, smooth_factor = 0.1)
```
### Notes
[Why use the XKCD style?](https://www.chrisstucchio.com/blog/2014/why_xkcd_style_graphs_are_important.html)
It’s a great way to communicate the imprecision of the underlying data!