physbo.blm.core.model module

class physbo.blm.core.model.model(lik, prior, options={})[ソース]

ベースクラス: object

Baysean Linear Model

prior

prior distribution of weights

Type:

physbo.blm.prior.gauss

lik

kernel

Type:

physbo.blm.lik.gauss

nbasis

number of features in random feature map

Type:

int

stats

auxially parameters for sampling

Type:

Tuple

method

sampling method

Type:

str

get_post_fcov(X, Psi=None, diag=True)[ソース]

calculates posterior covariance of 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)

戻り値の型:

numpy.ndarray

get_post_fmean(X, Psi=None, w=None)[ソース]

calculates posterior mean of model (function)

パラメータ:
  • X (numpy.ndarray) -- inputs

  • Psi (numpy.ndarray) -- feature maps

  • w (numpy.ndarray) -- weight

get_post_params_mean()[ソース]

calculates posterior mean of weights

戻り値の型:

numpy.ndarray

post_sampling(Xtest, Psi=None, N=1, alpha=1.0)[ソース]

draws samples of mean value of model

パラメータ:
  • Xtest (numpy.ndarray) -- inputs

  • Psi (numpy.ndarray) -- feature maps (default: blm.lik.get_basis(Xtest))

  • N (int) -- number of samples (default: 1)

  • alpha (float) -- noise for sampling source

戻り値の型:

numpy.ndarray

predict_sampling(Xtest, Psi=None, N=1)[ソース]

draws samples from model

パラメータ:
  • Xtest (numpy.ndarray) -- inputs

  • Psi (numpy.ndarray) -- feature map (default: blm.lik.get_basis(Xtest))

  • N (int) -- number of samples (default: 1)

戻り値の型:

numpy.ndarray

prepare(X, t, Psi=None)[ソース]

initializes model by using the first training dataset

パラメータ:
  • X (numpy.ndarray) -- inputs

  • t (numpy.ndarray) -- target (label)

  • Psi (numpy.ndarray) -- feature maps

sampling(w_mu=None, N=1, alpha=1.0)[ソース]

draws samples of weights

パラメータ:
  • 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)

戻り値:

samples of weights

戻り値の型:

numpy.ndarray

update_stats(x, t, psi=None)[ソース]

updates model by using another training data

パラメータ:
  • x (numpy.ndarray) -- input

  • t (float) -- target (label)

  • psi (numpy.ndarray) -- feature map