Dsxir. Optimizer. MIPROv2. Candidates
(dsxir v0.4.0)
Copy Markdown
Builds the categorical search space for MIPROv2 and the lookup table that
maps {predictor_name, dim, index} back to the actual instruction string or
demo bundle.
Each predictor contributes two categorical dimensions:
{name, :instruction}ranging over indices0..N, where index 0 is the current instruction (possiblynil) and indices1..Nare proposed instruction strings.{name, :demos}ranging over indices0..M, where index 0 is an empty demo bundle ([]) and indices1..Mare candidate demo bundles.
Summary
Types
@type lookup() :: %{ required({atom(), :instruction}) => %{ required(non_neg_integer()) => String.t() | nil }, required({atom(), :demos}) => %{ required(non_neg_integer()) => [Dsxir.Demo.t()] } }
@type t() :: %Dsxir.Optimizer.MIPROv2.Candidates{ lookup: lookup(), space: Dsxir.Optimizer.Search.Sampler.space() }
Functions
@spec build( current_instructions :: %{required(atom()) => String.t() | nil}, proposed_instructions :: %{required(atom()) => [String.t()]}, demo_bundles :: %{required(atom()) => [[Dsxir.Demo.t()]]} ) :: t()
Build the space and lookup from per-predictor proposed instruction lists and demo bundle lists.
current_instructions — %{predictor_name => current_instruction | nil}.
proposed_instructions — %{predictor_name => [proposed_instruction]}.
demo_bundles — %{predictor_name => [bundle]} where each bundle is a
list of Dsxir.Demo.t().
The current instruction (nil if not set) is prepended at index 0 of each
predictor's instruction list; an empty demo bundle ([]) is prepended at
index 0 of each predictor's demo list.
@spec resolve(t(), Dsxir.Optimizer.Search.Sampler.config()) :: %{ required(atom()) => %{instruction: String.t() | nil, demos: [Dsxir.Demo.t()]} }
Resolve a sampled config into a map of
predictor_name => %{instruction: string | nil, demos: [demo]} using the
lookup table built by build/3.