Metadata-Version: 2.4
Name: pytmle
Version: 0.3.0
Summary: A Flexible Python Implementation of Targeted Estimation for Survival and Competing Risks Analysis
License: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: mlflow>=3.1.0
Requires-Dist: numpy>=1.22.3
Requires-Dist: pandas>=1.3.4
Requires-Dist: pandoc>=2.4
Requires-Dist: pycox
Requires-Dist: scikit-learn>=1.2.2
Requires-Dist: scikit-survival>=0.21.0
Requires-Dist: seaborn>=0.11.2
Requires-Dist: tqdm>=4.67.1
Provides-Extra: dev
Requires-Dist: ipykernel>=6.29.5; extra == "dev"
Requires-Dist: pytest>=8.3.5; extra == "dev"
Requires-Dist: torch>=2.6.0; extra == "dev"
Dynamic: license-file

# 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`:

```bash
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`:

```pytmle
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](https://pytmle.readthedocs.io/) for the detailed API reference and tutorial notebooks.
