stochastic_algo

Retain strata probabilistically in a nondeterministic manner.

It would be a poor choice to use in practice because mismatches between the particular ranks that each column happens to have strata for will degrade the effectiveness of comparisons between columns. Rather, it is included in the library as an edge case for testing purposes. Worst-case MRCA rank estimate uncertainty scales as O(n) with respect to the greater number of strata deposited on either column being compared.

Under the stochastic resolution policy, the worst and average case number of strata retained (i.e., space complexity) scales as O(n) with respect to the number of strata deposited.

This policy implementation that the most ancient and most recent strata will always be retained. For the secondmost recently deposited sratum, a pseudorandom coin flip is performed. Depending on the outcome of that coin flip, the stratum is either immediately purged or retained permanently.

Forwarded Modules

Modules defined elsewhere made available in this namespace for convenience. To view documentation for these modules, use the search bar or navigate to the source package manually.

CalcMrcaUncertaintyAbsExact

CalcMrcaUncertaintyRelExact

CalcNumStrataRetainedExact

CalcRankAtColumnIndex

IterRetainedRanks

Classes

CalcMrcaUncertaintyAbsUpperBound

CalcMrcaUncertaintyAbsUpperBoundAtPessimalRank

CalcMrcaUncertaintyAbsUpperBoundPessimalRank

Functor to provide member function implementation in Policy class.

CalcMrcaUncertaintyRelUpperBound

CalcMrcaUncertaintyRelUpperBoundAtPessimalRank

CalcMrcaUncertaintyRelUpperBoundPessimalRank

Functor to provide member function implementation in Policy class.

CalcNumStrataRetainedUpperBound

GenDropRanks

Functor to implement the fixed resolution stratum retention policy, for use with HereditaryStratigraphicColumn.

Policy

Instantiate policy implementation for particular policy specification parameters.

PolicySpec

Contains all policy parameters, if any.

class CalcMrcaUncertaintyAbsUpperBound
class CalcMrcaUncertaintyAbsUpperBoundAtPessimalRank
class CalcMrcaUncertaintyAbsUpperBoundPessimalRank

Functor to provide member function implementation in Policy class.

__call__(policy: PolicyCouplerBase, first_num_strata_deposited: int | None, second_num_strata_deposited: int | None) int[source]

Calculate rank for which upper bound on absolute MRCA uncertainty is pessimized.

__init__(policy_spec: PolicySpec | None) None[source]
class CalcMrcaUncertaintyRelUpperBound
class CalcMrcaUncertaintyRelUpperBoundAtPessimalRank
class CalcMrcaUncertaintyRelUpperBoundPessimalRank

Functor to provide member function implementation in Policy class.

__call__(policy: PolicyCouplerBase, first_num_strata_deposited: int, second_num_strata_deposited: int) int[source]

Calculate rank for which upper bound on relative MRCA uncertainty is pessimized.

__init__(policy_spec: PolicySpec | None) None[source]
class CalcNumStrataRetainedUpperBound
class GenDropRanks

Functor to implement the fixed resolution stratum retention policy, for use with HereditaryStratigraphicColumn.

This functor enacts the fixed resolution policy by specifying the set of strata ranks that should be purged from a hereditary stratigraphic column when the nth stratum is deposited.

__call__(policy: PolicyCouplerBase, num_stratum_depositions_completed: int, retained_ranks: Iterable[int] | None) Iterator[int][source]

Decide which strata within the stratagraphic column should be purged.

Every time a new stratum is deposited, this method is called to determine which strata should be purged. All strata at ranks yielded from this functor are immediately purged from the column, meaning that for a stratum to persist it must not be yielded by this functor each and every time a new stratum is deposited.

Parameters

policy: Policy

Policy this functor enacts.

num_stratum_depositions_completedint

The number of strata that have already been deposited, not including the latest stratum being deposited which prompted the current purge operation.

retained_ranksiterator over int

An iterator over ranks of strata currently retained within the hereditary stratigraphic column. Not used in this functor.

Returns

iterator over int

The ranks of strata that should be purged from the hereditary

stratigraphic column at this deposition step.

See Also

fixed_resolution_algo:

For details on the rationale, implementation, and guarantees of the fixed resolution stratum retention policy.

__init__(policy_spec: PolicySpec | None) None[source]
class Policy

Instantiate policy implementation for particular policy specification parameters.

GetEvalCtor() str
GetSpec() PolicySpec

Get policy’s parameter specification.

WithoutCalcRankAtColumnIndex() PolicyCoupler

Make a copy of this policy instance with CalcRankAtColumnIndex disabled.

Useful to prevent optimization-out of strata rank number storage in a stratum ordered store backing a hereditary stratigraphic column.

__init__(*args, parameterizer: Callable[[Type], PolicySpecBase | None] | None = None, policy_spec: PolicySpecBase | None = None, **kwargs)

Construct a PolicyCoupler instance.

If policy_spec is not provided, all arguments are forwarded to policy spec initializer.

__repr__() str

Return repr(self).

__str__() str

Return str(self).

policy_spec_t

alias of PolicySpec

CalcMrcaUncertaintyAbsUpperBound: Callable
CalcMrcaUncertaintyAbsUpperBoundPessimalRank: Callable
CalcMrcaUncertaintyAbsUpperBoundAtPessimalRank: Callable
CalcMrcaUncertaintyRelUpperBound: Callable
CalcMrcaUncertaintyRelUpperBoundAtPessimalRank: Callable
CalcMrcaUncertaintyRelUpperBoundPessimalRank: Callable
CalcNumStrataRetainedUpperBound: Callable
CalcMrcaUncertaintyAbsExact: Callable | None
CalcMrcaUncertaintyRelExact: Callable | None
CalcNumStrataRetainedExact: Callable | None
CalcRankAtColumnIndex: Callable | None
IterRetainedRanks: Callable | None
GenDropRanks: Callable
class PolicySpec

Contains all policy parameters, if any.

static GetAlgoIdentifier() str[source]

Get programatic name for underlying retention algorithm.

static GetAlgoTitle() str[source]

Get human-readable name for underlying retention algorithm.

GetEvalCtor() str[source]
GetRetentionProbability() int[source]
__init__(*, retention_probability: float = 0.5) None[source]

Construct the policy spec.

Parameters

retention_probabilityfloat

The proability with which strata are retained permanently.

__repr__() str[source]

Return repr(self).

__str__() str[source]

Return str(self).