qiskit-documentation/docs/api/qiskit/0.26/qiskit.algorithms.MaximumLi...

167 lines
10 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: MaximumLikelihoodAmplitudeEstimation (v0.26)
description: API reference for qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation in qiskit v0.26
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation
---
<span id="qiskit-algorithms-maximumlikelihoodamplitudeestimation" />
# qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation
<Class id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/algorithms/amplitude_estimators/mlae.py" signature="MaximumLikelihoodAmplitudeEstimation(evaluation_schedule, minimizer=None, quantum_instance=None)" modifiers="class">
The Maximum Likelihood Amplitude Estimation algorithm.
This class implements the quantum amplitude estimation (QAE) algorithm without phase estimation, as introduced in \[1]. In comparison to the original QAE algorithm \[2], this implementation relies solely on different powers of the Grover operator and does not require additional evaluation qubits. Finally, the estimate is determined via a maximum likelihood estimation, which is why this class in named `MaximumLikelihoodAmplitudeEstimation`.
**References**
**\[1]: Suzuki, Y., Uno, S., Raymond, R., Tanaka, T., Onodera, T., & Yamamoto, N. (2019).**
Amplitude Estimation without Phase Estimation. [arXiv:1904.10246](https://arxiv.org/abs/1904.10246).
**\[2]: Brassard, G., Hoyer, P., Mosca, M., & Tapp, A. (2000).**
Quantum Amplitude Amplification and Estimation. [arXiv:quant-ph/0005055](http://arxiv.org/abs/quant-ph/0005055).
**Parameters**
* **evaluation\_schedule** (`Union`\[`List`\[`int`], `int`]) If a list, the powers applied to the Grover operator. The list element must be non-negative. If a non-negative integer, an exponential schedule is used where the highest power is 2 to the integer minus 1: \[id, Q^2^0, …, Q^2^(evaluation\_schedule-1)].
* **minimizer** (`Optional`\[`Callable`\[\[`Callable`\[\[`float`], `float`], `List`\[`Tuple`\[`float`, `float`]]], `float`]]) A minimizer used to find the minimum of the likelihood function. Defaults to a brute search where the number of evaluation points is determined according to `evaluation_schedule`. The minimizer takes a function as first argument and a list of (float, float) tuples (as bounds) as second argument and returns a single float which is the found minimum.
* **quantum\_instance** (`Union`\[`Backend`, `BaseBackend`, `QuantumInstance`, `None`]) Quantum Instance or Backend
**Raises**
**ValueError** If the number of oracle circuits is smaller than 1.
### \_\_init\_\_
<Function id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.__init__" signature="__init__(evaluation_schedule, minimizer=None, quantum_instance=None)">
**Parameters**
* **evaluation\_schedule** (`Union`\[`List`\[`int`], `int`]) If a list, the powers applied to the Grover operator. The list element must be non-negative. If a non-negative integer, an exponential schedule is used where the highest power is 2 to the integer minus 1: \[id, Q^2^0, …, Q^2^(evaluation\_schedule-1)].
* **minimizer** (`Optional`\[`Callable`\[\[`Callable`\[\[`float`], `float`], `List`\[`Tuple`\[`float`, `float`]]], `float`]]) A minimizer used to find the minimum of the likelihood function. Defaults to a brute search where the number of evaluation points is determined according to `evaluation_schedule`. The minimizer takes a function as first argument and a list of (float, float) tuples (as bounds) as second argument and returns a single float which is the found minimum.
* **quantum\_instance** (`Union`\[`Backend`, `BaseBackend`, `QuantumInstance`, `None`]) Quantum Instance or Backend
**Raises**
**ValueError** If the number of oracle circuits is smaller than 1.
</Function>
## Methods
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ |
| [`__init__`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.__init__ "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.__init__")(evaluation\_schedule\[, minimizer, …]) | **type evaluation\_schedule**`Union`\[`List`\[`int`], `int`] |
| [`compute_confidence_interval`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_confidence_interval "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_confidence_interval")(result, alpha\[, …]) | Compute the alpha confidence interval using the method kind. |
| [`compute_mle`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_mle "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_mle")(circuit\_results, estimation\_problem) | Compute the MLE via a grid-search. |
| [`construct_circuits`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.construct_circuits "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.construct_circuits")(estimation\_problem\[, …]) | Construct the Amplitude Estimation w/o QPE quantum circuits. |
| [`estimate`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.estimate "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.estimate")(estimation\_problem) | Run the amplitude estimation algorithm. |
## Attributes
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
| [`quantum_instance`](#qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.quantum_instance "qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.quantum_instance") | Get the quantum instance. |
### compute\_confidence\_interval
<Function id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_confidence_interval" signature="compute_confidence_interval(result, alpha, kind='fisher', apply_post_processing=False)" modifiers="static">
Compute the alpha confidence interval using the method kind.
The confidence level is (1 - alpha) and supported kinds are fisher, likelihood\_ratio and observed\_fisher with shorthand notations fi, lr and oi, respectively.
**Parameters**
* **result** (`MaximumLikelihoodAmplitudeEstimationResult`) A maximum likelihood amplitude estimation result.
* **alpha** (`float`) The confidence level.
* **kind** (`str`) The method to compute the confidence interval. Defaults to fisher, which computes the theoretical Fisher information.
* **apply\_post\_processing** (`bool`) If True, apply post-processing to the confidence interval.
**Return type**
`Tuple`\[`float`, `float`]
**Returns**
The specified confidence interval.
**Raises**
* [**AlgorithmError**](qiskit.algorithms.AlgorithmError "qiskit.algorithms.AlgorithmError") If run() hasnt been called yet.
* **NotImplementedError** If the method kind is not supported.
</Function>
### compute\_mle
<Function id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.compute_mle" signature="compute_mle(circuit_results, estimation_problem, num_state_qubits=None, return_counts=False)">
Compute the MLE via a grid-search.
This is a stable approach if sufficient gridpoints are used.
**Parameters**
* **circuit\_results** (`Union`\[`List`\[`Dict`\[`str`, `int`]], `List`\[`ndarray`]]) A list of circuit outcomes. Can be counts or statevectors.
* **estimation\_problem** (`EstimationProblem`) The estimation problem containing the evaluation schedule and the number of likelihood function evaluations used to find the minimum.
* **num\_state\_qubits** (`Optional`\[`int`]) The number of state qubits, required for statevector simulations.
* **return\_counts** (`bool`) If True, returns the good counts.
**Return type**
`Union`\[`float`, `Tuple`\[`float`, `List`\[`float`]]]
**Returns**
The MLE for the provided result object.
</Function>
### construct\_circuits
<Function id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.construct_circuits" signature="construct_circuits(estimation_problem, measurement=False)">
Construct the Amplitude Estimation w/o QPE quantum circuits.
**Parameters**
* **estimation\_problem** (`EstimationProblem`) The estimation problem for which to construct the QAE circuit.
* **measurement** (`bool`) Boolean flag to indicate if measurement should be included in the circuits.
**Return type**
`List`\[`QuantumCircuit`]
**Returns**
A list with the QuantumCircuit objects for the algorithm.
</Function>
### estimate
<Function id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.estimate" signature="estimate(estimation_problem)">
Run the amplitude estimation algorithm.
**Parameters**
**estimation\_problem** (`EstimationProblem`) An `EstimationProblem` containing all problem-relevant information such as the state preparation and the objective qubits.
**Return type**
`MaximumLikelihoodAmplitudeEstimationResult`
</Function>
### quantum\_instance
<Attribute id="qiskit.algorithms.MaximumLikelihoodAmplitudeEstimation.quantum_instance">
Get the quantum instance.
**Return type**
`Optional`\[`QuantumInstance`]
**Returns**
The quantum instance used to run this algorithm.
</Attribute>
</Class>