Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- suicide-detection
|
| 5 |
+
- mental-health
|
| 6 |
+
- bert
|
| 7 |
+
- text-classification
|
| 8 |
+
- pytorch
|
| 9 |
+
- safetensors
|
| 10 |
+
license: mit
|
| 11 |
+
datasets:
|
| 12 |
+
- suicide-watch
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
- f1
|
| 16 |
+
- precision
|
| 17 |
+
- recall
|
| 18 |
+
model-index:
|
| 19 |
+
- name: BERT Suicide Risk Detection
|
| 20 |
+
results:
|
| 21 |
+
- task:
|
| 22 |
+
type: text-classification
|
| 23 |
+
name: Suicide Risk Detection
|
| 24 |
+
dataset:
|
| 25 |
+
type: suicide-watch
|
| 26 |
+
name: Suicide Detection Dataset
|
| 27 |
+
metrics:
|
| 28 |
+
- type: accuracy
|
| 29 |
+
value: 0.9772
|
| 30 |
+
name: Accuracy
|
| 31 |
+
- type: f1
|
| 32 |
+
value: 0.9772
|
| 33 |
+
name: F1 Score
|
| 34 |
+
- type: precision
|
| 35 |
+
value: 0.9773
|
| 36 |
+
name: Precision
|
| 37 |
+
- type: recall
|
| 38 |
+
value: 0.9772
|
| 39 |
+
name: Recall
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
# BERT Suicide Risk Detection Model
|
| 43 |
+
|
| 44 |
+
## Model Description
|
| 45 |
+
|
| 46 |
+
This is a fine-tuned BERT model for suicide risk detection in text. The model can classify text as either "suicide" (indicating potential suicide risk) or "non-suicide" (indicating no immediate risk).
|
| 47 |
+
|
| 48 |
+
## Model Performance
|
| 49 |
+
|
| 50 |
+
- **Accuracy**: 97.72%
|
| 51 |
+
- **F1 Score**: 97.72%
|
| 52 |
+
- **Precision**: 97.73%
|
| 53 |
+
- **Recall**: 97.72%
|
| 54 |
+
|
| 55 |
+
## Intended Use
|
| 56 |
+
|
| 57 |
+
This model is designed to assist mental health professionals and support systems in identifying potentially at-risk individuals. It should **NOT** be used as a standalone diagnostic tool.
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
| 63 |
+
import torch
|
| 64 |
+
|
| 65 |
+
# Load model and tokenizer
|
| 66 |
+
model_name = "Akashpaul123/bert-suicide-detection"
|
| 67 |
+
tokenizer = BertTokenizer.from_pretrained(model_name)
|
| 68 |
+
model = BertForSequenceClassification.from_pretrained(model_name)
|
| 69 |
+
|
| 70 |
+
# Example usage
|
| 71 |
+
text = "I'm feeling really down and don't know if I can keep going."
|
| 72 |
+
inputs = tokenizer(text, return_tensors="pt", max_length=512, truncation=True, padding=True)
|
| 73 |
+
|
| 74 |
+
with torch.no_grad():
|
| 75 |
+
outputs = model(**inputs)
|
| 76 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 77 |
+
|
| 78 |
+
suicide_prob = predictions[0][1].item()
|
| 79 |
+
non_suicide_prob = predictions[0][0].item()
|
| 80 |
+
|
| 81 |
+
print(f"Suicide probability: {suicide_prob:.4f}")
|
| 82 |
+
print(f"Non-suicide probability: {non_suicide_prob:.4f}")
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Training Data
|
| 86 |
+
|
| 87 |
+
The model was trained on the Suicide Detection dataset containing 232,074 samples with balanced classes (50% suicide, 50% non-suicide).
|
| 88 |
+
|
| 89 |
+
## Training Details
|
| 90 |
+
|
| 91 |
+
- **Model**: bert-base-uncased
|
| 92 |
+
- **Epochs**: 5
|
| 93 |
+
- **Batch Size**: 32
|
| 94 |
+
- **Learning Rate**: 2e-5
|
| 95 |
+
- **Max Length**: 512
|
| 96 |
+
- **Optimizer**: AdamW
|
| 97 |
+
- **Hardware**: A100 GPU
|
| 98 |
+
|
| 99 |
+
## Ethical Considerations
|
| 100 |
+
|
| 101 |
+
⚠️ **Important Notice**: This model is a tool to assist in suicide risk assessment and should not replace professional mental health evaluation. Always consult with qualified mental health professionals for proper assessment and intervention.
|
| 102 |
+
|
| 103 |
+
### Limitations
|
| 104 |
+
|
| 105 |
+
- The model may produce false positives or false negatives
|
| 106 |
+
- It should be used as part of a comprehensive mental health assessment system
|
| 107 |
+
- Regular monitoring and validation are recommended
|
| 108 |
+
- The model's performance may vary across different populations and contexts
|
| 109 |
+
|
| 110 |
+
## License
|
| 111 |
+
|
| 112 |
+
This model is released under the MIT License.
|
| 113 |
+
|
| 114 |
+
## Citation
|
| 115 |
+
|
| 116 |
+
If you use this model in your research, please cite:
|
| 117 |
+
|
| 118 |
+
```bibtex
|
| 119 |
+
@model{akashpaul2024bert-suicide-detection,
|
| 120 |
+
title={BERT Suicide Risk Detection Model},
|
| 121 |
+
author={Akash Paul},
|
| 122 |
+
year={2024},
|
| 123 |
+
url={https://huggingface.co/Akashpaul123/bert-suicide-detection}
|
| 124 |
+
}
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
## Contact
|
| 128 |
+
|
| 129 |
+
For questions or issues, please contact through the Hugging Face model page.
|