squlearn.encoding_circuit
.automated_pruning
- squlearn.encoding_circuit.automated_pruning(encoding_circuit: EncodingCircuitBase, executor: Executor, n_sample: int = 1, pruning_thresh: float = 1e-10, x_lim: Tuple[float, float] | None = None, p_lim: Tuple[float, float] | None = None, x_val: Tuple[float, float] | None = None, p_val: Tuple[float, float] | None = None, verbose: int = 1, seed: int | None = None) PrunedEncodingCircuit
Function for automated pruning of the parameters in the inputted parameterized quantum circuit.
The algorithms for the automated pruning is based on https://doi.org/10.1103/PRXQuantum.2.040309.
- Parameters:
encoding_circuit (EncodingCircuitBase) – Parameterized quantum circuit that will be pruned. Has to be in the encoding_circuit format of quantum_fit!
executor (Executor) – Executor for evaluating the Quantum Fisher Information Matrix
n_sample (int) – Number of random parameter values and input data that is generated. (if
x_val=None
andp_val=None
, the number of evaluated Fisher matrices isn_sample*n_sample
)pruning_thresh (float) – Threshold for pruning, eigenvalues lower that value are considered to be redundant.
x_lim (Union[Tuple[float, float],None]) – Limits for the random input data values; default limits are \((-\pi,\pi)\).
p_lim (Union[Tuple[float, float],None]) – Limits for the random parameter values; default limits are \((-\pi,\pi)\).
x_val (Union[Tuple[float, float],None]) – Array with input data values. If specified, no random input data is generated.
p_val (Union[Tuple[float, float],None]) – Array with parameter values. If specified, no random parameter values are generated.
verbose (int) – Verbosity of the algorithm, as default only the redundant parameters are printed.
seed (int) – Seed for the random input data and parameters generation.
- Returns:
Pruned encoding_circuit as a PrunedEncodingCircuit class object.