netket.stats.LocalEstimators#
- class netket.stats.LocalEstimators[source]#
Bases:
PytreePer-sample scalar estimators returned by
local_estimators().datahas shape(n_chains, chain_len), one scalar local estimator value per sample.The typical workflow is:
le = vstate.local_estimators(op) # LocalEstimators, data: (n_chains, chain_len) stats = le.to_stats() # one-shot Stats acc = le.accumulate() # start an OnlineStats accumulator
For online estimation across multiple sampling steps:
acc = None for _ in range(n_steps): vstate.sample(n_discard_per_chain=0) le = vstate.local_estimators(op) acc = le.accumulate(acc) # updates or creates the accumulator print(acc.get_stats())
- Inheritance

- Attributes
- data: Array#
Scalar local estimators with shape
(n_chains, chain_len).
- Methods
- accumulate(old=None, *, max_lag=64)[source]#
Fold this batch into an online accumulator.
- Parameters:
old – existing
OnlineStatsreturned by a previous call, orNoneto start a fresh accumulator.max_lag (
int) – maximum ACF lag (only used when creating a fresh accumulator on the first call).
- Returns:
Updated
OnlineStats.
- replace(**kwargs)[source]#
Replace the values of the fields of the object with the values of the keyword arguments. If the object is a dataclass, dataclasses.replace will be used. Otherwise, a new object will be created with the same type as the original object.
- to_online_stats(*, max_lag=64)[source]#
Create an
OnlineStatsinitialised with this batch.Subsequent batches are folded in via
acc = acc.update(new_le.data). Preferaccumulate()when writing the accumulation loop, as it handles both first and subsequent batches uniformly.- Parameters:
max_lag (int)
- to_stats()[source]#
Compute summary statistics for this scalar local-estimator batch.
Equivalent to calling
statistics()onself.data.- Return type: