Monty.Frameworks.Models.EvidenceMatching.HypothesesUpdater behaviour (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

How a learning module decides which hypotheses to keep and how they earn.

Mirrors tbp/monty/frameworks/models/evidence_matching/hypotheses_updater.py, a module holding a protocol and its default implementation. The Elixir split has the same shape:

A learning module holds an updater as {module, state} and dispatches through that module, so which strategy a run uses is a construction choice and neither implementation knows about the other.

Monty's protocol also carries evidence_threshold_config, which no implementation reads — the learning module computes the threshold each step and passes it in instead. new/2 is not a callback either: each updater has its own options, and the learning module builds whichever one it was told to.

Summary

Callbacks

Mark the start of a step, before any graph's evidence is updated.

Move every hypothesis of one graph by displacement.

Mark the end of a step, once every graph has been updated.

Forget what the previous episode taught, keeping the configuration.

Bring one graph's hypothesis space up to date with this observation.

Types

features()

@type features() :: %{optional(String.t()) => map()}

state()

@type state() :: term()

telemetry()

@type telemetry() :: map()

Callbacks

begin_step(state)

@callback begin_step(state()) :: state()

Mark the start of a step, before any graph's evidence is updated.

This is where an updater that samples when evidence stalls decides whether this is a sampling step. It runs once per step rather than once per graph, because the decision depends on the whole hypothesis space.

displace_hypotheses(state, t, arg3)

Move every hypothesis of one graph by displacement.

nil means the agent has not moved since the buffer was reset, so nothing moves.

end_step(state)

@callback end_step(state()) :: state()

Mark the end of a step, once every graph has been updated.

reset(state)

@callback reset(state()) :: state()

Forget what the previous episode taught, keeping the configuration.

Hypotheses are thrown away at the end of every episode, but a burst in flight and the evidence slopes that triggered it belong to the episode too.

update_evidence(state, t, features, t, float)

Bring one graph's hypothesis space up to date with this observation.

Returns the updater, the new hypothesis space — or nil when the observation carries no channel this graph stores, in which case the caller keeps what it had — and whatever telemetry the strategy wants logged for this step.