Run this model with HF Jobs
Run kumarsurender/trial-completion-model on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/kumarsurender/trial-completion-model. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/kumarsurender/trial-completion-model on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use kumarsurender/trial-completion-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use kumarsurender/trial-completion-model with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("kumarsurender/trial-completion-model", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Model card: Trial Completion Model
Format follows "Model Cards for Model Reporting" (Mitchell et al., 2019). All numbers come from
data/model/metrics.json (produced by python -m cta.model.train --experiments).
Model details
- What it does: estimates the probability that an interventional clinical trial ends as COMPLETED rather than stopping early (TERMINATED or WITHDRAWN).
- Type: scikit-learn
HistGradientBoostingClassifier(gradient-boosted decision trees), chosen over logistic regression by validation PR-AUC. scikit-learn 1.9.1. - Version: 0.1.0, trained 2026-12-01. Personal learning project, not a product.
- Inputs: 25 features, all known when a trial is registered (see Features).
- Output:
probability_completes(0-1), a risk band compared with the average past trial, and the 3 feature groups that moved this estimate the most. - License: Apache 2.0 (code). Training data: ClinicalTrials.gov, a U.S. Government database.
Intended use
- Use: inside the Clinical Trials Assistant, to give users context such as "trials with a design like this stopped early more often than average" when they ask how likely a trial is to finish.
- Users: people curious about trials; learners studying registry data.
- Out of scope:
- Medical, enrolment or investment decisions.
- Telling a patient whether to join a trial.
- Judging the quality or safety of a specific trial, sponsor or site.
- Any claim about why a trial will stop. The model finds patterns, not causes.
Training data
- Source: ClinicalTrials.gov API v2 (API 2.0.5), data as of 2026-11-30T10:00:04 UTC.
- Selection: interventional trials with status COMPLETED, TERMINATED or WITHDRAWN that started between 2008-01-01 and 2018-12-31: 153,067 trials.
- Label: 1 = TERMINATED or WITHDRAWN (14.8% of trials), 0 = COMPLETED (85.2%).
- Modifications: flattened to one row per trial; lists turned into flags. No values edited.
Features (all known at registration)
Phase (6 flags; a Phase 2/3 trial sets two), sponsor class, allocation, intervention model, primary purpose, masking, data monitoring committee (yes / no / missing), intervention types (11 flags), number of conditions, start year. Missing categories are kept as "MISSING".
Deliberately excluded (leakage): actual enrollment, number of sites, countries, why stopped, results, completion dates, start-date type, and registration timing (explained below).
Evaluation
Time-based split: train on trials starting 2008-2015 (103,482), choose the model and its threshold on 2016 (16,022), then test once on 2017-2018 (33,563). This mimics real use: learn from the past, predict the future.
Test set (2017-2018), scored once:
| Metric | Model | Baseline (always predicts the base rate) |
|---|---|---|
| ROC-AUC | 0.671 | 0.500 |
| PR-AUC | 0.255 | 0.153 |
| Brier score (lower is better) | 0.124 | 0.129 |
| Precision at threshold 0.17 | 0.252 | n/a |
| Recall at threshold 0.17 | 0.504 | 0.000 |
| F1 at threshold 0.17 | 0.336 | 0.000 |
Confusion matrix on test (threshold 0.17): 2,581 stopped trials caught, 2,540 missed; 7,661 completed trials wrongly flagged, 20,781 correctly passed.
Validation comparison (2016):
| Model | ROC-AUC | PR-AUC | F1 | Brier |
|---|---|---|---|---|
| Baseline | 0.500 | 0.147 | 0.256 | 0.125 |
| Logistic regression | 0.664 | 0.233 | 0.323 | 0.120 |
| Logistic regression, balanced class weights | 0.664 | 0.232 | 0.324 | 0.221 |
| Gradient boosting (chosen) | 0.677 | 0.246 | 0.332 | 0.119 |
Plain-English summary: the model ranks a randomly chosen stopped trial above a randomly chosen completed one 67% of the time (50% would be guessing). It's a real but modest signal: registration-time facts explain only part of why trials stop.
Calibration: predicted and actual stop rates agree within about 3 percentage points across all 10 risk groups on test (e.g. the riskiest 10%: predicted 28%, actual 30%). Trials starting in 2017-2018 stopped slightly more often than the model expects. "Balanced" class weights inflate the probabilities (mean prediction 47% vs 15% actual), so the shipped model doesn't use them.
Experiments (validation set; none changes the shipped model)
| Experiment | ROC-AUC | PR-AUC | Lesson |
|---|---|---|---|
| Main model | 0.677 | 0.246 | reference |
| A. Random split instead of time split | 0.672 | 0.246 | no time drift visible in this window |
| B. Drop WITHDRAWN (terminated vs completed) | 0.678 | 0.184 | same ranking quality; PR-AUC lower because positives are rarer (10.3%) |
| C. LEAKY: + actual enrollment + site count | 0.875 | 0.731 | huge jump = leakage, not skill: those values are only final after the trial ends |
| D. On-time registrations only | 0.646 | 0.278 | see Known biases |
Known biases and limitations
- Modest accuracy. ROC-AUC 0.67. Treat outputs as broad context, never as a forecast for a specific trial.
- Late registration. 16% of completed trials were registered after they had already finished. Registration timing would raise ROC-AUC to about 0.72, but most of that gain is a record-keeping artefact, so it's excluded. On trials registered on time (how new trials look today), the model's ROC-AUC is 0.649 and it under-estimates the stop risk (predicts 15.1% vs actual 18.8%).
- Survivorship. Only closed trials are used. 9-26% of trials per start year are still open or have UNKNOWN status and are missing, more so in recent years.
- Record edits. The API returns the latest version of each record, so even "registration-time" fields may have been edited later.
- Time range. Trained on trials starting 2008-2016. For newer trials, the estimate assumes the past still applies; the tool shows a warning outside 2008-2018.
- Error analysis (test): weakest within Phase 3 (ROC-AUC 0.56) and Phase 2 (0.57); best within Phase 1 (0.69). Recall is similar for TERMINATED (52%) and WITHDRAWN (48%).
- Explanations describe the model's behaviour (how the estimate changes when one feature is swapped for typical values), not real-world causes.
Ethical considerations
- No personal health information is used. Registry data only.
- A low estimate could unfairly discourage interest in a legitimate trial. The agent must always show the disclaimer and suggest talking to a doctor or the trial site.
- Sponsor names are not features, so the model cannot single out organisations.
How to reproduce
pip install -e ".[dev,ml]"
python -m cta.model.dataset # data, ~3 minutes
python -m cta.model.train --experiments # model + metrics, ~30 seconds
pytest tests/test_model.py -v
Random seed: 42. The model file is a joblib pickle: only load files you produced yourself.
- Downloads last month
- -