Active learning selects examples for labeling in successive rounds, using what a model has learned to guide the next choice. It is useful when labels are expensive: in drug discovery, a docking simulation can score a molecule against a target protein, but docking an entire large library may be impractical. section 9.2 section 9.2.6
A surrogate model is a faster predictor trained on labels from an expensive evaluator, or oracle. In progressive docking, the surrogate predicts docking scores for untested molecules; selected candidates then receive full oracle evaluations, and their scores improve the next model. section 9.0 section 9.2.6
A practical active learning loop follows these steps:
- Select an initial set of molecules and obtain their oracle scores. Random sampling is simple, while diversity-based sampling aims to cover more of chemical space. section 9.2.4
- Train a surrogate on molecular features and the available scores, then predict scores for the remaining pool. section 9.2.2 section 9.2.1
- Use an acquisition function to choose a batch for evaluation. Add the new scores to the training set, retrain, and repeat until the budget is exhausted. section 9.2.5 section 9.2.7
Figure 9.4 Active learning framework for accelerated hit discovery in structure-based drug design. The iterative workflow begins with (1) initial sampling of diverse compounds from an ultra-large compound database, followed by (2) molecular docking evaluation of the selected compounds to generate binding affinity scores. These results are used to (3) train or improve a surrogate machine learning model, which then (4) predicts binding affinities for the remaining compounds in the database. Based on an acquisition function that balances exploration and exploitation, the system (5) selects the next batch of informative compounds for evaluation. This cycle continues until convergence, with promising candidates transferred to the top-scoring compounds collection. Uncertainty decreases as the labeled training pool expands with each iteration, enabling efficient exploration of vast chemical spaces without exhaustive docking of all compounds.

The diagram connects initial sampling, docking, surrogate prediction, and acquisition in a single iterative workflow. section 9.2.1
Selection depends on the goal. Greedy acquisition favors molecules with promising predicted scores. Uncertainty sampling instead targets predictions the model is least sure about; representativeness and diversity help cover regions that might otherwise be missed. These choices trade off finding promising candidates now against exploring what the model does not yet know. section 9.2.5 section 9.2.7
Listing 9.8 Greedy Acquisition and Uncertainty Sampling
def greedy_acquisition(model, X_pool, device, batch_size=1):
predictions = model.predict(X_pool, device)
best_indices = np.argsort(predictions)[:batch_size]
return best_indices
def uncertainty_sampling(
model, X_pool, device, batch_size=1, n_samples=100
):
model.train() #A
all_predictions = np.zeros((n_samples, len(X_pool)))
for i in range(n_samples): #B
inputs = torch.tensor(X_pool, dtype=torch.float32).to(device)
with torch.no_grad(): #C
outputs = model(inputs)
all_predictions[i, :] = outputs.cpu().numpy().flatten()
uncertainties = np.std(all_predictions, axis=0) #D
best_indices = np.argsort(
uncertainties
)[::-1][:batch_size] #E
return best_indices
def select_next_molecule(
model, X_pool, smiles_pool, device, best_score, batch_size=1,
acquisition_function="greedy", xi=0.01
): #F
if acquisition_function == "greedy":
best_indices = greedy_acquisition(model, X_pool, device, batch_size)
elif acquisition_function == "uncertainty":
best_indices = uncertainty_sampling(model, X_pool, device)
elif acquisition_function == "pi":
best_indices = probability_of_improvement(
model, X_pool, device, best_score, xi
)
elif acquisition_function == "ei":
best_indices = expected_improvement(
model, X_pool, device, best_score, xi
)
else:
raise ValueError(f"Unknown acquisition function: {acquisition_function}")
best_smiles = [smiles_pool[i] for i in best_indices]
return best_indices, best_smilesThis Python listing compares greedy selection with uncertainty sampling using repeated dropout predictions. section 9.2.5
The surrogate also matters. One implementation uses a PyTorch neural network with Morgan fingerprints as input and dropout to reduce overfitting. For very small labeled sets, Gaussian processes are an alternative suited to low-data regimes. section 9.2.2
Finding top docking candidates
In a VEGFR-2 experiment, an initial 5,000 molecules were followed by ten batches of 250 using greedy acquisition. The run found 73 of the reference dataset’s top 100 scoring molecules after 7,500 total evaluations. The oracle was a proxy that looked up previously docked scores, not a fresh docking simulation; the result is a benchmark for this setup, not proof of experimental binding. section 9.2.7 section 9.2.6
Listing 9.10 Active Learning Loop Implementation
def active_learning_loop(X_pool, smiles_pool, n_initial_samples,
n_iterations, budget_per_iteration, device,
reference_df=None, receptor_file=None,
top_reference_smiles=[],
initial_selection_method="random",
oracle=deepdock_oracle,
box=None, acquisition_function="greedy", xi=0.01,
log_dir="tensorboard_logs"):
if device is None:
device = torch.device(
"cuda" if torch.cuda.is_available() else "cpu"
)
writer = initialize_tensorboard(log_dir) #A
initial_indices = initialize_samples(
X_pool, initial_selection_method, n_initial_samples
) #B
X_train = X_pool[initial_indices]
smiles_train = [smiles_pool[i] for i in initial_indices]
y_train = oracle(
smiles_train, box=box, idx_list=initial_indices,
reference_df=reference_df, receptor_file=receptor_file
) #C
best_score = min(y_train) #D
top_molecules_found = calculate_top_molecules_captured(
smiles_train, top_reference_smiles
)
writer.add_scalar(
'Performance/TopMoleculesFound', top_molecules_found, 0
)
writer.add_scalar('Performance/BestScore', best_score, 0)
print(f"Selected {len(X_train)} initial samples. "
f"Found {top_molecules_found} top molecules.")
# Remove initial samples from the pool
mask = np.ones(len(X_pool), dtype=bool) #E
mask[initial_indices] = False
X_pool = X_pool[mask]
smiles_pool = [s for i, s in enumerate(smiles_pool) if mask[i]]
model = DeepDockingModel(
input_size=X_train.shape[1], hidden_size=512, output_size=1
).to(device) #F
train_history = train_deep_model(
model, X_train, y_train, device, writer, global_step=0,
epochs=10, batch_size=32
)
results = []
for iteration in range(n_iterations): #G
print(f"\nStarting iteration {iteration + 1}/{n_iterations}")
print(f"Selecting {budget_per_iteration} molecules "
f"using {acquisition_function} acquisition...")
start_time = time.time()
best_indices, best_smiles = select_next_molecule(
model, X_pool, smiles_pool, device, best_score,
batch_size=budget_per_iteration,
acquisition_function=acquisition_function, xi=xi,
)
iteration_time = time.time() - start_time
print("Docking selected molecules...")
true_scores = oracle(
best_smiles, box=box, idx_list=best_indices,
reference_df=reference_df, receptor_file=receptor_file
)
best_score = min(best_score, min(true_scores))
selected_smiles_iter = best_smiles #H
selected_scores_iter = true_scores
# Capture selected fingerprints before shrinking pool
X_new = X_pool[best_indices].copy()
# Update training data
smiles_train.extend(selected_smiles_iter)
y_train = np.concatenate([
y_train, np.asarray(selected_scores_iter, dtype=float)
])
X_train = np.vstack([X_train, X_new])
# Update pool (remove selected molecules)
mask = np.ones(len(X_pool), dtype=bool) #I
mask[best_indices] = False
X_pool = X_pool[mask]
smiles_pool = [s for i, s in enumerate(smiles_pool) if mask[i]]
top_molecules_found = calculate_top_molecules_captured(
smiles_train, top_reference_smiles
) #J
writer.add_scalar(
'Performance/TopMoleculesFound', top_molecules_found, iteration
)
writer.add_scalar('Performance/BestScore', best_score, iteration)
print(f"Selected {len(smiles_train)} initial samples. "
f"Found {top_molecules_found} top molecules.")
results.append({
'iteration': iteration + 1,
'total_molecules': len(smiles_train),
'top_molecules_found': top_molecules_found,
'best_score': best_score,
'time_per_iteration': iteration_time
})
print("Retraining surrogate model...") #K
train_deep_model(
model, X_train, y_train, device, writer, iteration + 1
)
plot_chemical_space(
writer, X_pool, X_train, iteration + 1
) #L
if len(smiles_pool) == 0:
print("Molecule pool is empty. "
"Terminating the active learning loop.")
break
writer.close()
return pd.DataFrame(results)The loop implementation brings initialization, acquisition, oracle calls, retraining, and metric logging together. section 9.2.7
Track the number of known top-scoring molecules recovered and inspect how selections cover chemical space. Compare acquisition and initialization strategies under comparable budgets; a promising score alone does not establish that a molecule will work as a drug. section 9.2.7 section 9.0
The same pattern can guide lead optimization by replacing docking with free energy calculations as the oracle. More broadly, experimental results can feed back into models that prioritize the next compounds to test. section 9.3 section 9.3.1 section 13.0





