physbo.blm.inf.exact module
- physbo.blm.inf.exact.get_post_fcov(blm, X, Psi=None, diag=True)[source]
calculates posterior covariance of model
- Parameters:
blm (physbo.blm.core.model)
X (numpy.ndarray) – inputs
Psi (numpy.ndarray) – feature maps (default: blm.lik.linear.basis.get_basis(X))
diag (bool) – if True, returns only variances as a diagonal matrix (default: True)
- Return type:
numpy.ndarray
- physbo.blm.inf.exact.get_post_fmean(blm, X, Psi=None, w=None)[source]
calculates posterior mean of model
- Parameters:
blm (physbo.blm.core.model)
X (numpy.ndarray) – inputs
Psi (numpy.ndarray) – feature maps (default: blm.lik.linear.basis.get_basis(X))
w (numpy.ndarray) – weights (default: get_post_params_mean(blm))
- Return type:
numpy.ndarray
- physbo.blm.inf.exact.get_post_params_mean(blm)[source]
calculates mean of weight
- Parameters:
blm (physbo.blm.core.model)
- Return type:
numpy.ndarray
- physbo.blm.inf.exact.prepare(blm, X, t, Psi=None)[source]
initializes auxiaialy parameters for quick sampling
blm.stats
will be updated.- Parameters:
blm (physbo.blm.core.model) – model
X (numpy.ndarray) – inputs
t (numpy.ndarray) – target (label)
Psi – feature maps (default: blm.lik.get_basis(X))
- physbo.blm.inf.exact.sampling(blm, w_mu=None, N=1, alpha=1.0)[source]
draws samples of weights
- Parameters:
blm (physbo.blm.core.model) – model
w_mu (numpy.ndarray) – mean of weight
N (int) – the number of samples (default: 1)
alpha (float) – noise for sampling source (default: 1.0)
- Returns:
samples of weights
- Return type:
numpy.ndarray
- physbo.blm.inf.exact.update_stats(blm, x, t, psi=None)[source]
calculates new auxiaialy parameters for quick sampling by fast-update
- Parameters:
blm (physbo.blm.core.model) – model
x (numpy.ndarray) – input
t (numpy.ndarray) – target (label)
psi – feature map (default: blm.lik.get_basis(X))
- Returns:
(U, b, alpha) – new auxially parameters
- Return type:
Tuple
Notes
blm.stats[0]
(U) will be mutated while the others not.