netket.stats.online_statistics#
- netket.stats.online_statistics(data, old_estimator=None, *, decay=None, max_lag=64)[source]#
Accumulate streaming MCMC statistics across batches.
This is the functional API for
OnlineStats. Each call merges a new batch of data into the running estimator using the parallel Welford algorithm.- Parameters:
data (
Union[LocalEstimatorsBatch,LocalEstimators,Array,ndarray,bool,number,bool,int,float,complex]) – Array of shape(n_samples,)or(n_chains, n_samples_per_chain), or aLocalEstimators/LocalEstimatorsBatchwrapper.old_estimator (
OnlineStats|OnlineStatsBatch|None) – Previous accumulator instance, orNoneto start fresh.decay (
float|None) – EMA decay factor applied per call (default 1.0 = no decay). Whendecay < 1.0, old data is down-weighted exponentially andtau_corris set toNaN.max_lag (
int) – Maximum lag for the online ACF estimator (default 64). Set to 0 to disable ACF tracking.
- Return type:
- Returns:
Updated
OnlineStatsorOnlineStatsBatchinstance, depending on the input type.
Example:
estimator = None for batch in training_loop: estimator = nk.stats.online_statistics(batch, estimator) stats = estimator.get_stats()