File size: 7,736 Bytes
a764ac4
0c66ae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a764ac4
 
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
 
 
 
 
 
 
 
 
 
 
 
a764ac4
 
 
 
0c66ae8
 
 
 
 
 
 
 
 
a764ac4
 
 
0c66ae8
 
 
a764ac4
 
 
0c66ae8
a764ac4
0c66ae8
 
 
a764ac4
0c66ae8
 
 
 
 
 
a764ac4
0c66ae8
 
 
 
 
 
 
 
 
a764ac4
451e570
0c66ae8
a764ac4
 
0c66ae8
 
 
 
 
 
 
 
 
5955e84
 
0c66ae8
 
 
 
 
 
 
 
 
 
a764ac4
 
0c66ae8
 
 
 
 
a764ac4
0c66ae8
 
a764ac4
0c66ae8
 
a764ac4
0c66ae8
 
a764ac4
0c66ae8
5955e84
 
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
 
 
 
 
 
a764ac4
0c66ae8
 
 
 
 
 
 
 
 
55fbab2
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
0c66ae8
a764ac4
 
 
0c66ae8
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
---
base_model: sentence-transformers/all-mpnet-base-v2
language: 
  - en
license: apache-2.0
tags: 
  - noneconomic-attributes
  - mention-classification
  - mpnet-base-v2
  - setfit
  - multi-label-classification
model-index:
- name: all-mpnet-base-v2_noneconomic-attributes-classifier
  results:
  - task:
      type: multi-label-classification
      name: Multi-label classification
    metrics:
    - type: _tba_
      value: -1.0
    dataset:
      type: custom
      name: custom human-labeled multi-label annotation dataset
---

# Group mention non-economic attributes classifier

A multi-label classifier for detecting **non-economic attribute** categories referred to in a social group mention, trained with `setfit` based on the light-weight [`sentence-transformers/all-mpnet-base-v2`](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) sentence embedding model.

The non-economic attributes classified are:

| attribute                 | definition                                                                                                                                                                                                        |
|:--------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| age                       | People referred to based on or categorized according to their age, generation, or cohort such as children, young people, old people, future generations.                                                          |
| family                    | People referred to based on or categorized according to their familial role such as fathers, mothers, parents.                                                                                                    |
| gender/sexuality          | People referred to based on or categorized according to their gender or sexuality such as men, women, or LGBTQI+ people.                                                                                          |
| place/location            | People referred to based on or categorized according to their place or location such as peolple from rural areas, urban center, the global south, or global north.                                                |
| nationality               | People referred to based on or categorized according to their nationality such as natives or immigrants.                                                                                                          |
| ethnicity                 | People referred to based on or categorized according to heir ethnicity such as people of color or ethnic minorities.                                                                                              |
| religion                  | People referred to based on or categorized according to their religion of belief such as christians, jews, muslims, etc.                                                                                          |
| health                    | People referred to based on or categorized according to their health condition or relation to aspects of health such as disabled/handicapped people or chronically sick people.                                   |
| crime                     | People referred to based on or categorized according to their relation to crime such as offenders/criminals or victims.                                                                                           |
| shared values/mentalities | People referred to based on or categorized according to their shared values or mentalities such as people with a growth mindset, meritocratic values, environmental or peace mentalities or a more equal society. |

## Model Details

### Model Description

Group mention non-economic attributes classifier

- **Developed by:** Hauke Licht
- **Model type:** mpnet
- **Language(s) (NLP):** ['en']
- **License:** apache-2.0
- **Finetuned from model:** sentence-transformers/all-mpnet-base-v2
- **Funded by:** The *Deutsche Forschungsgemeinschaft* (DFG, German Research Foundation) under Germany's Excellence Strategy – EXC 2126/1 – 390838866

### Model Sources

- **Repository:** _tba_
- **Paper:** _tba_
- **Demo:** [More Information Needed]

## Uses

### Bias, Risks, and Limitations

- Evaluation of the classifier in held-out data shows that it makes mistakes. 
- The model has been finetuned only on human-annotated labeled social group mentions recorded in sentences sampled from party manifestos of European parties (mostly far-right and Green parties). Applying the classifier in other domains can lead to higher error rates.
- The data used to finetune the model come from human annotators. Human annotators can be biased and factors like gender and social background can impact their annotations judgments. This may lead to bias in the detection of specific social groups.

#### Recommendations

- Users who want to apply the model outside its training data domain should evaluate its performance in the target data.
- Users who want to apply the model outside its training data domain  should contuninue to finetune this model on labeled data.

### How to Get Started with the Model

Use the code below to get started with the model.

## Usage

You can use the model with the [`setfit` python library](https://github.com/huggingface/setfit) (>=1.1.0):

*Note:* It is recommended to use transformers version >=4.5.5,<=5.0.0 and sentence-transformers version >=4.0.1,<=5.1.0 for compatibility.

### Classification

```python
import torch
from setfit import SetFitModel

model_name = "haukelicht/all-mpnet-base-v2_noneconomic-attributes-classifier"
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
classifier = SetFitModel.from_pretrained(model_name)
classifier.to(device);

# Example mentions
mentions = ["working class people", "highly-educated professionals", "people without a stable job"]

# Get predictions
with torch.no_grad():
    predictions = classifier.predict(mentions)
print(predictions)

# Map predictions to labels
[
    [
        classifier.id2label[l]
        for l, p in enumerate(pred) if p==1
    ]
    for pred in predictions
]
```

### Mention embedding

```python
import torch
from sentence_transformers import SentenceTransformer

model_name = "haukelicht/all-mpnet-base-v2_noneconomic-attributes-classifier"
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"

# Load the sentence transformer component of the pre-trained classifier
model = SentenceTransformer(model_name, device=device)

# Example mentions
mentions = ["working class people", "highly-educated professionals", "people without a stable job"]

# Compute mention embeddings
with torch.no_grad():
    embeddings = model.encode(mentions)
````

## Training Details

### Training Data

The train, dev, and test splits used for model finetuning and evaluation will be made available on Github upon publication of the associated research paper.

### Training Procedure

#### Training Hyperparameters

- num epochs: (1, 4)
- train batch sizes: (32, 4)
- body train max teps: 75
- head learning rate: 0.010
- L2 weight: 0.01
- warmup proportion: 0.15

## Evaluation

### Testing Data, Factors & Metrics

#### Testing Data

The train, dev, and test splits used for model finetuning and evaluation will be made available on Github upon publication of the associated research paper.

## Citation

**BibTeX:**

[More Information Needed]

**APA:**

[More Information Needed]

## Model Card Contact

[email protected]