{"id":19631735,"url":"https://github.com/vanderschaarlab/temporai","last_synced_at":"2025-10-07T12:00:15.119Z","repository":{"id":114909858,"uuid":"583731293","full_name":"vanderschaarlab/temporai","owner":"vanderschaarlab","description":"TemporAI: ML-centric Toolkit for Medical Time Series","archived":false,"fork":false,"pushed_at":"2023-12-14T16:01:53.000Z","size":4747,"stargazers_count":114,"open_issues_count":26,"forks_count":24,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-10T03:54:22.474Z","etag":null,"topics":["automl","machine-learning","medicine","time-series"],"latest_commit_sha":null,"homepage":"https://www.temporai.vanderschaar-lab.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanderschaarlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-30T18:16:02.000Z","updated_at":"2025-04-01T12:43:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"843388f4-603a-497e-865d-ccdc8d5664f8","html_url":"https://github.com/vanderschaarlab/temporai","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanderschaarlab%2Ftemporai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanderschaarlab%2Ftemporai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanderschaarlab%2Ftemporai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanderschaarlab%2Ftemporai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanderschaarlab","download_url":"https://codeload.github.com/vanderschaarlab/temporai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154999,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automl","machine-learning","medicine","time-series"],"created_at":"2024-11-11T12:11:15.622Z","updated_at":"2025-10-07T12:00:10.008Z","avatar_url":"https://github.com/vanderschaarlab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- These are examples of badges you might want to add to your README:\n     please update the URLs accordingly\n\n[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/temporai.svg)](https://anaconda.org/conda-forge/temporai)\n[![Monthly Downloads](https://pepy.tech/badge/temporai/month)](https://pepy.tech/project/temporai)\n--\u003e\n\n\u003c!-- exclude_docs --\u003e\n[![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial04_prediction.ipynb)\n[![Documentation Status](https://readthedocs.org/projects/temporai/badge/?version=latest)](https://temporai.readthedocs.io/en/latest/?badge=latest)\n\n[![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/release/python-370/)\n[![PyPI-Server](https://img.shields.io/pypi/v/temporai?color=blue)](https://pypi.org/project/temporai/)\n[![Downloads](https://static.pepy.tech/badge/temporai)](https://pepy.tech/project/temporai)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE.txt)\n\n[![Tests](https://github.com/vanderschaarlab/temporai/actions/workflows/test.yml/badge.svg)](https://github.com/vanderschaarlab/temporai/actions/workflows/test.yml)\n[![Tests](https://github.com/vanderschaarlab/temporai/actions/workflows/test_full.yml/badge.svg)](https://github.com/vanderschaarlab/temporai/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/vanderschaarlab/temporai/branch/main/graph/badge.svg?token=FCKO12SND7)](https://codecov.io/gh/vanderschaarlab/temporai)\n\n[![arXiv](https://img.shields.io/badge/arXiv-2301.12260-b31b1b.svg)](https://arxiv.org/abs/2301.12260)\n[![slack](https://img.shields.io/badge/chat-on%20slack-purple?logo=slack)](https://join.slack.com/t/vanderschaarlab/shared_invite/zt-1u2rmhw06-sHS5nQDMN3Ka2Zer6sAU6Q)\n[![about](https://img.shields.io/badge/about-The%20van%20der%20Schaar%20Lab-blue)](https://www.vanderschaar-lab.com/)\n\u003c!-- exclude_docs_end --\u003e\n\n# \u003cimg src=\"docs/assets/TemporAI_Logo_Icon.png\" height=25\u003e TemporAI\n\n\u003c!-- exclude_docs --\u003e\n\u003e **⚗️ Status:** This project is still in *alpha*, and the API may change without warning.  \n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n:::{important}\n**Status:** This project is still in *alpha*, and the API may change without warning.  \n:::\ninclude_docs_end --\u003e\n\n\n## 📃 Overview\n\n*TemporAI* is a Machine Learning-centric time-series library for medicine.  The tasks that are currently of focus in TemporAI are: time-to-event (survival) analysis with time-series data, treatment effects (causal inference) over time, and time-series prediction. Data preprocessing methods, including missing value imputation for static and temporal covariates, are provided. AutoML tools for hyperparameter tuning and pipeline selection are also available.\n\n### How is TemporAI unique?\n\n* **🏥 Medicine-first:** Focused on use cases for medicine and healthcare, such as temporal treatment effects, survival analysis over time, imputation methods, models with built-in and post-hoc interpretability, ... See [methods](./#-methods).\n* **🏗️ Fast prototyping:** A plugin design allowing for on-the-fly integration of new methods by the users.\n* **🚀 From research to practice:** Relevant novel models from research community adapted for practical use.\n* **🌍 A healthcare ecosystem vision:** A range of interactive demonstration apps, new medical problem settings, interpretability tools, data-centric tools etc. are planned.\n\n### Key concepts\n\n\u003cdiv align=\"center\"\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003cimg src=\"docs/assets/Conceptual.png\" alt=\"key concepts\"\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n\u003cimg src=\"docs/assets/Conceptual.png\" alt=\"key concepts\"\u003e\ninclude_docs_end --\u003e\n\n\u003c/div\u003e\n\n\n\n## 🚀 Installation\n\n### Instal with `pip`\n\nFrom [the Python Package Index (PyPI)](https://pypi.org/):\n```bash\n$ pip install temporai\n```\n\nOr from source:\n```bash\n$ git clone https://github.com/vanderschaarlab/temporai.git\n$ cd temporai\n$ pip install .\n```\n\n### Install in a [conda](https://docs.conda.io/en/latest/) environment\n\nWhile have not yet published TemporAI on `conda-forge`, you can still install TemporAI in your conda environment using `pip` as follows:\n\nCreate and activate conda environment as normal:\n```bash\n$ conda create -n \u003cmy_environment\u003e\n$ conda activate \u003cmy_environment\u003e\n```\n\nThen install inside your `conda` environment with pip:\n```bash\n$ pip install temporai\n```\n\n\n## 💥 Sample Usage\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n(▶️ Expand to view the sections below.)\n\u003c!-- exclude_docs_end --\u003e\n\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eList the available plugins\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* List the available plugins\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* List the available plugins\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor import plugin_loader\n\nprint(plugin_loader.list())\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eUse a time-to-event (survival) analysis model\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Use a time-to-event (survival) analysis model\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Use a time-to-event (survival) analysis model\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor import plugin_loader\n\n# Load a time-to-event dataset:\ndataset = plugin_loader.get(\"time_to_event.pbc\", plugin_type=\"datasource\").load()\n\n# Initialize the model:\nmodel = plugin_loader.get(\"time_to_event.dynamic_deephit\")\n\n# Train:\nmodel.fit(dataset)\n\n# Make risk predictions:\nprediction = model.predict(dataset, horizons=[0.25, 0.50, 0.75])\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eUse a temporal treatment effects model\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Use a temporal treatment effects model\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Use a temporal treatment effects model\ninclude_pypi_end --\u003e\n\n```python\nimport numpy as np\n\nfrom tempor import plugin_loader\n\n# Load a dataset with temporal treatments and outcomes:\ndataset = plugin_loader.get(\n    \"treatments.temporal.dummy_treatments\",\n    plugin_type=\"datasource\",\n    temporal_covariates_missing_prob=0.0,\n    temporal_treatments_n_features=1,\n    temporal_treatments_n_categories=2,\n).load()\n\n# Initialize the model:\nmodel = plugin_loader.get(\"treatments.temporal.regression.crn_regressor\", epochs=20)\n\n# Train:\nmodel.fit(dataset)\n\n# Define target variable horizons for each sample:\nhorizons = [\n    tc.time_indexes()[0][len(tc.time_indexes()[0]) // 2 :] for tc in dataset.time_series\n]\n\n# Define treatment scenarios for each sample:\ntreatment_scenarios = [\n    [np.asarray([1] * len(h)), np.asarray([0] * len(h))] for h in horizons\n]\n\n# Predict counterfactuals:\ncounterfactuals = model.predict_counterfactuals(\n    dataset,\n    horizons=horizons,\n    treatment_scenarios=treatment_scenarios,\n)\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eUse a missing data imputer\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Use a missing data imputer\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Use a missing data imputer\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor import plugin_loader\n\ndataset = plugin_loader.get(\n    \"prediction.one_off.sine\", plugin_type=\"datasource\", with_missing=True\n).load()\nstatic_data_n_missing = dataset.static.dataframe().isna().sum().sum()\ntemporal_data_n_missing = dataset.time_series.dataframe().isna().sum().sum()\n\nprint(static_data_n_missing, temporal_data_n_missing)\nassert static_data_n_missing \u003e 0\nassert temporal_data_n_missing \u003e 0\n\n# Initialize the model:\nmodel = plugin_loader.get(\"preprocessing.imputation.temporal.bfill\")\n\n# Train:\nmodel.fit(dataset)\n\n# Impute:\nimputed = model.transform(dataset)\ntemporal_data_n_missing = imputed.time_series.dataframe().isna().sum().sum()\n\nprint(static_data_n_missing, temporal_data_n_missing)\nassert temporal_data_n_missing == 0\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eUse a one-off classifier (prediction)\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Use a one-off classifier (prediction)\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Use a one-off classifier (prediction)\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor import plugin_loader\n\ndataset = plugin_loader.get(\"prediction.one_off.sine\", plugin_type=\"datasource\").load()\n\n# Initialize the model:\nmodel = plugin_loader.get(\"prediction.one_off.classification.nn_classifier\", n_iter=50)\n\n# Train:\nmodel.fit(dataset)\n\n# Predict:\nprediction = model.predict(dataset)\n```\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eUse a temporal regressor (forecasting)\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Use a temporal regressor (forecasting)\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Use a temporal regressor (forecasting)\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor import plugin_loader\n\n# Load a dataset with temporal targets.\ndataset = plugin_loader.get(\n    \"prediction.temporal.dummy_prediction\",\n    plugin_type=\"datasource\",\n    temporal_covariates_missing_prob=0.0,\n).load()\n\n# Initialize the model:\nmodel = plugin_loader.get(\"prediction.temporal.regression.seq2seq_regressor\", epochs=10)\n\n# Train:\nmodel.fit(dataset)\n\n# Predict:\nprediction = model.predict(dataset, n_future_steps=5)\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eBenchmark models, time-to-event task\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Benchmark models, time-to-event task\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Benchmark models, time-to-event task\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor.benchmarks import benchmark_models\nfrom tempor import plugin_loader\nfrom tempor.methods.pipeline import pipeline\n\ntestcases = [\n    (\n        \"pipeline1\",\n        pipeline(\n            [\n                \"preprocessing.scaling.temporal.ts_minmax_scaler\",\n                \"time_to_event.dynamic_deephit\",\n            ]\n        )({\"ts_coxph\": {\"n_iter\": 100}}),\n    ),\n    (\n        \"plugin1\",\n        plugin_loader.get(\"time_to_event.dynamic_deephit\", n_iter=100),\n    ),\n    (\n        \"plugin2\",\n        plugin_loader.get(\"time_to_event.ts_coxph\", n_iter=100),\n    ),\n]\ndataset = plugin_loader.get(\"time_to_event.pbc\", plugin_type=\"datasource\").load()\n\naggr_score, per_test_score = benchmark_models(\n    task_type=\"time_to_event\",\n    tests=testcases,\n    data=dataset,\n    n_splits=2,\n    random_state=0,\n    horizons=[2.0, 4.0, 6.0],\n)\n\nprint(aggr_score)\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eSerialization\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* Serialization\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* Serialization\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor.utils.serialization import load, save\nfrom tempor import plugin_loader\n\n# Initialize the model:\nmodel = plugin_loader.get(\"prediction.one_off.classification.nn_classifier\", n_iter=50)\n\nbuff = save(model)  # Save model to bytes.\nreloaded = load(buff)  # Reload model.\n\n# `save_to_file`, `load_from_file` also available in the serialization module.\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eAutoML - search for the best pipeline for your task\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n* AutoML - search for the best pipeline for your task\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n* AutoML - search for the best pipeline for your task\ninclude_pypi_end --\u003e\n\n```python\nfrom tempor.automl.seeker import PipelineSeeker\n\ndataset = plugin_loader.get(\"prediction.one_off.sine\", plugin_type=\"datasource\").load()\n\n# Specify the AutoML pipeline seeker for the task of your choice, providing candidate methods,\n# metric, preprocessing steps etc.\nseeker = PipelineSeeker(\n    study_name=\"my_automl_study\",\n    task_type=\"prediction.one_off.classification\",\n    estimator_names=[\n        \"cde_classifier\",\n        \"ode_classifier\",\n        \"nn_classifier\",\n    ],\n    metric=\"aucroc\",\n    dataset=dataset,\n    return_top_k=3,\n    num_iter=100,\n    tuner_type=\"bayesian\",\n    static_imputers=[\"static_tabular_imputer\"],\n    static_scalers=[],\n    temporal_imputers=[\"ffill\", \"bfill\"],\n    temporal_scalers=[\"ts_minmax_scaler\"],\n)\n\n# The search will return the best pipelines.\nbest_pipelines, best_scores = seeker.search()  # doctest: +SKIP\n```\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\n\n## 📖 Tutorials\n\n### Data\n\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial01_data_format.ipynb) - [Data Format](./tutorials/data/tutorial01_data_format.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial02_datasets.ipynb) - [Datasets](./tutorials/data/tutorial02_datasets.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial03_datasources.ipynb) - [Data Loaders](./tutorials/data/tutorial03_datasources.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial04_data_splitting.ipynb) - [Data Splitting](./tutorials/data/tutorial04_data_splitting.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial05_other_data_formats.ipynb) - [Other Data Formats](./tutorials/data/tutorial05_other_data_formats.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/data/tutorial06_mimic_use_case.ipynb) - [MIMIC Use Case](./tutorials/data/tutorial06_mimic_use_case.ipynb)\n\n### User Guide\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial01_plugins.ipynb) - [Plugins](./tutorials/usage/tutorial01_plugins.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial02_imputation.ipynb) - [Imputation](./tutorials/usage/tutorial02_imputation.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial03_scaling.ipynb) - [Scaling](./tutorials/usage/tutorial03_scaling.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial04_prediction.ipynb) - [Prediction](./tutorials/usage/tutorial04_prediction.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial05_time_to_event.ipynb) - [Time-to-event Analysis](./tutorials/usage/tutorial05_time_to_event.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial06_treatments.ipynb) - [Treatment Effects](./tutorials/usage/tutorial06_treatments.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial07_pipeline.ipynb) - [Pipeline](./tutorials/usage/tutorial07_pipeline.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial08_benchmarks.ipynb) - [Benchmarks](./tutorials/usage/tutorial08_benchmarks.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/usage/tutorial09_automl.ipynb) - [AutoML](./tutorials/usage/tutorial09_automl.ipynb)\n\n### Extending TemporAI\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/extending/tutorial01_custom_method.ipynb) - [Writing a Custom Method Plugin](./tutorials/extending/tutorial01_custom_method.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/extending/tutorial02_testing_custom_method.ipynb) - [Testing a Custom Method Plugin](./tutorials/extending/tutorial02_testing_custom_method.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/extending/tutorial03_custom_datasource.ipynb) - [Writing a Custom Data Source Plugin](./tutorials/extending/tutorial03_custom_datasource.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/extending/tutorial04_custom_metric.ipynb) - [Writing a Custom Metric Plugin](./tutorials/extending/tutorial04_custom_metric.ipynb)\n- [![Test In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vanderschaarlab/temporai/blob/main/tutorials/extending/tutorial05_custom_dataformat.ipynb) - [Writing a Custom Data Format](./tutorials/extending/tutorial05_custom_dataformat.ipynb)\n\n\n\n\u003c!-- exclude_docs --\u003e\n## 📘 Documentation\n\nSee the full project documentation [here](https://temporai.readthedocs.io/en/latest/).\n\n#### Note on documentation versions:\n- If you have installed TemporAI from PyPI, you should refer to the *stable* documentation.\n- If you have installed TemporAI from source, you should refer to the *latest* documentation.\n\nSee the [**Instal with `pip`**](https://github.com/vanderschaarlab/temporai#instal-with-pip) section for reference.\n\u003c!-- exclude_docs_end --\u003e\n\n\n\n\u003c!--- Reusable ---\u003e\n  [van der Schaar Lab]:    https://www.vanderschaar-lab.com/\n  [docs]:                  https://temporai.readthedocs.io/en/latest/\n\u003c!-- exclude_docs --\u003e\n  [docs/user_guide]:       https://temporai.readthedocs.io/en/latest/user_guide/index.html\n\u003c!-- exclude_docs_end --\u003e\n\n\n\n## 🌍 TemporAI Ecosystem (*Experimental*)\n\nWe provide additional tools in the TemporAI ecosystem, which are in active development, and are currently (very) experimental. Suggestions and contributions are welcome!\n\nThese include:\n- [`temporai-clinic`](https://github.com/vanderschaarlab/temporai-clinic): A web app tool for interacting and visualising TemporAI models, data, and predictions.\n- [`temporai-mivdp`](https://github.com/vanderschaarlab/temporai-mivdp): A [MIMIC-IV-Data-Pipeline](https://github.com/healthylaife/MIMIC-IV-Data-Pipeline) adaptation for TemporAI.\n\n\n\n\u003c!-- include_docs\n{#methods}include_docs_end --\u003e\n## 🔑 Methods\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n(▶️ Expand to view the sections below.)\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eTime-to-Event (survival) analysis over time\u003c/h3\u003e\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n### Time-to-Event (survival) analysis over time\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n### Time-to-Event (survival) analysis over time\ninclude_pypi_end --\u003e\n\nRisk estimation given event data (category: `time_to_event`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `dynamic_deephit` | Dynamic-DeepHit incorporates the available longitudinal data comprising various repeated measurements (rather than only the last available measurements) in order to issue dynamically updated survival predictions | [Paper](https://pubmed.ncbi.nlm.nih.gov/30951460/) |\n| `ts_coxph` | Create embeddings from the time series and use a CoxPH model for predicting the survival function| --- |\n| `ts_xgb` | Create embeddings from the time series and use a SurvivalXGBoost model for predicting the survival function| --- |\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eTreatment effects\u003c/h3\u003e\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n### Treatment effects\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n### Treatment effects\ninclude_pypi_end --\u003e\n\n#### One-off\nTreatment effects estimation where treatments are a one-off event.\n\n\u003c!--\n* Classification on the outcomes (category: `treatments.one_off.classification`)\n--\u003e\n\n* Regression on the outcomes (category: `treatments.one_off.regression`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `synctwin_regressor` | SyncTwin is a treatment effect estimation method tailored for observational studies with longitudinal data, applied to the LIP setting: Longitudinal, Irregular and Point treatment.  | [Paper](https://proceedings.neurips.cc/paper/2021/hash/19485224d128528da1602ca47383f078-Abstract.html) |\n\n#### Temporal\nTreatment effects estimation where treatments are temporal (time series).\n\n* Classification on the outcomes (category: `treatments.temporal.classification`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `crn_classifier` | The Counterfactual Recurrent Network (CRN), a sequence-to-sequence model that leverages the available patient observational data to estimate treatment effects over time. | [Paper](https://arxiv.org/abs/2002.04083) |\n\n* Regression on the outcomes (category: `treatments.temporal.regression`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `crn_regressor` | The Counterfactual Recurrent Network (CRN), a sequence-to-sequence model that leverages the available patient observational data to estimate treatment effects over time. | [Paper](https://arxiv.org/abs/2002.04083) |\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003ePrediction\u003c/h3\u003e\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n### Prediction\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n### Prediction\ninclude_pypi_end --\u003e\n\n#### One-off\nPrediction where targets are static.\n\n* Classification (category: `prediction.one_off.classification`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `nn_classifier` | Neural-net based classifier. Supports multiple recurrent models, like RNN, LSTM, Transformer etc.  | --- |\n| `ode_classifier` | Classifier based on ordinary differential equation (ODE) solvers.  | --- |\n| `cde_classifier` | Classifier based Neural Controlled Differential Equations for Irregular Time Series.  | [Paper](https://arxiv.org/abs/2005.08926) |\n| `laplace_ode_classifier` | Classifier based Inverse Laplace Transform (ILT) algorithms implemented in PyTorch.  | [Paper](https://arxiv.org/abs/2206.04843) |\n\n* Regression (category: `prediction.one_off.regression`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `nn_regressor` | Neural-net based regressor. Supports multiple recurrent models, like RNN, LSTM, Transformer etc.  | --- |\n| `ode_regressor` | Regressor based on ordinary differential equation (ODE) solvers.  | --- |\n| `cde_regressor` | Regressor based Neural Controlled Differential Equations for Irregular Time Series.  | [Paper](https://arxiv.org/abs/2005.08926)\n| `laplace_ode_regressor` | Regressor based Inverse Laplace Transform (ILT) algorithms implemented in PyTorch.  | [Paper](https://arxiv.org/abs/2206.04843) |\n\n#### Temporal\nPrediction where targets are temporal (time series).\n\n* Classification (category: `prediction.temporal.classification`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `seq2seq_classifier` | Seq2Seq prediction, classification | --- |\n\n* Regression (category: `prediction.temporal.regression`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `seq2seq_regressor` | Seq2Seq prediction, regression | --- |\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003ePreprocessing\u003c/h3\u003e\u003c/summary\u003e\n\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\u003c!-- include_docs\n### Preprocessing\ninclude_docs_end --\u003e\n\u003c!-- include_pypi\n### Preprocessing\ninclude_pypi_end --\u003e\n\n#### Feature Encoding\n\n* Static data (category: `preprocessing.encoding.static`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `static_onehot_encoder` | One-hot encode categorical static features | --- |\n\n* Temporal data (category: `preprocessing.encoding.temporal`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `ts_onehot_encoder` | One-hot encode categorical time series features | --- |\n\n#### Imputation\n\n* Static data (category: `preprocessing.imputation.static`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `static_tabular_imputer` | Use any method from [HyperImpute](https://github.com/vanderschaarlab/hyperimpute) (HyperImpute, Mean, Median, Most-frequent, MissForest, ICE, MICE, SoftImpute, EM, Sinkhorn, GAIN, MIRACLE, MIWAE) to impute the static data | [Paper](https://arxiv.org/abs/2206.07769) |\n\n* Temporal data (category: `preprocessing.imputation.temporal`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `ffill` | Propagate last valid observation forward to next valid  | --- |\n| `bfill` | Use next valid observation to fill gap | --- |\n| `ts_tabular_imputer` | Use any method from [HyperImpute](https://github.com/vanderschaarlab/hyperimpute) (HyperImpute, Mean, Median, Most-frequent, MissForest, ICE, MICE, SoftImpute, EM, Sinkhorn, GAIN, MIRACLE, MIWAE) to impute the time series data | [Paper](https://arxiv.org/abs/2206.07769) |\n\n\n#### Scaling\n\n* Static data (category: `preprocessing.scaling.static`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `static_standard_scaler` | Scale the static features using a StandardScaler | --- |\n| `static_minmax_scaler` | Scale the static features using a MinMaxScaler | --- |\n\n* Temporal data (category: `preprocessing.scaling.temporal`)\n\n| Name | Description| Reference |\n| --- | --- | --- |\n| `ts_standard_scaler` | Scale the temporal features using a StandardScaler | --- |\n| `ts_minmax_scaler` | Scale the temporal features using a MinMaxScaler | --- |\n\n\n\u003c!-- exclude_docs --\u003e\n\u003c!-- exclude_pypi --\u003e\n\u003c/details\u003e\n\u003c!-- exclude_pypi_end --\u003e\n\u003c!-- exclude_docs_end --\u003e\n\n\n\n## 🔨 Tests and Development\n\nInstall the testing dependencies using:\n```bash\npip install .[testing]\n```\nThe tests can be executed using:\n```bash\npytest -vsx\n```\n\nFor local development, we recommend that you should install the `[dev]` extra, which includes `[testing]` and some additional dependencies:\n```bash\npip install .[dev]\n```\n\nFor development and contribution to TemporAI, see:\n* 📓 [Extending TemporAI tutorials](./tutorials/extending/)\n* 📃 [Contribution guide](./CONTRIBUTING.md)\n* 👩‍💻 [Developer's guide](./docs/dev_guide.md)\n\n\n\n## ✍️ Citing\n\nIf you use this code, please cite the associated paper:\n```\n@article{saveliev2023temporai,\n  title={TemporAI: Facilitating Machine Learning Innovation in Time Domain Tasks for Medicine},\n  author={Saveliev, Evgeny S and van der Schaar, Mihaela},\n  journal={arXiv preprint arXiv:2301.12260},\n  year={2023}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanderschaarlab%2Ftemporai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanderschaarlab%2Ftemporai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanderschaarlab%2Ftemporai/lists"}