Documentation
¶
Overview ¶
Package margaid implements automatic plotting of all metrics registered in a trainer, using the Margaid library (https://github.com/erkkah/margaid/) to draw SVG, and GoNB (https://github.com/janpfeifer/gonb/) to display it in a Jupyter Notebook.
Example usage:
```go
```
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plot ¶
type Plot struct {
MetricType string
// Flat maps a plot name to
PerName map[string]*mg.Series
// contains filtered or unexported fields
}
Plot holds the series to different metrics that share the same Y axis. They are organized per name of the metric.
func (*Plot) AddPoint ¶
AddPoint adds a point for the given metric. The x-axis is given by step and the y-axis is given by value.
func (*Plot) PlotToHTML ¶
PlotToHTML all series for a metric type associated with Plot, returning the HTML code for it (which includes the SVG).
type Plots ¶
type Plots struct {
// Image dimensions.
Width, Height int
// EvalDatasets will be evaluated with `train.Trainer.Eval()` and its metrics collected.
EvalDatasets []train.Dataset
// Plot per metric name.
PerMetricType map[string]*Plot
// contains filtered or unexported fields
}
Plots holds many plots for different metrics. They are organized per "metric type", where metric type is a unit/quantity unique name. It's assumed that series of the same "metric type" can share the same Y-Axis and hence the same plot.
func New ¶
New creates new Margaid plots structure.
It starts empty and can have the points added manually with Plots.AddPoint or automatically with Plots.Attach.
Use Plots.Plot() to actually generate the
func (*Plots) AddPoint ¶
AddPoint adds a point for the given metric. The x-axis is given by step and the y-axis is given by value.
func (*Plots) Attach ¶
Attach plots to the given loop, collecting metric values for plot. For each EvalDatasets given to `Plots.New()`, their metrics are evaluated and also plotted. It automatically calls Plots.Plot at the end of the loop (`loop.OnEnd()`).
func (*Plots) DynamicPlot ¶
func (ps *Plots) DynamicPlot()
DynamicPlot will plot on a transient area that gets overwritten each time there is a new data point.
func (*Plots) DynamicUpdates ¶
DynamicUpdates configure the Plots to dynamically generate the plot as new points are included. It starts displaying the plot as soon as there are at least 3 points. It returns itself, so calls can be cascaded.