src package

Submodules

src.ACBICI.calibrator module

src.ACBICI.gprocess module

src.ACBICI.kernels module

Created on Tue Jan 28

@author: Christina Schenk, Ignacio Romero

class src.ACBICI.kernels.Expo(*args, **kwargs)[source]

Bases: kernel

Exponential kernel. Exponential growth. Rate increases as input increases.

evalkernel(dist, lamb, beta)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.Matern32(*args, **kwargs)[source]

Bases: kernel

Once differentiable Matern kernel.

evalkernel(dist, lamb, beta)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.Matern52(*args, **kwargs)[source]

Bases: kernel

Twice differentiable Matern kernel.

evalkernel(dist, lamb, beta)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.MultiTask(*args, **kwargs)[source]

Bases: kernel

Multi Task kernel assuming that tasks independent, just comparing for same task dimension 0 for different tasks or matern3/2 kernel if same task

evalkernel(dist, lamb, beta, x1=None, x2=None)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.RatQuad(*args, **kwargs)[source]

Bases: kernel

Rational quadratic kernel with alpha=1.

evalkernel(dist, lamb, beta)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.SqExpo(*args, **kwargs)[source]

Bases: kernel

Squared exponential kernel (RBF or Gaussian Kernel).

evalkernel(dist, lamb, beta, x1, x2)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

class src.ACBICI.kernels.kernel(*args, **kwargs)[source]

Bases: ABC

abstractmethod evalkernel(dist, lamb, beta, x1=None, x2=None)[source]

Evaluates the kernel for a distance ‘dist’, given the two hyperparameters lambda and beta. All the kernels must be of the form k = lambda * f(distance/beta)

Parameters:
  • dist (distance)

  • lamb (hyperparameter lambda)

  • beta (hyperparameter beta)

Return type:

kernel evaluation

abstractmethod print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print information about the kernel on a file

Parameters:

file (filename)

Return type:

None

src.ACBICI.randomprocess module

src.ACBICI.priors module

Created on Nov 25 2024 Class for probability priors.

@author: Christina Schenk, Ignacio Romero

class src.ACBICI.priors.Cauchy(*args, **kwargs)[source]

Bases: prior

Prior distribution of the class Cauchy with parameters mu and sigma

The PDF is p(x) = 2/(pi sigma) * 1/(1+ (x-mu)^2/sigma^2) for any x The distribution is identical to the half-Cauchy, the difference being that the random variable might be any real number.

See: https://distribution-explorer.github.io/continuous/cauchy.html https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.cauchy.html#scipy.stats.cauchy

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new Cauchy prior with sigma scaled by factor.

Parameters:

factor (multiplicative scaling factor for sigma.)

Return type:

Cauchy prior with sigma = self.sigma * factor

class src.ACBICI.priors.Gamma(*args, **kwargs)[source]

Bases: prior

Prior distribution of the class Gamma with shape parameter alpha and rate parameter beta.

The PDF is p(x) = 1/Gamma(alpha) * beta^alpha * x^(alpha-1) * exp[-beta x] with mean alpha/beta and variance alpha/beta**2

See: https://distribution-explorer.github.io/continuous/gamma.html https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gamma.html#scipy.stats.gamma

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new Gamma prior with std scaled by factor and mean preserved.

Parameters:

factor (multiplicative scaling factor for the standard deviation.)

Return type:

Gamma prior with new_alpha = alpha/factor^2, new_beta = beta/factor^2

class src.ACBICI.priors.HalfCauchy(*args, **kwargs)[source]

Bases: prior

Prior distribution of the class half-Cauchy with parameters mu and sigma

The PDF is p(x) = 2/(pi sigma) * 1/(1+ (x-mu)^2/sigma^2) for x >= mu

See https://distribution-explorer.github.io/continuous/halfcauchy.html

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new HalfCauchy prior with sigma scaled by factor.

Parameters:

factor (multiplicative scaling factor for sigma.)

Return type:

HalfCauchy prior with sigma = self.sigma * factor

class src.ACBICI.priors.HalfNormal(*args, **kwargs)[source]

Bases: prior

Prior distribution of the class half-normal with parameters mu and sigma

See https://distribution-explorer.github.io/continuous/halfnormal.html

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new HalfNormal prior with sigma scaled by factor.

Parameters:

factor (multiplicative scaling factor for sigma.)

Return type:

HalfNormal prior with sigma = self.sigma * factor

class src.ACBICI.priors.Normal(*args, **kwargs)[source]

Bases: prior

Prior distribution of the class norm with parameters mu and sigma

The PDF is p(x) = 1/sqrt(2pi sigma^2) * exp[-0.5 (x-mu)^2/sigma^2]

See: https://distribution-explorer.github.io/continuous/norm.html https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html#scipy.stats.norm

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new Normal prior with sigma scaled by factor.

Parameters:

factor (multiplicative scaling factor for sigma.)

Return type:

Normal prior with sigma = self.sigma * factor

class src.ACBICI.priors.Uniform(*args, **kwargs)[source]

Bases: prior

Uniform prior distribution in the interval [a,b]. Probability density function is p(x) = 1/(b-a) for a <= x <= b.

See https://distribution-explorer.github.io/continuous/uniform.html

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new Uniform prior with the interval width scaled by factor around the center.

Parameters:

factor (multiplicative scaling factor for the half-width.)

Return type:

Uniform prior centered at (a+b)/2 with half-width (b-a)/2 * factor

class src.ACBICI.priors.Weibull(*args, **kwargs)[source]

Bases: prior

Weibull prior distribution. Probability density function is p(x) = 0 x<= 0 p(x) = (k/lambda) * (x/lambda)^(k-1) * exp(-(x/lambda)^k)

See https://distribution-explorer.github.io/continuous/weibull.html

print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

scaled(factor)[source]

Return a new Weibull prior with lambda scaled by factor.

Parameters:

factor (multiplicative scaling factor for lambda.)

Return type:

Weibull prior with lambda = self.lamb * factor

class src.ACBICI.priors.prior(*args, **kwargs)[source]

Bases: ABC

bounds()[source]

Return lower and upper bound values of the distribution. Either can be -np.inf or +np.inf

Parameters:

None

Returns:

  • lower (lower bound)

  • upper (upper bound)

guessInterval()[source]

Return a fair interval for the expected value of the variable

Parameters:

None

Returns:

  • lower (lower bound)

  • upper (upper bound)

logProbability(x)[source]

Log of the probability density function.

Parameters:

x (scalar at which the log-pdf has to be evaluated.)

Return type:

logpdf(x)

mean()[source]

Return the mean of the prior distribution.

Parameters:

None

Return type:

mean of the distribution

pdf(x)[source]

Calculate the PDF at the values x.

Parameters:

x (scalar at which the pdf has to be evaluated.)

Return type:

pdf(x)

ppf(percentiles)[source]

Calculate the percentiles point function for input(s)

Parameters:

percentiles (array of scalars of the percentiles that need to be calculated.) – values should be in [0,1]

Return type:

array with the values of the random variable where the percentiles are attained.

abstractmethod print(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Write on file information about the probability distribution.

randomSample()[source]

Generate a single sample distributed according to the probability distribution of the prior.

Parameters:

None

Return type:

one random sample from the distribution

std()[source]

Return the standard deviation of the prior distribution.

Parameters:

None

Return type:

standard deviation of the distribution

src.ACBICI.vbmc module

Module contents