flexs.baselines.explorers.bo

BO explorer.

class flexs.baselines.explorers.bo.BO(model, rounds, sequences_batch_size, model_queries_per_batch, starting_sequence, alphabet, log_file=None, method='EI', recomb_rate=0)[source]

Bases: flexs.explorer.Explorer

Evolutionary Bayesian Optimization (Evo_BO) explorer.

Algorithm works as follows:
for N experiment rounds
recombine samples from previous batch if it exists and measure them,

otherwise skip

Thompson sample starting sequence for new batch while less than B samples in batch

Generate model_queries_per_batch/sequences_batch_size samples If variance of ensemble models is above twice that of the starting

sequence

Thompson sample another starting sequence

EI(vals)[source]

Compute expected improvement.

static Thompson_sample(measured_batch)[source]

Pick a sequence via Thompson sampling.

static UCB(vals)[source]

Upper confidence bound.

initialize_data_structures()[source]

Initialize.

pick_action(all_measured_seqs)[source]

Pick action.

propose_sequences(measured_sequences)[source]

Propose top sequences_batch_size sequences for evaluation.

Return type

Tuple[ndarray, ndarray]

sample_actions()[source]

Sample actions resulting in sequences to screen.

train_models()[source]

Train the model.

class flexs.baselines.explorers.bo.GPR_BO(model, rounds, sequences_batch_size, model_queries_per_batch, starting_sequence, alphabet, log_file=None, seq_proposal_method='Thompson')[source]

Bases: flexs.explorer.Explorer

Explorer using GP-based Bayesian Optimization.

Uses Gaussian process with RBF kernel on black box function. IMPORTANT: This explorer is not limited by any virtual screening restriction, and is used to find the unrestricted performance of Bayesian Optimization techniques in small landscapes.

Reference: http://krasserm.github.io/2018/03/21/bayesian-optimization/

propose_sequences(measured_sequences)[source]

Propose batch_size samples.

Return type

Tuple[ndarray, ndarray]

propose_sequences_via_greedy()[source]

Propose a batch of new sequences.

Based on greedy in the expectation of the Gaussian posterior.

propose_sequences_via_thompson()[source]

Propose a batch of new sequences. Based on Thompson sampling with a Gaussian posterior.

propose_sequences_via_ucb()[source]

Propose a batch of new sequences. Based on upper confidence bound.

reset()[source]

Reset.