Bayesian Optimization troubleshooting
Clear divergences by raising target_accept, read an r_hat_max above 1.01 or a low ess_min, and fix a PK fit whose pk_model or administration is wrong.
bayesiantroubleshooting
Common issues and fixes
The tool fits your model with PyMC and samples the posterior by MCMC, variational inference, or pathfinder. Most issues trace back to convergence, data formatting, or a mismatch between the model type and your data's shape.
Divergences reported
- A nonzero
divergencescount in the diagnostics means the sampler couldn't reliably explore part of the posterior geometry. - Raise
target_accept(try 0.95, then 0.99) and increasenum_tune. - Persistent divergences after that usually mean the model needs reparameterizing (for example, a hierarchical model with a funnel-shaped posterior) rather than more tuning.
High R-hat / non-convergence
r_hat_maxwell above 1.01 means the chains disagree and the posterior summary isn't trustworthy yet.- Increase
num_samplesandnum_tune. - Increase
num_chainsso the R-hat comparison itself is more informative. - Check that
predictor_columnsdon't contain near-duplicate or highly collinear columns, which can produce a poorly identified posterior.
Low effective sample size (ESS)
ess_minfar belownum_samples * num_chainsmeans the chains are autocorrelated; the posterior is effectively based on fewer independent draws than it looks.- Increase
num_samples, or switchlikelihood/link_functionif the current combination is a poor match for your outcome's distribution.
Data formatting errors
data_urlmust resolve to a readable CSV or Parquet file.outcome_columnand every entry inpredictor_columnsmust exist in the file and be numeric — encode categorical predictors before submitting.- For
hierarchical,group_columnmust be present; forpkpd,time_column,concentration_column, anddose_columnmust all be present.
PK/PD model fit looks wrong
- Confirm
administrationmatches how the dose was actually given (iv_bolus,iv_infusion, ororal) — the compartmental equations differ by route. - Confirm
pk_model(one/two/three compartment) matches the shape of your concentration-time curve; an under-specified model (e.g. one-compartment for clearly biphasic data) will show poor PPC overlap and often more divergences. - For a population fit, verify
subject_columnuniquely identifies each individual, and thatrandom_effectsnames real, present parameters for the chosenpk_model.
Slow jobs
- MCMC (
inference_method: "mcmc") is the most reliable but the slowest of the three inference methods; for a faster first look, trypathfinderorvariational, understanding both trade some posterior accuracy for speed. - Large
num_chains×num_samplescombinations extend runtime roughly linearly; start at the defaults and raise them only if diagnostics call for it. - Jobs run without a GPU; estimated duration is 2–30 minutes depending on model complexity and data size.
LOO/WAIC missing or NaN
- Confirm
compute_loo/compute_waicare enabled (both defaulttrue). - A NaN or warning on LOO usually means some observations have very high Pareto-k diagnostics internally — this points to influential outliers or a poorly specified likelihood, not a bug to retry around.
Still stuck?
- Share the job ID,
model_type, and the diagnostics block (divergences,r_hat_max,ess_min). - Note the sampler settings used (
inference_method,num_chains,num_samples,num_tune,target_accept). - For a PK/PD job, include
pk_model,administration, and whetherpopulation_modelwas set.
Read next
Was this page helpful?
Bayesian Optimization quickstart
Point at a CSV, pick regression, hierarchical, dose_response or pkpd, set the outcome and predictors, then read r_hat and divergences before the posterior.
Databases overview
Search ChEMBL bioactivity, PubChem, ZINC, UniProt, PubMed and ClinicalTrials.gov — the fastest first step before you run a model.