CoolFace
Modelpublic

StringJammer/patient-emotion-classifier

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes
Model Card

<div align="center">

๐Ÿค– Patient Emotion Classifier

Advanced AI-Powered Emotion Recognition for Healthcare Dialogues

Part of the Blended AI+X Initiative โ€” Bridging Artificial Intelligence and Healthcare


![Model](https://huggingface.co/distilbert/distilbert-base-uncased) ![License](LICENSE) ![Performance]()

</div>

๐Ÿ”ฌ Overview

We are thrilled to introduce Patient Emotion Classifier, a state-of-the-art NLP model engineered to understand emotional nuances in patient-doctor conversations.

This model represents our commitment to advancing AI for Healthcare (AI+X), leveraging cutting-edge transformer architectures to bridge the gap between artificial intelligence and compassionate care.

Key Capabilities

  • โ€”Multiclass Emotion Recognition โ€” Identifies 6 distinct emotional states in clinical dialogues
  • โ€”Healthcare-Optimized โ€” Specifically trained on medical conversation data
  • โ€”Production-Ready โ€” Deployable via REST API for real-time inference
  • โ€”Lightweight & Efficient โ€” Built on DistilBERT for fast inference

๐ŸŽฏ Emotion Categories

Our model classifies emotional states into 6 clinically-relevant categories:

CategoryDescription
๐Ÿ˜ NeutralObjective, non-emotional statements
๐Ÿ˜ฐ Anxiety/FearPatient expresses worry, concern, or fear
๐Ÿ˜  Anger/FrustrationPatient shows frustration or displeasure
๐Ÿ˜ข Sadness/HelplessnessPatient feels down or hopeless
๐Ÿค” Confusion/DoubtPatient expresses uncertainty or questions
๐Ÿ™ Gratitude/ReliefPatient conveys thanks or relief

๐Ÿ“Š Model Performance

Overall Metrics

MetricValue
Accuracy71.3%
Macro F10.722
Weighted F10.72

Per-Class Performance

EmotionPrecisionRecallF1-Score
Neutral0.750.780.76
Anxiety/Fear0.520.630.57
Anger/Frustration0.800.730.76
Sadness/Helplessness0.650.550.60
Confusion/Doubt0.600.580.59
Gratitude/Relief0.720.750.73

Label Distribution

[image]

๐Ÿš€ Quick Start

1. Install Dependencies

bash
pip install -r requirements.txt

### 2. Launch the Service

cd see python app.py

3. Access the Interface

http://localhost:8002

๐Ÿ“š Dataset

This model was trained on a meticulously curated subset of medical dialogues:

  • โ€”Original Source: Chinese MedDialog Dataset โ€” Alibaba Cloud Tianchi
  • โ€”Post-Processing: Carefully filtered, translated, and annotated for emotion classification
  • โ€”Total Samples: 28,280 annotated dialogues
  • โ€”Categories: 6 emotion labels
  • โ€”Language: English

๐Ÿ“š References

  1. 1.MedDialog Dataset Chinese Medical Dialogue Dataset. Alibaba Cloud Tianchi. https://tianchi.aliyun.com/dataset/92110
  1. 1.DistilBERT Sanh, V., Debut, L., Chaumond, J., & Wolf, T. (2019). DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108. https://arxiv.org/abs/1910.01108

๐Ÿ—๏ธ Technical Specifications

ComponentDetails
Base ArchitectureDistilBERT
Task Type6-class emotion classification
Max Sequence Length512 tokens
FrameworkPyTorch + Transformers

๐Ÿ“ Project Structure

patient-emotion-analysis/ โ”œโ”€โ”€ best_model/ # Fine-tuned model weights โ”œโ”€โ”€ see/ # Inference service โ”‚ โ”œโ”€โ”€ app.py # Web application โ”‚ โ”œโ”€โ”€ inference.py # Core inference logic โ”‚ โ””โ”€โ”€ templates/ # UI templates โ”œโ”€โ”€ data/ # Training & evaluation data โ”œโ”€โ”€ requirements.txt # Dependencies โ””โ”€โ”€ README.md # This file


<div align="center">

Blended AI+X Initiative โ€” Advancing Healthcare Through Intelligence

</div>