Long-Toolkit
A hub of Python toolkits for longitudinal data, from preparation to explainability
About The Project
Long-Toolkit (short for Longitudinal-Toolkit) is a hub of Python toolkits for longitudinal data, i.e., data in which the same participants are measured at several waves (time points). It is designed for social, medical and clinical researchers.
First, the hub provides tools to get longitudinal data ready, from two viewpoints. Data preparation produces a usable table, by generating synthetic cohorts or by converting cohort files between formats (CSV, Parquet and Stata). Data preprocessing then makes that table fit for modelling, by cleaning, imputing, harmonising and reshaping the repeated measures.
Second, with the data ready, the hub answers one question: is machine learning, and/or longitudinal machine learning (models that exploit the repeated measures of each variable), worth it compared with the statistical analysis already in place, usually a logistic regression [1][2][3]? The Benchmarking and Modelling Toolkit answers it, by ranking both families of models side by side, all against all, under one shared protocol; it can then train and evaluate one chosen model in depth.
Third, the hub explains the results. The ranking shows whether, and by how much, machine learning improves on the statistical analysis on that dataset; the Explainability Toolkit then shows which features drive the predictions of a saved model, e.g., the best estimator of the benchmark.
| Toolkit | Stage | Question it answers |
|---|---|---|
| Data Preparation | A | How does a raw or synthetic cohort become a usable table? |
| Data Preprocessing | B | How are repeated measures cleaned, imputed and reshaped? |
| Benchmarking and Modelling (main toolkit) | C | Is machine learning, and/or longitudinal machine learning, worth it on this dataset? |
| Explainability | D | Which features drive the predictions of a chosen model? |
The hub ships as two components that run the same tools: the long-toolkit Python package, i.e., this repository, used through its application programming interface (API) in scripts and notebooks, and the long-toolkit command-line interface (CLI), a no-code terminal interface written in Go.
Setup And Launch
Machine Requirements (Python, uv)
Install the following first:
- Python
3.10only, oruv, the state-of-the-art Python package manager, to manage it - On macOS,
libomp(the OpenMP runtime loaded by XGBoost and LightGBM) - Go, only to build the CLI from source
# macOS (Homebrew)
brew update
brew install uv libomp
# Linux (Ubuntu/Debian)
curl -LsSf https://astral.sh/uv/install.sh | sh
Install long-toolkit (PyPI Index)
Long-Toolkit supports Python 3.10 only.
Before installing, add the following to your project's pyproject.toml. Scikit-Longitudinal supplies sklearn through its lexicographical fork, so the stock package must be excluded, as described in its installation guide.
[tool.uv]
override-dependencies = ["scikit-learn ; sys_platform == 'never'"]
uv add long-toolkit
# We recommend uv as the Python package manager
Install the long-toolkit CLI (No-Code Terminal Interface)
Homebrew (macOS and Linux):
brew tap Long-Toolkit/homebrew-tap
brew install long-toolkit
Then, from inside the Python project in which
long-toolkit is installed, run:
long-toolkit
Getting Started With the Toolkits
The documentation walks through every toolkit, with code that runs as is:
- Get Started: what the hub does, and how to install it.
- First Benchmark: standard against longitudinal machine learning on a synthetic cohort, in about thirty lines of Python.
- Toolkits: Data Preparation, Data Preprocessing, Benchmarking and Modelling, and Explainability, in depth.
- Tutorials: the CLI and the Python API, step by step.
Citation
Simon Provost's current affiliation is Postdoctoral Research @ McGill University (MEDomicsLab). For general enquiries, contact simon.g.provost@mcgill.ca.
@software{Provost_Long_Toolkit,
author = {Provost, Simon and Branco, Bianca and Chen, Honghui and Tassella, Isaac and Kwong, Alex},
title = {{Long-Toolkit: A Hub of Python Toolkits for Longitudinal Data}},
version = {0.0.4}
}
Use GitHub's "Cite this repository" for citation metadata updates.
License, Data, Security
- Review SECURITY.md for handling expectations.
- Licensed under the MIT License.
Special thanks to @charm.land for their amazing TUI framework!
Metadata
Release files for long-toolkit 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| long_toolkit-0.0.5.tar.gz | 151.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| long_toolkit-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 403.2 kB
Release files / long_toolkit-0.0.5.tar.gz
| Download URL | long_toolkit-0.0.5.tar.gz |
|---|---|
| Size | 151.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfb7810dcc7459f59a821aae79a6f432db8277e9e7ea77b1cbdeabe20c37f436
|
|
BLAKE2b-256 checksum How to use checksums |
2006802975e48b888b3cec221755c3a85089a54266d99df8acda4167fd0800a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / long_toolkit-0.0.5-py3-none-any.whl
| Download URL | long_toolkit-0.0.5-py3-none-any.whl |
|---|---|
| Size | 251.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
208dc08b7bfc371ff3605b5b52afdf986b6d53eee76a856c09992bfe9b39000d
|
|
BLAKE2b-256 checksum How to use checksums |
4027184bea271d538efa29c1bc03456027f6bfcad87ecbecbfd59de928ca489c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|