-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathKerasPerfPlot.Rmd
More file actions
50 lines (37 loc) · 1.85 KB
/
KerasPerfPlot.Rmd
File metadata and controls
50 lines (37 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: "Plotting Keras Performance Trajectories"
author: "John Mount"
date: "`r Sys.Date()`"
output:
tufte::tufte_html: default
tufte::tufte_handout:
citation_package: natbib
latex_engine: xelatex
tufte::tufte_book:
citation_package: natbib
latex_engine: xelatex
link-citations: yes
---
Below is the standard performance trajectory plot from `Keras`.
```{r setup}
library("ggplot2")
library("WVPlots")
library("keras")
h <- readRDS("historyobject.rds")
plot(h)
```
We can also load the `Keras` `metricsframe` (a `data.frame` that is fairly standard to when working with `Keras`) and demonstrate or new [`WVPlots::plot_Keras_fit_trajectory()`](https://winvector.github.io/WVPlots/reference/plot_Keras_fit_trajectory.html) plot.
```{r wvplots}
d <- readRDS("metricsframe.rds")
knitr::kable(head(d))
WVPlots::plot_Keras_fit_trajectory(
d,
title = "model performance by epoch, dataset, and measure")
```
Obviously this plot needs some training to interpret, but that is pretty much the case for all visualizations.
The ideas of this plot include:
* All facets have the same interpretation: "up is better." This makes it easier to relate the shapes in one pane to the other.
* The only horizontal solid curve rendered is the validation (or hold-out) performance. The validation performance is the primary item of interest, so it gets a unique presentation.
* The training performance is represented as the upper boundary of the shaded region and with the pluses and vertical strokes.
* A vertical line is added at the best epoch picked by the "minus binary cross entropy" metric (this can be turned off or changed).
* An optional additional training over-fit penalized dashed curve is added. The default is: this is the validation score minus `10%` of the excess generalization error (the difference in training and validation performance).