pygsti.objectivefns.objectivefns.LogLWildcardFunction#
- class LogLWildcardFunction(logl_objective_fn, base_pt, wildcard)#
Bases:
ObjectiveFunctionA wildcard-budget bolt-on to an existing objective function.
Currently, this existing function must be a log-likelihood type function because the computational logic assumes this. The resulting object is an objective function over the space of wildcard budget parameter vectors (not model parameters).
- Parameters:
logl_objective_fn (PoissonPicDeltaLogLFunction) – The bare log-likelihood function.
base_pt (numpy.ndarray) – Unused. The model-parameter vector where this objective function is based.
wildcard (WildcardBudget) – The wildcard budget that adjusts the “bare” probabilities of logl_objective_fn before evaluating the rest of the objective function.
Methods
__init__(logl_objective_fn, base_pt, wildcard)chi2k_distributed_qty(objective_function_value)Convert a value of this objective function to one that is expected to be chi2_k distributed.
dlsvec(wvec)The derivative (jacobian) of the least-squares vector.
fn([wvec])Evaluate this objective function.
lsvec([wvec])Compute the least-squares vector of the objective function.
terms([wvec])Compute the terms of the objective function.
- chi2k_distributed_qty(objective_function_value)#
Convert a value of this objective function to one that is expected to be chi2_k distributed.
- Parameters:
objective_function_value (float) – A value of this objective function, i.e. one returned from self.fn(…).
- Return type:
float
- dlsvec(wvec)#
The derivative (jacobian) of the least-squares vector.
Derivatives are taken with respect to wildcard budget parameters.
- Parameters:
wvec (numpy.ndarray, optional) – The vector of (wildcard budget) parameters to evaluate the objective function at. If None, then the budget’s current parameter vector is used (held internally).
- Returns:
An array of shape (nElements,nParams) where nElements is the number of circuit outcomes and nParams is the number of wildcard budget parameters.
- Return type:
numpy.ndarray
- fn(wvec=None)#
Evaluate this objective function.
- Parameters:
wvec (numpy.ndarray, optional) – The vector of (wildcard budget) parameters to evaluate the objective function at. If None, then the budget’s current parameter vector is used (held internally).
- Return type:
float
- lsvec(wvec=None)#
Compute the least-squares vector of the objective function.
This is the square-root of the terms-vector returned from
terms(). This vector is the objective function value used by a least-squares optimizer when optimizing this objective function. Note that the existence of this quantity requires that the terms be non-negative. If this is not the case, an error is raised.- Parameters:
wvec (numpy.ndarray, optional) – The vector of (wildcard budget) parameters to evaluate the objective function at. If None, then the budget’s current parameter vector is used (held internally).
- Returns:
An array of shape (nElements,) where nElements is the number of circuit outcomes.
- Return type:
numpy.ndarray
- terms(wvec=None)#
Compute the terms of the objective function.
The “terms” are the per-circuit-outcome values that get summed together to result in the objective function value.
- Parameters:
wvec (numpy.ndarray, optional) – The vector of (wildcard budget) parameters to evaluate the objective function at. If None, then the budget’s current parameter vector is used (held internally).
- Returns:
An array of shape (nElements,) where nElements is the number of circuit outcomes.
- Return type:
numpy.ndarray