---
title: Bayesian Optimization quickstart
description: 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.
tags:
  - bayesian
  - quickstart
---

You have a dataset and want parameter estimates with honest uncertainty rather than a single point value. This walks through fitting a model in a few steps: point at your data, pick a model type, set the columns, submit, and read the posterior.

## Quick model fit with .bloom* platform

The tool fits your chosen model with PyMC, sampling the posterior by MCMC (default), variational inference, or pathfinder, and returns a parameter summary with credible intervals plus convergence diagnostics.

## Step-by-step workflow

### 1. Point at your data

Provide `data_url` — a CSV or Parquet file reachable by the job. Include the outcome column and every predictor column you want in the model.

### 2. Choose a model type

- **regression** — for a standard Bayesian linear/generalized-linear fit. Pick `link_function: "log"` or `"logit"` for a GLM.
- **hierarchical** — add `group_column` to pool information across groups (e.g. batch, site, or animal).
- **dose_response** — for a dose-response curve.
- **pkpd** — set `pk_model` (`one_compartment` / `two_compartment` / `three_compartment`), `administration` (`iv_bolus` / `iv_infusion` / `oral`), and `time_column` / `concentration_column` / `dose_column`. Add `subject_column` and `population_model: true` for a population (mixed-effects) PK fit.
- **time_series** or **mixture** — set `time_column`, or leave defaults for a mixture over the outcome.
- **custom** — supply your own `model_code` (PyMC).

### 3. Set the outcome and predictors

- `outcome_column`: the dependent variable.
- `predictor_columns`: one or more predictor columns.
- Leave `likelihood` at `normal` unless your outcome is a count (`poisson`), binary (`binomial`), or a proportion (`beta`).

### 4. Leave the sampler at defaults, or tune it

Defaults (`num_chains: 4`, `num_samples: 2000`, `num_tune: 1000`, `target_accept: 0.9`) work for most models. Raise `target_accept` toward 0.99 if the diagnostics later report divergences.

### 5. Submit and wait

Jobs run without a GPU and typically complete in 2–30 minutes depending on model complexity and chain length.

### 6. Read the results

- Open `posterior_summary_csv` and check `r_hat` is close to 1.0 and `divergences` is 0 before trusting any parameter's mean/HDI.
- For a PK/PD fit, read the compartmental parameters (e.g. `CL`, `V`) the same way.
- Use `loo`/`waic` from `diagnostics_json` to compare against a second model fit on the same data, if you ran more than one.

## Common scenarios

### Dose-response fit
1. Set `model_type: "dose_response"`, `outcome_column` to the measured response, `predictor_columns` to the dose.
2. Submit and read the fitted curve parameters and their credible intervals.

### Population PK model
1. Set `model_type: "pkpd"`, `pk_model: "two_compartment"`, `administration: "oral"`.
2. Set `time_column`, `concentration_column`, `dose_column`, and `subject_column`.
3. Set `population_model: true` and, if you want random effects on parameters other than clearance and volume, override `random_effects`.

### Hierarchical regression
1. Set `model_type: "hierarchical"`, `group_column` to the grouping variable.
2. Read the group-level and population-level parameter rows separately in the summary.

## Read next
