package kaun-board

  1. Overview
  2. Docs

Module Kaun_board.StoreSource

Incremental metric aggregation.

A store maintains per-tag latest values, full history, and best values as new Events arrive. This avoids rescanning all historical events on each dashboard refresh.

Types

Sourcetype metric = {
  1. step : int;
    (*

    Training step.

    *)
  2. epoch : int option;
    (*

    Training epoch, if any.

    *)
  3. value : float;
    (*

    Metric value.

    *)
}

The type for the latest observation of a metric.

Sourcetype best_value = {
  1. step : int;
    (*

    Step at which the best value was observed.

    *)
  2. value : float;
    (*

    The best value.

    *)
}

The type for the best observed value of a metric.

Sourcetype t

The type for metric stores.

Constructors

Sourceval create : ?initial_size:int -> unit -> t

create () is an empty store.

initial_size is a hint for the number of distinct tags expected. Defaults to 32.

Updating

Sourceval update : t -> Event.t list -> unit

update store evs incorporates evs into store.

Sourceval clear : t -> unit

clear store drops all stored metrics and resets the epoch counter.

Querying

Sourceval latest_epoch : t -> int option

latest_epoch store is the maximum epoch observed so far, if any.

Sourceval latest_metrics : t -> (string * metric) list

latest_metrics store is the latest metric per tag, sorted by tag name.

Sourceval history_for_tag : t -> string -> (int * float) list

history_for_tag store tag is the (step, value) history for tag in chronological order, or the empty list if tag has not been observed.

Sourceval best_for_tag : t -> string -> best_value option

best_for_tag store tag is the best value for tag, if any.

Note. "Best" is minimum for tags containing "loss" or "error", maximum otherwise.

Sourceval best_metrics : t -> (string * best_value) list

best_metrics store is the best value per tag, sorted by tag name. Uses the same heuristic as best_for_tag.