qilisdk.noise.gaussian_perturbation

Classes

GaussianPerturbation

Gaussian-distributed parameter perturbation.

Module Contents

class GaussianPerturbation(*, mean: float = 0.0, std: float, seed: int = 42)[source]

Bases: qilisdk.noise.parameter_perturbation.ParameterPerturbation

Gaussian-distributed parameter perturbation.

Each call to perturb adds a random offset drawn from N(mean, std^2).

Parameters:
  • mean (float) – Mean of the Gaussian offset.

  • std (float) – Standard deviation of the Gaussian offset (must be >= 0).

  • seed (int) – Seed for the random number generator.

Raises:

ValueError – If std is negative.

property mean: float[source]

Return the mean of the Gaussian offset.

Returns:

The mean value.

property std: float[source]

Return the standard deviation of the Gaussian offset.

Returns:

The standard deviation value.

perturb(value: float) float[source]

Return a perturbed version of a parameter value.

Parameters:

value (float) – The original parameter value.

Returns:

The perturbed parameter value.