PyTMLE
PyTMLE is a flexible Python implementation of the Targeted Maximum Likelihood Estimation (TMLE) framework for survival and competing risks outcomes.
The package can be installed from PyPI, for example using pip:
pip install pytmle
It is designed to be easy to use with default models for initial estimates of nuisance functions which are applied in a super learner framework. With a pandas dataframe containing event times, indicators, and (binary) treatment group information in specified columns, it is straight-forward to fit a main PyTMLE class object and get predictions and plots for selected target_times:
from pytmle import PyTMLE
tmle = PyTMLE(df,
col_event_times="time",
col_event_indicator="status",
col_group="group",
target_times=target_times)
tmle.plot(type="risks") # get estimated counterfactual CIF, or set to "rr" or "rd" for ATE estimates based on RR or RD
pred = tmle.predict(type="risks") # store estimates in a data frame
However, it also allows for custom models to be used for the initial estimates or even passing initial estimates directly to the second TMLE stage.
Have a look at the package's Read the Docs page for the detailed API reference and tutorial notebooks.
Metadata
Release files for pytmle 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytmle-0.6.0.tar.gz | 50.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytmle-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 101.2 kB
Release files / pytmle-0.6.0.tar.gz
| Download URL | pytmle-0.6.0.tar.gz |
|---|---|
| Size | 50.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
911749954a4b27c72380878efabcfcb4c81b4776a2ac67d4a98f498feb26cd6a
|
|
BLAKE2b-256 checksum How to use checksums |
9711de8c08dea8077f1cf1242d3abe48fb5390124e14ed5e60e28f678841fd69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / pytmle-0.6.0-py3-none-any.whl
| Download URL | pytmle-0.6.0-py3-none-any.whl |
|---|---|
| Size | 51.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbfa3fc1cb6e085a4adb613ab6d62e7b4a79896fb140f2b9a38d02d51d8ce432
|
|
BLAKE2b-256 checksum How to use checksums |
2f13ac51b3192ee524c202c9ff8b44ac7836c89377eb8c7cd5a69b618246a770
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log