physbo.gp.cov.gauss module
- class physbo.gp.cov.gauss.gauss(num_dim, width=3, scale=1, ard=False, max_width=1000000.0, min_width=1e-06, max_scale=1000000.0, min_scale=1e-06)[source]
Bases:
object
gaussian kernel
- cat_params(width, scale)[source]
Taking the logarithm of width and scale parameters and concatinate them into one ndarray
- Parameters:
width (int)
scale (int)
- Returns:
params – Parameters
- Return type:
numpy.ndarray
- decomp_params(params)[source]
decompose the parameters defined on the log region into width and scale parameters
- Parameters:
params (numpy.ndarray) – parameters
- Returns:
width (float)
scale (float)
- get_cand_params(X, t)[source]
Getting candidate parameters.
- Parameters:
X (numpy.ndarray) – N x d dimensional matrix. Each row of X denotes the d-dimensional feature vector of search candidate.
t (numpy.ndarray) – N dimensional array. The negative energy of each search candidate (value of the objective function to be optimized).
- Returns:
params
- Return type:
numpy.ndarray
- get_cov(X, Z=None, params=None, diag=False)[source]
compute the covariant matrix :param X: N x d dimensional matrix. Each row of X denotes the d-dimensional feature vector of search candidate. :type X: numpy.ndarray :param Z: N x d dimensional matrix. Each row of Z denotes the d-dimensional feature vector of search candidate. :type Z: numpy.ndarray :param params: Parameters :type params: numpy.ndarray :param diag: If X is the diagonalization matrix, true. :type diag: bool
- Returns:
G – covariant matrix
- Return type:
numpy.ndarray
- get_grad(X, params=None)[source]
Getting gradiant values of X
- Parameters:
X (numpy.ndarray) – N x d dimensional matrix. Each row of X denotes the d-dimensional feature vector of search candidate.
params (numpy.ndarray)
- Returns:
grad
- Return type:
numpy.ndarray
- get_params_bound()[source]
Getting boundary array.
- Returns:
bound – A num_params-dimensional array with the tuple (min_params, max_params).
- Return type:
list
- load(file_name)[source]
Recovering the Gaussian kernel from file :param file_name: file name to load the information of the kernel :type file_name: str
- prepare(params=None)[source]
Setting parameters
- Parameters:
params (numpy.ndarray) – parameters
- Returns:
params (numpy.ndarray)
width (int)
scale (int)
- rand_expans(num_basis, params=None)[source]
Kernel Expansion
- Parameters:
num_basis (int) – total number of basis
params (numpy.ndarray) – Parameters
- Return type:
tupple (W, b, amp)
- save(file_name)[source]
save the gaussian kernel
- Parameters:
file_name (str) – file name to save the information of the kernel
- set_params(params)[source]
set kernel parameters
- Parameters:
params (numpy.ndarray) – Parameters for optimization.
- supp_params(params)[source]
Set maximum (minimum) values for parameters when the parameter is greater(less) than this value.
- Parameters:
params (numpy.ndarray) – Parameters for optimization. Array of real elements of size (n,), where ‘n’ is the number of independent variables.
- Returns:
params
- Return type:
numpy.ndarray