CVaRMeasurement¶

class
CVaRMeasurement
(primitive=None, alpha=1.0, coeff=1.0)[source]¶ Bases:
qiskit.aqua.operators.state_fns.operator_state_fn.OperatorStateFn
 A specialized measurement class to compute CVaR expectation values.
See https://arxiv.org/pdf/1907.04769.pdf for further details.
Used in
CVaRExpectation
, see there for more details. Parameters
primitive (
Optional
[OperatorBase
])  TheOperatorBase
which defines the diagonal operator measurement.coeff (
Union
[int
,float
,complex
,ParameterExpression
])  A coefficient by which to multiply the state functionalpha (
float
)  A realvalued parameter between 0 and 1 which specifies the fraction of observed samples to include when computing the objective value. alpha = 1 corresponds to a standard observable expectation value. alpha = 0 corresponds to only using the single sample with the lowest energy. alpha = 0.5 corresponds to ranking each observation by lowest energy and using the best
 Raises
ValueError  TODO remove that this raises an error
ValueError  If alpha is not in [0, 1].
AquaError  If the primitive is not diagonal.
Methods
Return Operator addition of self and other, overloaded by
+
.The adjoint of a CVaRMeasurement is not defined.
Binds scalar values to any Terra
Parameters
in the coefficients or primitives of the Operator, or substitutes oneParameter
for another.Same as assign_parameters, but maintained for consistency with QuantumCircuit in Terra (which has both assign_parameters and bind_parameters).
Composition (Linear algebrastyle: A@B(x) = A(B(x))) is not well defined for states in the binary function model, but is well defined for measurements.
Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the CVaR.
Evaluate Equality between Operators, overloaded by
==
.Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the CVaR as H_j + 1/α*(sum_i<j p_i*(H_i  H_j)).
Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the variance of the CVaR estimator as H_j^2 + 1/α * (sum_i<j p_i*(H_i^2  H_j^2)).
In order to compute the CVaR of an observable expectation, we require the energies of each sampled measurement outcome as well as the sampling probability of each measurement outcome.
Returns the scalar multiplication of the Operator, overloaded by
*
, including support for Terra'sParameters
, which can be bound to values later (viabind_parameters
).Return the Operator's negation, effectively just multiplying by 1.0, overloaded by

.Permute the qubits of the state function.
Compose with Self Multiple Times, undefined for StateFns.
Return a set of strings describing the primitives contained in the Operator.
Try collapsing the Operator structure, usually after some type of conversion, e.g.
Sample the state function as a normalized probability distribution.
Return tensor product between self and other, overloaded by
^
.Return tensor product with self multiple times, overloaded by
^
.Not defined.
Not defined.
Attempt to return the Legacy Operator representation of the Operator.
Not defined.
Not defined.
Apply the convert_fn to the internal primitive if the primitive is an Operator (as in the case of
OperatorStateFn
).Attributes

ENABLE_DEPRECATION
= True¶

INDENTATION
= ' '¶

alpha
¶  A realvalued parameter between 0 and 1 which specifies the
fraction of observed samples to include when computing the objective value. alpha = 1 corresponds to a standard observable expectation value. alpha = 0 corresponds to only using the single sample with the lowest energy. alpha = 0.5 corresponds to ranking each observation by lowest energy and using the best half.
 Return type
float
 Returns
The parameter alpha which was given at initialization

coeff
¶ A coefficient by which the state function is multiplied.
 Return type
Union
[int
,float
,complex
,ParameterExpression
]

is_measurement
¶ Whether the StateFn object is a measurement Operator.
 Return type
bool

num_qubits
¶  Return type
int

parameters
¶

primitive
¶ The primitive which defines the behavior of the underlying State function.