physbo.gp.core.model module
- class physbo.gp.core.model.model(lik, mean, cov, inf='exact')[source]
Bases:
object
- cat_params(lik_params, prior_params)[source]
Concatinate the likelihood and prior parameters
- Parameters:
lik_params (numpy.ndarray) – Parameters for likelihood
prior_params (numpy.ndarray) – Parameters for prior
- Returns:
params – parameters about likelihood and prior
- Return type:
numpy.ndarray
- decomp_params(params=None)[source]
decomposing the parameters to those of likelifood and priors
- Parameters:
params (numpy.ndarray) – parameters
- Returns:
lik_params (numpy.ndarray)
prior_params (numpy.ndarray)
- eval_marlik(params, X, t, N=None)[source]
Evaluating marginal likelihood.
- Parameters:
params (numpy.ndarray) – 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).
N (int) – Total number of subset data (if not specified, all dataset is used)
- Returns:
marlik (float)
Marginal likelihood.
- export_blm(num_basis)[source]
Exporting the blm(Baysean linear model) predictor
- Parameters:
num_basis (int) – Total number of basis
- Return type:
physbo.blm.core.model
- fit(X, t, config)[source]
Fitting function (update 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).
config (physbo.misc.set_config object)
- get_cand_params(X, t)[source]
Getting candidate for 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 – Parameters
- Return type:
numpy.ndarray
- get_grad_marlik(params, X, t, N=None)[source]
Evaluating gradiant of marginal likelihood.
- Parameters:
params (numpy.ndarray) – 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).
N (int) – Total number of subset data (if not specified, all dataset is used)
- Returns:
grad_marlik – Gradiant of marginal likelihood.
- Return type:
numpy.ndarray
- get_params_bound()[source]
Getting boundary of the parameters.
- Returns:
bound – An array with the tuple (min_params, max_params).
- Return type:
list
- get_post_fcov(X, Z, params=None, diag=True)[source]
Calculating posterior covariance matrix of model (function)
- Parameters:
X (numpy.ndarray) – inputs
Z (numpy.ndarray) – feature maps
params (numpy.ndarray) – Parameters
diag (bool) – If X is the diagonalization matrix, true.
- Return type:
physbo.gp.inf.exact.get_post_fcov
- get_post_fmean(X, Z, params=None)[source]
Calculating posterior mean of model (function)
- Parameters:
X (numpy.ndarray) – inputs
Z (numpy.ndarray) – feature maps
params (numpy.ndarray) – Parameters
See also
- post_sampling(X, Z, params=None, N=1, alpha=1)[source]
draws samples of mean value of model
- Parameters:
X (numpy.ndarray) – inputs
Z (numpy.ndarray) – feature maps
N (int) – number of samples (default: 1)
alpha (float) – noise for sampling source
- Return type:
numpy.ndarray
- predict_sampling(X, Z, params=None, N=1)[source]
- Parameters:
X (numpy.ndarray) – training datasets
Z (numpy.ndarray) – input for sampling objective values
params (numpy.ndarray) – Parameters
N (int) – number of samples (default: 1)
- Return type:
numpy.ndarray
- prepare(X, t, params=None)[source]
- 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).
params (numpy.ndarray) – Parameters.
- sub_sampling(X, t, N)[source]
Make subset for sampling
- Parameters:
X (numpy.ndarray) – Each row of X denotes the d-dimensional feature vector of search candidate.
t (numpy.ndarray) – The negative energy of each search candidate (value of the objective function to be optimized).
N (int) – Total number of data in subset
- Returns:
subX (numpy.ndarray)
subt (numpy.ndarray)