CoolFace
Modelpublic

acharya-jyu/sapbert-pubmedbert-ddxplus-10k

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes15downloads
Model Card

Model Details

Model Description

This model is a fine-tuned version of cambridgeltl/SapBERT-from-PubMedBERT-fulltext on the DDXPlus dataset (10,000 samples) for medical diagnosis tasks.

This is the model card of a ๐Ÿค— transformers model that has been pushed on the Hub. This model card has been automatically generated.

  • โ€”Developed by: Aashish Acharya
  • โ€”Model type: sapBERT-BioMedBERT
  • โ€”Language(s): English
  • โ€”License: MIT
  • โ€”Finetuned from model: cambridgeltl/SapBERT-from-PubMedBERT-fulltext

Model Sources

Training Dataset

The model was trained on DDXPlus dataset (10,000 samples) containing:

  • โ€”Patient cases with comprehensive medical information
  • โ€”Differential diagnosis annotations
  • โ€”49 distinct medical conditions
  • โ€”Evidence-based symptom-condition relationships

Performance

Final Metrics

  • โ€”Test Precision: 0.9619
  • โ€”Test Recall: 0.9610
  • โ€”Test F1 Score: 0.9592

Training Evolution

  • โ€”Best Validation F1: 0.9728 (Epoch 4)
  • โ€”Final Validation Loss: 0.6352

<img src="https://cdn-uploads.huggingface.co/production/uploads/662757230601587f0be9781b/7GK4e9jy4vKz9gSXU-dbh.png" width="400" alt="image"> <img src="https://cdn-uploads.huggingface.co/production/uploads/662757230601587f0be9781b/5b_O5oX0BISljP1kwdtTN.png" width="400" alt="image">

Intended Use

This model is designed for:

  • โ€”Medical diagnosis support
  • โ€”Symptom analysis
  • โ€”Disease classification
  • โ€”Differential diagnosis generation

Out-of-Scope Use

The model should NOT be used for:

  • โ€”Direct medical diagnosis without professional oversight
  • โ€”Critical healthcare decisions without human validation
  • โ€”Clinical applications without proper testing and validation

Training Details

Training Procedure

  • โ€”Optimizer: AdamW with weight decay (0.01)
  • โ€”Learning Rate: 1e-5
  • โ€”Loss Function: Combined loss (0.8 ร— Focal Loss + 0.2 ร— KL Divergence)
  • โ€”Batch Size: 32
  • โ€”Gradient Clipping: 1.0
  • โ€”Early Stopping: Patience of 3 epochs
  • โ€”Training Strategy: Cross-validation with 5 folds

Model Architecture

  • โ€”Base Model: cambridgeltl/SapBERT-from-PubMedBERT-fulltext
  • โ€”Hidden Size: 768
  • โ€”Attention Heads: 12
  • โ€”Dropout Rate: 0.5
  • โ€”Added classification layers for diagnostic tasks
  • โ€”Layer normalization and dropout for regularization

Example Usage

<pre> from transformers import AutoTokenizer, AutoModel

Load model and tokenizer

modelname = "acharya-jyu/sapbert-pubmedbert-ddxplus-10k" tokenizer = AutoTokenizer.frompretrained(modelname) model = AutoModel.frompretrained(model_name)

Example input structure

inputdata = { 'age': 45, # Patient age 'sex': 'M', # Patient sex: 'M' or 'F' 'initialevidence': 'E91', # Initial evidence code (e.g., E91 for fever) 'evidences': [ 'E91', # Fever 'E77', # Cough 'E_89' # Fatigue ] }

Process demographic data and evidence codes

outputs = model(**input_data)

Outputs will include:

- Main diagnosis prediction

- Differential diagnosis probabilities

- Confidence scores

</pre> <b>Note: Evidence codes (EXX) correspond to specific symptoms and conditions defined in the releaseevidences.json file. The model expects these standardized codes rather than raw text input.</b>

Citation

bibtex
  @misc{acharya2024sapbert,
  title={SapBERT-PubMedBERT Fine-tuned on DDXPlus Dataset},
  author={Acharya, Aashish},
  year={2024},
  publisher={Hugging Face Model Hub}
}

Model Card Contact

Aashish Acharya