pygsti.extras.drift.probtrajectory.ProbTrajectory#
- class ProbTrajectory(outcomes, hyperparameters, parameters)#
Bases:
objectEncapulates a time-dependent probability distribution, as a sum of time-dependent basis functions.
Initializes a ProbTrajectory object.
- Parameters:
outcomes (list) – What the probability distribution is over. Typically, all possible outcomes for the circuit that this is a probability trajectory for.
hyperparameters (list) – Each derived ProbTrajectory object is intended to encompass a family of parameterized models for a time-varying probability, and this specifies the specific parameterized model in the class. For example, the CosineProbTrajectory object is a derived class whereby each probability is the summation of some number of cosines, and this specifies the number and frequencies of those cosines. The probability trajectory for each outcome is parameterized by a value for each hyperparameter.
parameters – A dictonary where the keys are all but the last element of outcomes, and the elements are lists of the same lengths as hyperparameters. These are the parameters of the parameterized model defined by (the derived class) and hyperparameters. The parameter values for the final outcome are assumed to be entirely fixed by the necessity for the probability trajectories to sum to 1 at all times.
- Return type:
A new ProbTrajectory object.
Methods
__init__(outcomes, hyperparameters, parameters)Initializes a ProbTrajectory object.
basisfunction(i, times)The ith basis function of the model, evaluated at the times in times.
copy()Returns the parameters as a list, in the same format as when input to set_parameters_from_list.
Returns the values of the parameters, in the dictionary form in which it is internally stored.
probabilities(times[, trim])Returns the probability distribution for each time in times.
set_hyperparameters(hyperparameters, parameters)Sets the hyperparameters -- i.e., defines a new parameterized model -- and the parameters (see init for details).
set_parameters(parameters)Sets the parameters of the model (see init for details).
set_parameters_from_list(parameterslist)Sets the parameters of the model from a list
- basisfunction(i, times)#
The ith basis function of the model, evaluated at the times in times.
Defined in a derived class
- Parameters:
i (Type specified by derived class.) – The basis function specified by the hyperparameter i. This method should expect all possible hyperparameter values (often ints in some range, or a float) as this input
times (list) – The times to evaluate the basis function at.
- Returns:
The values of the basis function at the specified times.
- Return type:
list
- parameters_as_list()#
Returns the parameters as a list, in the same format as when input to set_parameters_from_list. See the docstring of that method for more info.
- parameters_copy()#
Returns the values of the parameters, in the dictionary form in which it is internally stored.
- probabilities(times, trim=True)#
Returns the probability distribution for each time in times.
- Parameters:
times (list) – A list of times, to return the probability distributions for.
time (bool, optional) – Whether or not to set probability > 1 to 1 and probabilities < 0 to 0. If set to True then there is no guarantee that the probabilities will sum to 1 at all times anymore.
- Returns:
A dictionary where the keys are the possible outcomes, and the value for a key is a list (of the same lengths as times) containing the probability for that outcome at the times in times.
- Return type:
dict
- set_hyperparameters(hyperparameters, parameters)#
Sets the hyperparameters – i.e., defines a new parameterized model – and the parameters (see init for details).
- set_parameters(parameters)#
Sets the parameters of the model (see init for details).
- set_parameters_from_list(parameterslist)#
Sets the parameters of the model from a list
- Parameters:
parametersaslist (list) – The new parameter values as a list, where the first len(self.hyperparameters) values are the parameter values for the first outcome (the first element of self.outcomes), the second set of len(self.hyperparameters) values are for the second outcome in this list, and so on, up to the second last value of self.outcomes.
- Return type:
None