Visualization

Visualization#

Loss-curve plots and circuit diagrams. Requires the plot extra (pip install "pdft[plot]").

Matplotlib helpers: training-loss plots and circuit schematics.

Optional plot extra. Imported by examples and benchmarks; not depended on by core. viz.loss plots loss histories; viz.circuit draws the gate sequence of a basis.

Contents

plot_training_loss

Plot a single loss trajectory (optionally smoothed) and return the Figure.

plot_training_comparison

Overlay multiple loss trajectories on one axis.

save_training_plots

Write one PNG per history plus a combined comparison plot.

plot_circuit

Render basis's circuit: one column per gate, in the order the gates act.

TrainingHistory

Thin wrapper around a loss trajectory for plotting.

ema_smooth

Exponential moving average smoother.