File size: 10,003 Bytes
af2ba21
 
123f56f
 
 
 
 
 
 
 
 
af2ba21
 
123f56f
 
5a4beae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c4d5ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123f56f
 
 
 
 
 
 
 
 
 
 
5804ce1
123f56f
 
 
 
 
 
 
 
 
 
5804ce1
123f56f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c4d5ef
 
 
123f56f
 
 
 
3c4d5ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a4beae
123f56f
 
 
 
 
01d8951
123f56f
 
af2ba21
 
 
 
123f56f
01d8951
 
 
 
 
 
 
 
 
123f56f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
library_name: transformers
license: mit
language:
- en
base_model:
- google-bert/bert-base-uncased
pipeline_tag: text-classification
tags:
- PyTorch
- multi-class-classification
---

This is Bert-base-uncased model fine-tuned for topic classification of therapist remarks in psychotherapeutic contexts. The task is a multi-class classification with the following labels:
```python
id2label = {
           0: 'Relationship with a Female Figure',
           1: 'Experiencing and Articulating Emotions',
           2: 'Work and Personal Fulfillment',
           3: 'Relationship with a Male Figure',
           4: 'Meaning-Making and Conceptualization',
           5: 'Education and Personal Development',
           6: 'Experience of Fear and Anxiety',
           7: 'Sexual Relationships and Identity',
           8: 'Expression and Communication Difficulties',
           9: 'Self-Acceptance and Social Relationships',
           10: 'Time Perception and Management',
           11: 'Cyclical Patterns of Experience',
           12: 'Therapy Experience and Reflection',
           13: 'Positive Emotional Experience',
           14: 'Mother-Child Relationship Dynamics',
           15: 'Creativity and Emotional Expression',
           16: 'Humor and Cognitive Reframing',
           17: 'Emotional Disturbance and Regulation',
           18: 'Expressions of Certainty',
           19: 'Guilt and Responsibility',
           20: 'Self-Reflection on Maturity',
           21: 'Sleep-Wake Cycle and Daily Rhythm',
           22: 'Life Orientation and Authenticity',
           23: 'Home and Attachment-Autonomy Conflict',
           24: 'Parenting and Family Responsibility',
           25: 'Internal Conflict and Emotional Regulation',
           26: 'Friendship Dynamics',
           27: 'Reflection and Awareness of Unconsidered Thought',
           28: 'Reading as Cognitive and Reflective Engagement',
           29: 'Processes of Personal Change',
           30: 'Emotional Pain and Hurt',
           31: 'Belief, Faith, and Existential Doubt',
           32: 'Evaluation of Neurotic and Healthy States',
           33: 'Emotional Distress and Negative Evaluation',
           34: 'Experience and Regulation of Anger',
           35: 'Positive Emotional Evaluation',
           36: 'Dream Experience and Symbolic Processing',
           37: 'Father-Child Relationship Dynamics',
           38: 'Problem Framing and Self-Resolution',
           39: 'Personal Learning Experiences',
           40: 'Racial Identity and Intergroup Relations',
           41: 'Healthcare Interactions and Medical Authority',
           42: 'Uncertainty about Correctness',
           43: 'Evaluation of Marriage',
           44: 'Marital Relationship and Communication',
           45: 'Self-Worth and Capacity for Love',
           46: 'Self-Expression Through Appearance'}
```


## Usage

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("AIPsy/bert-base-client-topic-classification-eng")
model = AutoModelForSequenceClassification.from_pretrained("AIPsy/bert-base-client-topic-classification-eng")

text = "That in essense it's right; it's responsibility."

encoding = tokenizer(
            text,
            truncation=True,
            padding="max_length",
            return_tensors="pt"
        )
output = model(encoding['input_ids'], encoding['attention_mask']).logits
result = np.argmax(output.detach().numpy(), axis=-1)
print(id2label[result[0]])
'Guilt and Responsibility'
```

## Dataset

The source material was the recordings of psychotherapeutic sessions posted on YouTube in the public domain. After conducting speaker diarization and transcription of the recordings 15324 items (sentences) were obtained.

## Recommendations

Given the broad context of issues discussed in psychotherapeutic sessions, the authors believe that this model can be used to analyze human communication in general.

## Metrics

Score metrics of trained model
|Sample|F1 macro|
|:-|:-:|
|Test|0.76|
|Validation|0.75|
|Train|0.94|

F1 score metrics for test sample across categories
|ID|Topic|Precision|Recall|F1|
|:-:|:-|:-:|:-:|:-:|
|        0 | Relationship with a Female Figure                |      0.91 |   0.97 |     0.94 |     232 |
|        1 | Experiencing and Articulating Emotions           |      0.77 |   0.82 |     0.79 |     238 |
|        2 | Work and Personal Fulfillment                    |      0.75 |   0.77 |     0.76 |     235 |
|        3 | Relationship with a Male Figure                  |      0.86 |   0.91 |     0.88 |     150 |
|        4 | Meaning-Making and Conceptualization             |      0.79 |   0.81 |     0.80 |     277 |
|        5 | Education and Personal Development               |      0.80 |   0.73 |     0.77 |      83 |
|        6 | Experience of Fear and Anxiety                   |      0.97 |   0.75 |     0.85 |      80 |
|        7 | Sexual Relationships and Identity                |      0.76 |   0.80 |     0.78 |      66 |
|        8 | Expression and Communication Difficulties        |      0.70 |   0.83 |     0.76 |     143 |
|        9 | Self-Acceptance and Social Relationships         |      0.58 |   0.81 |     0.68 |     221 |
|       10 | Time Perception and Management                   |      0.85 |   0.71 |     0.77 |      96 |
|       11 | Cyclical Patterns of Experience                  |      0.79 |   0.65 |     0.71 |     175 |
|       12 | Therapy Experience and Reflection                |      0.86 |   0.64 |     0.73 |      58 |
|       13 | Positive Emotional Experience                    |      0.80 |   0.63 |     0.71 |      78 |
|       14 | Mother-Child Relationship Dynamics               |      0.82 |   0.75 |     0.79 |      61 |
|       15 | Creativity and Emotional Expression              |      0.64 |   0.73 |     0.68 |      37 |
|       16 | Humor and Cognitive Reframing                    |      0.60 |   0.63 |     0.62 |      57 |
|       17 | Emotional Disturbance and Regulation             |      0.74 |   0.71 |     0.72 |     193 |
|       18 | Expressions of Certainty                         |      0.96 |   0.91 |     0.94 |     207 |
|       19 | Guilt and Responsibility                         |      0.62 |   0.59 |     0.60 |      75 |
|       20 | Self-Reflection on Maturity                      |      0.71 |   0.80 |     0.75 |      45 |
|       21 | Sleep-Wake Cycle and Daily Rhythm                |      0.78 |   0.61 |     0.68 |      41 |
|       22 | Life Orientation and Authenticity                |      0.75 |   0.70 |     0.72 |      82 |
|       23 | Home and Attachment-Autonomy Conflict            |      0.69 |   0.72 |     0.70 |      46 |
|       24 | Parenting and Family Responsibility              |      0.79 |   0.70 |     0.74 |      53 |
|       25 | Internal Conflict and Emotional Regulation       |      0.87 |   0.68 |     0.76 |      38 |
|       26 | Friendship Dynamics                              |      0.56 |   0.80 |     0.66 |      59 |
|       27 | Reflection and Awareness of Unconsidered Thought |      0.80 |   0.70 |     0.75 |      94 |
|       28 | Reading as Cognitive and Reflective Engagement   |      0.62 |   0.86 |     0.72 |      35 |
|       29 | Processes of Personal Change                     |      0.69 |   0.69 |     0.69 |      39 |
|       30 | Emotional Pain and Hurt                          |      0.83 |   0.59 |     0.69 |      32 |
|       31 | Belief, Faith, and Existential Doubt             |      0.76 |   0.91 |     0.83 |      32 |
|       32 | Evaluation of Neurotic and Healthy States        |      0.75 |   0.75 |     0.75 |      32 |
|       33 | Emotional Distress and Negative Evaluation       |      0.65 |   0.58 |     0.61 |      53 |
|       34 | Experience and Regulation of Anger               |      0.61 |   0.70 |     0.65 |      33 |
|       35 | Positive Emotional Evaluation                    |      0.83 |   0.69 |     0.76 |      49 |
|       36 | Dream Experience and Symbolic Processing         |      0.94 |   0.84 |     0.89 |      19 |
|       37 | Father-Child Relationship Dynamics               |      0.81 |   0.83 |     0.82 |      30 |
|       38 | Problem Framing and Self-Resolution              |      0.78 |   0.62 |     0.69 |      40 |
|       39 | Personal Learning Experiences                    |      0.59 |   0.58 |     0.58 |      33 |
|       40 | Racial Identity and Intergroup Relations         |      1.00 |   0.73 |     0.85 |      15 |
|       41 | Healthcare Interactions and Medical Authority    |      0.84 |   0.84 |     0.84 |      25 |
|       42 | Uncertainty about Correctness                    |      0.81 |   0.65 |     0.72 |     120 |
|       43 | Evaluation of Marriage                           |      0.79 |   0.86 |     0.83 |      22 |
|       44 | Marital Relationship and Communication           |      0.76 |   0.62 |     0.68 |      21 |
|       45 | Self-Worth and Capacity for Love                 |      0.93 |   0.64 |     0.76 |      22 |
|       46 | Self-Expression Through Appearance               |      0.62 |   0.64 |     0.63 |      25 |




## Citation 

- **Papers:** Vanin A, Bolshev V and Panfilova A (2025) Psychotherapist remarks’ ML classifier: insights from LLM and topic modeling application. Front. Psychiatry 16:1608163. doi: 10.3389/fpsyt.2025.1608163. <https://doi.org/10.3389/fpsyt.2025.1608163>
- **Developed by:** @myentity, @VadZhen, @Alek123
- **License:** MIT


**BibTeX:**

```
@ARTICLE{10.3389/fpsyt.2025.1608163,   
AUTHOR={Vanin, Alexander  and Bolshev, Vadim  and Panfilova, Anastasia },          
TITLE={Psychotherapist remarks’ ML classifier: insights from LLM and topic modeling application},        
JOURNAL={Frontiers in Psychiatry},         
VOLUME={Volume 16 - 2025}, 
YEAR={2025}, 
URL={https://www.frontiersin.org/journals/psychiatry/articles/10.3389/fpsyt.2025.1608163},
DOI={10.3389/fpsyt.2025.1608163},
ISSN={1664-0640},
```