generatorsrandom

class pyvale.generatorsrandom.GenBeta(a: float, b: float, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy beta distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • a (float) -- Alpha parameter of the distribution which must be greater than zero

  • b (float) -- Beta parameter of the distribution which must be greater than zero

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenChiSquare(dofs: float, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy chi square random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • dofs (float) -- Number of degrees of freedom of the distribution must be greater than zero.

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenDirichlet(alpha: float, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy dirichlet random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • alpha (float) -- Alpha parameter of the distribution

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenExponential(scale: float = 1.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy exponential random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • scale (float, optional) -- Scale parameter of the distribution which must be positive, by default 1.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenF(dofs: float, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy F distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • dofs (float) -- Number of degrees of freedom of the distribution must be greater than zero

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenGamma(shape: float, scale: float = 1.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy gamma random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • shape (float) -- Shape parameter of the gamma distribution, must be greater than zero

  • scale (float, optional) -- Scale parameter of the gamma distribution which must be greater than zero, by default 1.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenLogNormal(std: float = 1.0, mean: float = 0.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy lognormal random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • std (float, optional) -- Standard deviation of the normal distribution to sample, by default 1.0

  • mean (float, optional) -- Mean of the normal distribution to sample, by default 0.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenNormal(std: float = 1.0, mean: float = 0.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy normal random number generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • std (float, optional) -- Standard deviation of the normal distribution to sample, by default 1.0

  • mean (float, optional) -- Mean of the normal distribution to sample, by default 0.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenStandardT(dofs: float, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy t distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • dofs (float) -- Number of degrees of freedom of the distribution must be greater than zero.

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenTriangular(left: float = -1.0, mode: float = 0.0, right: float = 1.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy triangular random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • left (float, optional) -- Left (min) corner of the triangular distribution, by default -1.0

  • mode (float, optional) -- Central peak of the triangular distribution, by default 0.0

  • right (float, optional) -- Right (max) corner of the triangular distribution , by default 1.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.GenUniform(low: float = -1.0, high: float = 1.0, seed: int | None = None)[source]

Bases: IGenRandom

Class wrapping the numpy uniform random number generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.

Parameters:
  • low (float, optional) -- Lower bound of the uniform dsitribution., by default -1.0

  • high (float, optional) -- Upper bound of the uniform distribution, by default 1.0

  • seed (int | None, optional) -- Optional seed for the random generator to allow for reproducibility and testing, by default None

generate(shape: tuple[int, ...]) ndarray[source]

Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array to return.

Returns:

np.ndarray -- Array of random numbers with the specified shape.

class pyvale.generatorsrandom.IGenRandom[source]

Bases: ABC

Interface (abstract base class) for wrapping numpy random number generation to allow probability distribution parameters to be specified in the initialiser whereas the generation of random numbers has a common method that just takes the require shape to return. Allows for easy subsitution of different probability distributions.

abstractmethod generate(shape: tuple[int, ...]) ndarray[source]

Abstract method. Generates an array of random numbers with the shape specified by the input.

Parameters:

shape (tuple[int,...]) -- Shape of the array of random numbers to be returned.

Returns:

np.ndarray -- Array of random numbers with shape specified by the input shape.