github ↗
docs menu

Module Norn.Stats

Statistics of Hamiltonian transitions.

Each field holds one element per chain, with the axes of the chains it describes: a sampler's state holds [chain], and its draws [chain; draw].

#type ('f, 'd) t = {
  1. #lp : (float, 'f, 'd) Nx.t;
    (*

    The log density at the transition's end.

    *)
  2. #acceptance : (float, 'f, 'd) Nx.t;
    (*

    The acceptance statistic warmup aims for, of min (1, exp (H0 - H)), H0 the Hamiltonian after the momentum draw: its mean over the trajectory for Norn.Nuts, its value at the trajectory's end, the Metropolis probability, for Norn.Hmc.

    *)
  3. #step_size : (float, 'f, 'd) Nx.t;
    (*

    The step size the transition took.

    *)
  4. #n_steps : 'd Nx.int32_t;
    (*

    The leapfrog steps it took.

    *)
  5. #diverging : 'd Nx.bool_t;
    (*

    Whether the energy error exceeded 1000 or a position was not finite.

    *)
  6. #saturated : 'd Nx.bool_t;
    (*

    Whether the trajectory reached its maximum length before it turned.

    *)
  7. #energy : (float, 'f, 'd) Nx.t;
    (*

    The Hamiltonian after the momentum draw, H0.

    *)
}

The type for statistics of transitions over element type 'f.

#val ptree : (float, 'f) Nx.dtype -> (('f, 'd) t, 'd) Nx.Ptree.t

ptree dtype is the structure of statistics at dtype, with tensors at lp, acceptance, step_size, n_steps, diverging, saturated and energy.