Skip to contents

Create a confusion matrix to display under tensorboard images.

Usage

conf_matrix_cb(path_tensorboard, run_name, confMatLabels, cm_dir)

Arguments

path_tensorboard

Path to tensorboard directory or NULL. If NULL, training not tracked on tensorboard.

run_name

Name of the run. Name will be used to identify output from callbacks. If NULL, will use date as run name. If name already present, will add "_2" to name or "_{x+1}" if name ends with _x, where x is some integer.

confMatLabels

Names of classes.

cm_dir

Directory that contains confusion matrix files.

Value

Keras callback, plot confusion matrix in tensorboard.

Examples

if (FALSE) { # reticulate::py_module_available("tensorflow")
cm <- conf_matrix_cb(path_tensorboard = tempfile(), run_name = 'run_1',
                     confMatLabels = c('label_1', 'label_2'), cm_dir = tempfile())
}