pyphi.models.explanation.runner_up_from_candidates#

pyphi.models.explanation.runner_up_from_candidates(candidates, mip_value, key=None, normalized=False)[source]#

The candidate ranked next after the MIP under key.

key maps a candidate to the quantity minimized at MIP selection (raw φ by default; pass the result of sia_runner_up_key() to match a configured tie-resolution strategy). mip_value is the MIP’s own key value. Candidates that tie the MIP (within pyphi.numerics.eq()) are tied peers, not runners-up, so they are excluded. Returns None when no candidate exceeds the MIP. Candidates tied for next-best are ordered by partition.lex_key() so the choice does not depend on iteration order. Each candidate must expose .partition and whatever key reads (.phi by default). The returned record’s gap is the runner-up’s key value minus mip_value.

Parameters:
Return type:

RunnerUp | None