deltakit.decode.analysis.run_decoding_on_circuit#
- deltakit.decode.analysis.run_decoding_on_circuit(circuit: Circuit, max_shots: int, decoder: DecoderProtocol, max_batch_size: int = 10000, target_rse: float | None = None, min_fails: int = 10) dict[str, int]#
Compute LEP of the decoder with given circuit. The function samples shots in batches and feeds them to decoders’ decode_batch_to_logical_flip function and records a total number of shots and fails per logical.
Stopping criteria are the maximum number of shots or relative standard error on the estimate of LEP going below the given amount (if not None). The RSE stopping criteria is only taken into account if at least min_fails are reached.
- Parameters:
circuit (stim.Circuit) – Stim circuit to use for sampling shots.
max_shots (int) – Maximum number of shots to sample.
decoder (GraphDecoder) – Decoder to use for decoding.
max_batch_size (int, optional) – Maximal batch size, by default 10_000.
target_rse (Optional[float], optional) – Target Relative Standard Error (RSE) for early stopping, by default None.
min_fails (int, optional) – Minimum number of fails before starting to look at RSE, by default 10.
- Returns:
- Result dictionary with keys:
shots: The number of times to sample every detector in the circuit fails: The number of times the decoder failed to predict the actual observable
- Return type:
Dict[str, int]