gphist.process module

Gaussian random process generator.

class gphist.process.HyperParameterLogGrid(n_h, h_min, h_max, n_sigma, sigma_min, sigma_max)

Bases: object

Defines a log-spaced grid of hyperparameter values.

Parameters:
  • n_h (int) – Number of grid points covering hyperparameter h.
  • h_min (float) – Minimum grid value of hyperparameter h.
  • h_max (float) – Maximum grid value of hyperparameter h.
  • n_sigma (int) – Number of grid points covering hyperparameter sigma.
  • sigma_min (float) – Minimum grid value of hyperparameter sigma.
  • sigma_max (float) – Maximum grid value of hyperparameter sigma.
decode_index(index)

Decode a flattened grid index.

Parameters:index (int) – Flattened index in the range [0:n_h*n_sigma].
Returns:h,sigma index values.
Return type:tuple
get_values(index)

Lookup hyperparameter values on the grid.

Parameters:index (int) – Flattened index in the range [0:n_h*n_sigma].
Returns:Values of h,sigma at the specified grid point.
Return type:tuple
class gphist.process.SquaredExponentialGaussianProcess(hyper_h, hyper_sigma)

Bases: object

Generates Gaussian process realizations using a squared-exponential kernel.

The process is defined such that <s> = 0 and <s1*s2> = k(s1-s2) with the kernel k(ds) = h^2 exp(-ds^2/(2 sigma^2)). The hyperparameters of this process are h and sigma, which establish the characteristic vertical and horizontal length scales, respectively.

Parameters:
  • hyper_h (float) – vertical scaling hyperparameter.
  • hyper_sigma (float) – horizontal scaling hyperparameter.
generate_samples(num_samples, svalues, random_state=None)

Generates random samples of our Gaussian process.

Parameters:
  • num_samples (int) – Number of samples to generate.
  • svalues (ndarray) – Values of the evolution variable where the process will be sampled.
  • random_state (numpy.RandomState) – Random state to use, or use default state if None.
Returns:

Array with shape (num_samples,len(svalues)) containing the

generated samples.

Return type:

ndarray