Skip to content

openpkflow.ml

Experimental ML surrogate for PK profiles. Not validated for regulatory use.

Experimental

This module is marked EXPERIMENTAL. Do not use outputs in regulatory submissions. Results have not been validated against reference PK software.

Public API

Symbol Type Description
PKSurrogate class MLP surrogate for 1-cmt oral PK profiles
PKSurrogate.from_1cmt_oral(n_samples, ...) classmethod Factory: generates data, trains, returns fitted surrogate
PKSurrogate.predict(time, dose, CL_F, Vz_F, ka) method Predict concentration array

Install

pip install openpkflow[ml]

Example

from openpkflow.ml import PKSurrogate

surrogate = PKSurrogate.from_1cmt_oral(n_samples=5000, seed=42)

import numpy as np
times = np.linspace(0, 24, 100)
C = surrogate.predict(times, dose=100.0, CL_F=5.0, Vz_F=20.0, ka=1.0)

Architecture

  • Input features: (time, dose, CL_F, Vz_F, ka) — z-score normalised
  • Default hidden layers: (64, 64), tanh activations
  • Trained with Adam, MSE loss on log-scale concentrations
  • Training data generated by openpkflow.sim.c_1cmt_oral() (analytically exact)

Use cases

Appropriate for rapid sensitivity analysis, uncertainty propagation, or parameter screening where approximate predictions are acceptable. Not a replacement for the analytical sim module.