Upload folder using huggingface_hub
Browse files- README.md +55 -0
- config.json +109 -0
- label_encoder.pkl +3 -0
- model.pkl +3 -0
- stopwords.pkl +3 -0
- tfidf_vectorizer.pkl +3 -0
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- text-classification
|
| 7 |
+
- cognitive-distortion
|
| 8 |
+
- mental-health
|
| 9 |
+
- cbt
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# CBT Cognitive Distortion Classifier
|
| 13 |
+
|
| 14 |
+
Classifies text into cognitive distortion groups for CBT therapy applications.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
- **Best Model**: SVM
|
| 19 |
+
- **Model Type**: Traditional ML
|
| 20 |
+
- **Classes**: 5 distortion groups
|
| 21 |
+
|
| 22 |
+
## Performance
|
| 23 |
+
|
| 24 |
+
| Metric | Clean Data | Real-World |
|
| 25 |
+
|--------|------------|------------|
|
| 26 |
+
| Accuracy | 0.4125 | 0.3250 |
|
| 27 |
+
| F1 Score | 0.4107 | 0.3208 |
|
| 28 |
+
|
| 29 |
+
## Distortion Groups
|
| 30 |
+
|
| 31 |
+
| Group | Distortions | Treatment |
|
| 32 |
+
|-------|-------------|-----------||
|
| 33 |
+
| G0 | No Distortion | Supportive listening |
|
| 34 |
+
| G1 | All-or-nothing, Labeling | Gradient restructuring |
|
| 35 |
+
| G2 | Overgeneralization, Mind Reading, Fortune-telling | Evidence testing |
|
| 36 |
+
| G3 | Mental filter, Magnification | Attention rebalancing |
|
| 37 |
+
| G4 | Emotional Reasoning, Personalization, Should statements | Metacognitive distancing |
|
| 38 |
+
|
| 39 |
+
## All Models Compared (Real-World F1)
|
| 40 |
+
|
| 41 |
+
| Model | Accuracy | F1 Score |
|
| 42 |
+
|-------|----------|----------|
|
| 43 |
+
| SVM | 0.3250 | 0.3208 |
|
| 44 |
+
| Logistic Regression | 0.2781 | 0.2647 |
|
| 45 |
+
| Random Forest | 0.2781 | 0.2615 |
|
| 46 |
+
| XGBoost | 0.2188 | 0.2099 |
|
| 47 |
+
| TinyBERT | 0.2500 | 0.1997 |
|
| 48 |
+
|
| 49 |
+
## Usage
|
| 50 |
+
|
| 51 |
+
See config.json for model type and loading instructions.
|
| 52 |
+
|
| 53 |
+
## Disclaimer
|
| 54 |
+
|
| 55 |
+
For educational and supportive purposes only. Not a substitute for professional mental health care.
|
config.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "SVM",
|
| 3 |
+
"is_transformer": false,
|
| 4 |
+
"num_labels": 5,
|
| 5 |
+
"label_mapping": {
|
| 6 |
+
"G0_No_Distortion": 0,
|
| 7 |
+
"G1_Gradient_Restructuring": 1,
|
| 8 |
+
"G2_Evidence_Testing": 2,
|
| 9 |
+
"G3_Attention_Rebalancing": 3,
|
| 10 |
+
"G4_Metacognitive_Distancing": 4
|
| 11 |
+
},
|
| 12 |
+
"id_to_label": {
|
| 13 |
+
"0": "G0_No_Distortion",
|
| 14 |
+
"1": "G1_Gradient_Restructuring",
|
| 15 |
+
"2": "G2_Evidence_Testing",
|
| 16 |
+
"3": "G3_Attention_Rebalancing",
|
| 17 |
+
"4": "G4_Metacognitive_Distancing"
|
| 18 |
+
},
|
| 19 |
+
"accuracy_clean": 0.4125,
|
| 20 |
+
"f1_clean": 0.4107350537733271,
|
| 21 |
+
"accuracy_realworld": 0.325,
|
| 22 |
+
"f1_realworld": 0.3207581458641578,
|
| 23 |
+
"groups": {
|
| 24 |
+
"G0_No_Distortion": {
|
| 25 |
+
"name": "No Distortion",
|
| 26 |
+
"treatment": "Supportive listening"
|
| 27 |
+
},
|
| 28 |
+
"G1_Gradient_Restructuring": {
|
| 29 |
+
"name": "Gradient Restructuring",
|
| 30 |
+
"distortions": [
|
| 31 |
+
"All-or-nothing",
|
| 32 |
+
"Labeling"
|
| 33 |
+
],
|
| 34 |
+
"treatment": "Spectrum thinking"
|
| 35 |
+
},
|
| 36 |
+
"G2_Evidence_Testing": {
|
| 37 |
+
"name": "Evidence Testing",
|
| 38 |
+
"distortions": [
|
| 39 |
+
"Overgeneralization",
|
| 40 |
+
"Mind Reading",
|
| 41 |
+
"Fortune-telling"
|
| 42 |
+
],
|
| 43 |
+
"treatment": "Challenge with evidence"
|
| 44 |
+
},
|
| 45 |
+
"G3_Attention_Rebalancing": {
|
| 46 |
+
"name": "Attention Rebalancing",
|
| 47 |
+
"distortions": [
|
| 48 |
+
"Mental filter",
|
| 49 |
+
"Magnification"
|
| 50 |
+
],
|
| 51 |
+
"treatment": "See full picture"
|
| 52 |
+
},
|
| 53 |
+
"G4_Metacognitive_Distancing": {
|
| 54 |
+
"name": "Metacognitive Distancing",
|
| 55 |
+
"distortions": [
|
| 56 |
+
"Emotional Reasoning",
|
| 57 |
+
"Personalization",
|
| 58 |
+
"Should statements"
|
| 59 |
+
],
|
| 60 |
+
"treatment": "Observe thoughts objectively"
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"all_model_results": {
|
| 64 |
+
"clean": {
|
| 65 |
+
"Logistic Regression": {
|
| 66 |
+
"accuracy": 0.4375,
|
| 67 |
+
"f1": 0.4339342742940156
|
| 68 |
+
},
|
| 69 |
+
"SVM": {
|
| 70 |
+
"accuracy": 0.4125,
|
| 71 |
+
"f1": 0.4107350537733271
|
| 72 |
+
},
|
| 73 |
+
"Random Forest": {
|
| 74 |
+
"accuracy": 0.35625,
|
| 75 |
+
"f1": 0.34116718928806056
|
| 76 |
+
},
|
| 77 |
+
"XGBoost": {
|
| 78 |
+
"accuracy": 0.340625,
|
| 79 |
+
"f1": 0.33509732163919337
|
| 80 |
+
},
|
| 81 |
+
"TinyBERT": {
|
| 82 |
+
"accuracy": 0.603125,
|
| 83 |
+
"f1": 0.6012083383624693
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"realworld": {
|
| 87 |
+
"Logistic Regression": {
|
| 88 |
+
"accuracy": 0.278125,
|
| 89 |
+
"f1": 0.2647432278367442
|
| 90 |
+
},
|
| 91 |
+
"SVM": {
|
| 92 |
+
"accuracy": 0.325,
|
| 93 |
+
"f1": 0.3207581458641578
|
| 94 |
+
},
|
| 95 |
+
"Random Forest": {
|
| 96 |
+
"accuracy": 0.278125,
|
| 97 |
+
"f1": 0.2614757594604754
|
| 98 |
+
},
|
| 99 |
+
"XGBoost": {
|
| 100 |
+
"accuracy": 0.21875,
|
| 101 |
+
"f1": 0.20994533926416956
|
| 102 |
+
},
|
| 103 |
+
"TinyBERT": {
|
| 104 |
+
"accuracy": 0.25,
|
| 105 |
+
"f1": 0.19974747542329035
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
}
|
label_encoder.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3de01416fa91ba92e79d9c86bd9f455e7d37bfa9919d3954f9aec37b08bc0673
|
| 3 |
+
size 369
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f16bdd4767f22a1a4ebbb8c5331114f5d596b7978eea38a6b0ada8c1f16459b8
|
| 3 |
+
size 256462
|
stopwords.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6adf4e8a08be04a2bb4cfefdacb276b81eedee8be59fb765738d7aece569835a
|
| 3 |
+
size 2817
|
tfidf_vectorizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50d4d9e29ce0014508f68ef1881c1e156a5890e0dd816f1a79c6865ff8cd235f
|
| 3 |
+
size 88784
|