package kaun-board

  1. Overview
  2. Docs

Module Kaun_board.LogSource

Training logger.

A logger creates a Run directory and appends scalar Events as JSONL. All write operations are thread-safe.

  let logger = Log.create ~experiment:"mnist" () in
  (* in training loop *)
  Log.scalars logger ~step ~epoch [ ("train/loss", loss) ];
  Log.close logger

Types

Sourcetype t

The type for logging sessions.

Constructors

Sourceval create : ?base_dir:string -> ?experiment:string -> ?tags:string list -> ?config:(string * Jsont.json) list -> unit -> t

create () is a new logging session backed by a fresh run directory.

base_dir defaults to the value of RAVEN_RUNS_DIR, or XDG_CACHE_HOME/raven/runs when unset. experiment names the experiment and is appended to the run ID. tags defaults to []. config defaults to [] and is stored in the run manifest.

Raises Sys_error if the run directory cannot be created.

Logging

Sourceval scalars : t -> step:int -> ?epoch:int -> (string * float) list -> unit

scalars t ~step pairs appends one scalar event per (tag, value) pair.

epoch defaults to None. For a single metric use a one-element list, e.g. ("train/loss", loss) .

Accessors

Sourceval run_id : t -> string

run_id t is the unique run identifier.

Sourceval run_dir : t -> string

run_dir t is the path to the run directory.

Lifecycle

Sourceval close : t -> unit

close t marks the session as closed. Subsequent writes are silently ignored. Safe to call multiple times.