Taweret.mix.gaussian

class Taweret.mix.gaussian.Multivariate(x, models, n_models=0)[source]

Bases: BaseMixer

The multivariate BMM class originally introduced in the BAND SAMBA package. Combines individual models using a Gaussian form.

\[f_{\dagger} = \mathcal{N} \left( \sum_i \frac{f_i/v_i}{1/v_i}, \sum_i \frac{1}{v_i} \right)\]

Example:

m = Multivariate(x=np.linspace(), models=dict(), n_models=0)
m.predict(ci=68)
m.evaluate_weights()

Parameters:

xnumpy.linspace

Input space variable in which mixing is occurring.

modelsdict

Dict of models with BaseModel methods.

n_modelsint

Number of free parameters per model.

Returns:

None.

evaluate()[source]

Evaluate the mixed model at one set of parameters. Not needed for this mixing method.

evaluate_weights()[source]

Calculate the weights for each model in the mixed model over the input space.

Returns:

weightsnumpy.ndarray

Array of model weights calculated in the Multivariate.predict function.

property map

Return the MAP values of the parameters. Not needed for this method.

property posterior

Return the posterior of the parameters. Not needed for this mixing method.

predict(ci=68)[source]

The f_dagger function responsible for mixing the models together in a Gaussian way. Based on the first two moments of the distribution: mean and variance.

Parameters:

ciint, list

The desired credibility interval(s) (1-sigma, 2-sigma)

Returns:

mean, intervals, std_devnumpy.ndarray

The mean, credible intervals, and std_dev of the predicted mixed model

predict_weights()[source]

Predict the weights of the mixed model. Returns mean and intervals from the posterior of the weights. Not needed for this mixing method.

property prior

Return the prior of the parameters in the mixing. Not needed for this method.

prior_predict()[source]

Find the predicted prior distribution. Not needed for this mixing method.

sample_prior()[source]

Returns samples from the prior distributions for the various weight parameters. Not needed for this mixing method.

set_prior()[source]

Set the priors on the parameters. Not needed for this mixing method.

train()[source]

Train the mixed model by optimizing the weights. Not needed in this mixing method.