egttools.numerical.estimators¶
Python wrapper classes for egttools MC estimators.
These wrappers add three things the underlying C++ classes do not provide:
Rich result objects — every method returns a typed dataclass (FixationResult, StrategyDistributionResult, …) that carries the point estimate, standard error, 95 % CI, and prints a readable summary.
Optional progress bar — pass
verbose=1to any estimation method and atqdmprogress bar is shown over the internal chunks.tqdmis an optional dependency; if it is absent the call runs silently.Optional checkpointing — pass
checkpoint_path=<file>to any estimation method and progress is persisted to disk after every chunk (atomically, so a kill mid-write can’t corrupt it). If the samecheckpoint_pathis passed again with identical parameters, the call resumes from the last completed chunk instead of starting over — useful for long runs on clusters with job time limits. Resuming is statistically independent (never repeats a chunk’s random draws) and, ifegttools.Randomstate capture succeeds, bit-exact — seeegttools.Random.get_state/set_state. Passing acheckpoint_pathwith parameters that don’t match an existing checkpoint raises rather than silently resuming incorrectly. The checkpoint file is removed once the call completes normally, so a later call with the same path starts fresh again.
The wrappers use chunked execution: nb_runs is split into n_chunks
equal pieces, each piece runs as a single C++ call, and the SE is computed as
std(chunk_means) / sqrt(n_chunks). This gives SE estimates for methods
that otherwise return only a point estimate (e.g.
PairwiseComparisonNumerical.estimate_fixation_probability), and doubles
as the natural checkpoint boundary described above.
All other attributes and methods of the underlying C++ object are accessible
directly via __getattr__, so these wrappers are drop-in replacements.
Classes
Average gradient of selection G^A(x) from a network MC estimator. |
|
Per-strategy fixation (absorption) probabilities. |
|
Mean absorption (fixation) time from a given initial state. |
|
Fixation probability of an invading strategy into a resident population. |
|
Wraps any |
|
Wraps |
|
Estimated stationary distribution over population states. |
|
Time-averaged strategy frequencies with uncertainty. |