physbo.blm.predictor module

class physbo.blm.predictor.predictor(config, model=None)[source]

Bases: base_predictor

Predictor using Baysean linear model

blm
Type:

physbo.blm.core.model

config

configuration

Type:

physbo.misc.set_config

delete_stats()[source]

resets model

fit(training, num_basis=None)[source]

fit model to training dataset

Parameters:
  • training (physbo.variable) – dataset for training

  • num_basis (int) – the number of basis (default: self.config.predict.num_basis)

get_basis(X)[source]

calculates feature maps Psi(X)

Parameters:

X (numpy.ndarray) – inputs

Returns:

Psi – feature maps

Return type:

numpy.ndarray

get_post_fcov(training, test)[source]

calculates posterior variance-covariance matrix of model

Parameters:
  • training (physbo.variable) – training dataset. If already trained, the model does not use this.

  • test (physbo.variable) – inputs

Return type:

numpy.ndarray

get_post_fmean(training, test)[source]

calculates posterior mean value of model

Parameters:
  • training (physbo.variable) – training dataset. If already trained, the model does not use this.

  • test (physbo.variable) – inputs

Return type:

numpy.ndarray

get_post_params(training, test)[source]

calculates posterior weights

Parameters:
  • training (physbo.variable) – training dataset. If already trained, the model does not use this.

  • test (physbo.variable) – inputs (not used)

Return type:

numpy.ndarray

get_post_samples(training, test, N=1, alpha=1.0)[source]

draws samples of mean values of model

Parameters:
  • training (physbo.variable) – training dataset. If already trained, the model does not use this.

  • test (physbo.variable) – inputs

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

  • alpha (float) – noise for sampling source (default: 1.0)

Return type:

numpy.ndarray

get_predict_samples(training, test, N=1)[source]

draws samples of values of model

Parameters:
  • training (physbo.variable) – training dataset. If already trained, the model does not use this.

  • test (physbo.variable) – inputs

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

  • alpha (float) – noise for sampling source (default: 1.0)

Return type:

numpy.ndarray (N x len(test))

prepare(training)[source]

initializes model by using training data set

Parameters:

training (physbo.variable) – dataset for training

update(training, test)[source]

updates the model.

If not yet initialized (prepared), the model will be prepared by training. Otherwise, the model will be updated by test.

Parameters:
  • training (physbo.variable) – training dataset for initialization (preparation). If already prepared, the model ignore this.

  • test (physbo.variable) – training data for update. If not prepared, the model ignore this.