profit.al.mcmc_al

Module Contents

Classes

McmcAL

Markov-chain Monte-Carlo active learning algorithm.

Attributes

two

profit.al.mcmc_al.two = False
class profit.al.mcmc_al.McmcAL(runner, variables, reference_data, ntrain, warmup_cycles=defaults['warmup_cycles'], nwarmup=base_defaults['nwarmup'], batch_size=base_defaults['batch_size'], target_acceptance_rate=defaults['target_acceptance_rate'], convergence_criterion=base_defaults['convergence_criterion'], nsearch=base_defaults['nsearch'], sigma_n=defaults['sigma_n'], make_plot=base_defaults['make_plot'], initial_points=defaults['initial_points'], save=defaults['save'], last_percent=defaults['last_percent'], delayed_acceptance=defaults['delayed_acceptance'])[source]

Bases: profit.al.ActiveLearning

Markov-chain Monte-Carlo active learning algorithm.

Parameters:
  • reference_data (np.ndarray) – Observed experimental data points. This is not the simulated model data!

  • warmup_cycles (int) – Number of warmup cycles with nwarmup iterations each.

  • target_acceptance_rate (float) – Target rate with which probability new points are accepted.

  • sigma_n (float) – Estimated standard deviation of the experimental data.

  • initial_points (list of float) – Starting points for the MCMC.

  • delayed_acceptancd (bool) – Whether to use delayed acceptance with a surrogate model for the likelihood.

Xpred

Matrix of the candidate points built with np.meshgrid.

Type:

np.ndarray

dx

Distance between iterations in parameter space.

Type:

np.ndarray

ndim

Dimension of input parameters.

Type:

int

Xtrain

Array of sampled MCMC points.

Type:

np.ndarray

log_likelihood

Array of the log likelihood during training.

Type:

np.ndarray

accepted

Boolean array of accepted/rejected sample MCMC points.

Type:

np.ndarray[bool]

labels
cost(y)[source]
f(x)[source]
warmup(save_intermediate=base_defaults['save_intermediate'])[source]

Warmup MCMC.

learn(resume_from=base_defaults['resume_from'], save_intermediate=base_defaults['save_intermediate'])[source]

Main loop for active learning.

do_mcmc(rng)[source]
update_run(candidates)[source]

Run a batch of simulations with the new candidates.

Parameters:

candidates (np.array) – Input points to run the simulation on.

update_data()[source]

Update the variables with the runner data.

save(path)[source]

Save the AL model.

Parameters:

path (str) – Path where the model is saved.

save_stats(path)[source]

Save mean and std of X values

plot()[source]

Plot the progress of the AL learning.

plot_mcmc(phase)[source]
classmethod from_config(runner, variables, config, base_config)[source]

Instantiates an ActiveLearning object from the configuration parameters.

Parameters:
Returns:

AL instance.

Return type:

profit.al.active_learning.ActiveLearning