read_tensorboard_pr_curves

read_tensorboard_pr_curves(logdir, *, tags=None, runs=None, step=None)

Read the PR curve charts of a TensorBoard log directory.

One chart per tag, as TensorBoard’s PR Curves dashboard draws it: recall along the x axis, precision along the y axis, one line per run.

Parameters

Name Type Description Default
logdir str or os.PathLike The directory TensorBoard would be started with, such as the one PyTorch’s add_pr_curve or TensorBoard’s pr_curve summary wrote. required
tags iterable of str Only these tags, in this order, and only these runs. None
runs iterable of str Only these tags, in this order, and only these runs. None
step int The step each run’s curve is read at: the last one logged at or before it. By default each run’s last. None

Returns

Name Type Description
list of TensorBoardChart One per tag.

Notes

Each line is named with its run, its average precision and the share of positives – the precision a random guess reaches, which a useful classifier stays above – such as good (AP 0.91, chance 0.30). A threshold at which nothing was predicted positive has no precision, and is left out of the line rather than read as a precision of 0.

Examples

>>> import maidr
>>> for chart in maidr.read_tensorboard_pr_curves("runs"):
...     maidr.show(chart)