DOCAS¶
Dose-response curve alignment via synthetic augmentation.
DOCAS makes any fit / predict regressor follow a stated target dose-response
curve (DRC) when its dose input changes, without changing the model or its loss. It
trains the model on synthetic what-if rows only, labelled with the baseline’s forecast
at zero dose (the residual r) plus the curve’s effect of a probe dose, and gives
r to the model as an extra input. The alignment error (AE) is the RMSE between the
model’s centred ICE curves and the target DRC, in the units of the outcome.
The target DRC is a stated reference, for example a population curve, not an individual ground truth. The response is only learned within the dose range of the synthetic rows.
Install¶
pip install docas
Quick start¶
import numpy as np
from sklearn.ensemble import HistGradientBoostingRegressor
from docas import Aligner
from docas.datasets import make_synthetic_glucose
data = make_synthetic_glucose(n=2_000, seed=0)
X = data.X[:, 1:] # drop glucose, which is why the dose was given
result = Aligner(
HistGradientBoostingRegressor(max_depth=3, max_iter=80, random_state=0),
treatment_idx=0,
target=lambda u: data.true_effect * data.span * np.asarray(u, float),
span=data.span,
synth_ratio=1.0,
jitter={1: 5.0},
).fit(X, data.y)
print(result.alignment_error)
print(result.curve(X))
You can change the model, the target curve, the synthetic budget (synth_ratio),
and the context noise (jitter).