Skip to main content

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 curve per run, read as one pr_curve layer.

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 curve is named with its run, and carries its average precision and the share of positives – the precision a random guess keeps, which a useful classifier stays above – which maidr.js announces against each point; the legend shows them, such as good (AP 0.91, chance 0.30). Each point carries its threshold. A threshold at which nothing was predicted positive has no precision, and is left out of the curve rather than read as a precision of 0. pr_curve is an experimental type.

Examples

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