ML-Enhanced Pharmacometrics Toolkit
Project description
pharmacoml
ML-Enhanced Pharmacometrics Toolkit for Python
pharmacoml brings machine learning methods to pharmacometrics workflows — usable with or without NONMEM.
Why pharmacoml?
Existing ML tools for pharmacometrics (pyDarwin, shap-cov) require a NONMEM license. pharmacoml is estimation-tool agnostic — it works with empirical Bayes estimates from NONMEM, nlmixr2, Monolix, Pumas, or manual estimation.
Quick Start
The recommended default workflow is the hybrid preselection path: explainable boosting with benchmark-approved recursive elimination for discovery, augmented adaptive LASSO for confirmation, optional stochastic-gates and symbolic-structure confirmation, and tiered output for downstream SCM/backward elimination.
from pharmacoml.covselect import HybridScreener
import pandas as pd
ebes = pd.read_csv("individual_parameters.csv")
covs = pd.read_csv("covariates.csv")
report = HybridScreener(include_scm=True).fit(ebes, covs)
report.confirmed_covariates() # recommended daily-use answer
report.core_covariates() # strongest ML signals
report.candidate_covariates() # broader shortlist for exploration
report.scm_covariates() # explicit SCM-confirmed set
report.proxy_groups()
print(report.to_nonmem_candidates())
Experimental Consensus
For broader research comparisons, the experimental namespace exposes a curated multi-model consensus workflow. It runs a scikit-first model set by default, aggregates top-k covariate frequency across model families, and lets you compare that consensus against the main hybrid workflow.
from pharmacoml.covselect.experimental import MultiModelConsensusScreener
report = MultiModelConsensusScreener(
top_k=3,
n_bootstrap=8,
include_neural=False,
).fit(ebes, covs)
report.consensus_covariates()
report.selection_frequency_table()
Benchmark-Gated Development
pharmacoml now carries a release benchmark suite for default-calibration work:
pheno(Pharmpy phenobarbital example)Eleveld/Wahlquistpublic propofol dataggPMXMonolix theophylline exampleAsiimwe-stylecorrelated-covariate simulationShap-Cov-stylecollinear simulation- optional
Kekicpublic synthetic scenarios when the repo is available locally
The benchmark harness compares the default hybrid workflow against optional
variants such as RFE and shrinkage-awareness. The current benchmark-approved
defaults are rfe_enabled=True and shrinkage_awareness=True.
PYTHONPATH=. python benchmarks/run_public_benchmarks.py --check
By default, that command now writes a reusable report bundle to
benchmarks/reports/fixed_public/:
public_benchmark_report.mdpublic_benchmark_summary.csvpublic_benchmark_details.csvpublic_benchmark_report.json
Use --no-report to skip artifact generation, or --report-dir <path> to
write the bundle somewhere else.
Optional Advanced Backends
pharmacoml now includes:
- a nonlinear stochastic-gates engine (
STG) with an input-gated MLP body - symbolic covariate structure search with three backends:
basis(default, lightweight pharmacometric basis search)gplearn(optional true symbolic regression)pysr(optional true symbolic regression; install manually)
Example:
report = HybridScreener(
include_symbolic=True,
symbolic_backend="basis",
include_stg=True,
).fit(ebes, covs)
Install optional extras:
pip install -e ".[dev,dl,symbolic]"
Installation
git clone https://github.com/s-rani1/pharmacoml.git
cd pharmacoml
pip install -e ".[dev]"
Docs
Static docs pages live in docs/ and can be used directly on GitHub Pages:
docs/index.htmldocs/tutorial.htmldocs/benchmarks.html
Modules
| Module | Description | Status |
|---|---|---|
pharmacoml.covselect |
Hybrid ML-assisted covariate screening with SCM bridge | 🚧 Active |
pharmacoml.expose |
Exposure-response with interpretable ML | 📋 Planned |
pharmacoml.trajpk |
PK/PD trajectory clustering | 📋 Planned |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pharmacoml-0.1.1.tar.gz.
File metadata
- Download URL: pharmacoml-0.1.1.tar.gz
- Upload date:
- Size: 71.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c7bb462651c86ebc9abaf6f4dfa93ecba022158ab3ed0d434bb9415af9961d8
|
|
| MD5 |
a1f199873416740f2de96e44fd40d695
|
|
| BLAKE2b-256 |
a823dfacb106070926f43c8b639b0d5e02b613f14cc97d81a014e2fa24df0195
|
File details
Details for the file pharmacoml-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pharmacoml-0.1.1-py3-none-any.whl
- Upload date:
- Size: 80.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b60bada94efd910fe63586644e8b8687eb6d26145e33cc3eb174b3aa3803c6d6
|
|
| MD5 |
f140b352d874573bb3b31a6b0a8c195d
|
|
| BLAKE2b-256 |
51590a3061b86c5cedfa2c8b7abbca7dd477848fd86e1f14a9c6e33b1c365643
|