pulsatrix
Loading...
Searching...
No Matches
pulsatrix::ImPlotMetricsSink Class Reference

A concrete MetricsSink (metrics_sink.hpp's own doc comment names this the expected extension point: "Concrete writers... implement this") that buffers every logged scalar into a per-tag time series, and keeps the latest histogram snapshot per tag, for live rendering by a training dashboard. Zero core changes needed – MetricsSink* is already threaded through every training loop in this codebase (XorNetwork::train_step, MnistConvNet::train_step). More...

#include <implot_metrics_sink.hpp>

Inheritance diagram for pulsatrix::ImPlotMetricsSink:
Collaboration diagram for pulsatrix::ImPlotMetricsSink:

Public Member Functions

void log_scalar (const std::string &tag, double value, int step) override
 Logs a scalar value (e.g. loss, accuracy).
 
void log_histogram (const std::string &tag, const Tensor &values, int step) override
 Logs a distribution of values (e.g. a weight tensor's values).
 
const std::unordered_map< std::string, ScalarSeries > & scalar_series () const
 Every scalar tag's full logged series so far.
 
const std::unordered_map< std::string, std::vector< float > > & latest_histograms () const
 Every histogram tag's most recently logged snapshot (not a running history – only the latest values per tag are kept).
 
void Draw () const
 Renders one line chart per scalar tag (small multiples) plus the latest histogram snapshot per tag. Not unit-tested – see the class-level note.
 
- Public Member Functions inherited from pulsatrix::MetricsSink
virtual ~MetricsSink ()=default
 

Detailed Description

A concrete MetricsSink (metrics_sink.hpp's own doc comment names this the expected extension point: "Concrete writers... implement this") that buffers every logged scalar into a per-tag time series, and keeps the latest histogram snapshot per tag, for live rendering by a training dashboard. Zero core changes needed – MetricsSink* is already threaded through every training loop in this codebase (XorNetwork::train_step, MnistConvNet::train_step).

Note
This header has no ImGui/ImPlot include – log_scalar()/log_histogram() and the accessors below are implemented in src/implot_metrics_sink.cpp (unconditional, part of pulsatrix_core) and are unit-tested directly. Only Draw() (implemented in src/viz/implot_metrics_sink_draw.cpp, part of the gated pulsatrix_viz target) calls into ImPlot, and is deliberately not unit-tested – see plans/okay-we-have-now-buzzing-moth.md Testing Strategy.

Member Function Documentation

◆ Draw()

void pulsatrix::ImPlotMetricsSink::Draw ( ) const

Renders one line chart per scalar tag (small multiples) plus the latest histogram snapshot per tag. Not unit-tested – see the class-level note.

◆ latest_histograms()

const std::unordered_map< std::string, std::vector< float > > & pulsatrix::ImPlotMetricsSink::latest_histograms ( ) const
inline

Every histogram tag's most recently logged snapshot (not a running history – only the latest values per tag are kept).

◆ log_histogram()

void pulsatrix::ImPlotMetricsSink::log_histogram ( const std::string &  tag,
const Tensor &  values,
int  step 
)
overridevirtual

Logs a distribution of values (e.g. a weight tensor's values).

Parameters
tagMetric name.
valuesValues to log.
stepTraining step this snapshot corresponds to.

Implements pulsatrix::MetricsSink.

◆ log_scalar()

void pulsatrix::ImPlotMetricsSink::log_scalar ( const std::string &  tag,
double  value,
int  step 
)
overridevirtual

Logs a scalar value (e.g. loss, accuracy).

Parameters
tagMetric name.
valueMetric value.
stepTraining step this value corresponds to.

Implements pulsatrix::MetricsSink.

◆ scalar_series()

const std::unordered_map< std::string, ScalarSeries > & pulsatrix::ImPlotMetricsSink::scalar_series ( ) const
inline

Every scalar tag's full logged series so far.


The documentation for this class was generated from the following file: