File size: 2,778 Bytes
80d247b
 
 
 
2b97e68
c4a77e1
80d247b
 
 
 
 
 
c9a3048
80d247b
 
 
 
c9a3048
80d247b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d6039f
80d247b
 
 
 
6d6039f
80d247b
 
 
 
 
da18575
80d247b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
language:
- en
pipeline_tag: text-classification
inference: false
---

# Affective Norms Extrapolation Model for English Language

## Model Description

This transformer-based model is designed to extrapolate affective norms for English words, including metrics such as valence, arousal, dominance, concreteness, and age of acquisition. It has been finetuned from the ERNIE 2.0 model, enhanced with additional layers to predict the affective dimensions. This model was first released as a part of the publication: "Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection." (Plisiecki, Sobieszek; 2023) [ https://doi.org/10.3758/s13428-023-02212-3 ]


## Training Data

The model was trained on the ANEW corpus (Bradley & Lang, 1999) and the corpus collected by Warriner et al. (2013) [ https://doi.org/10.3758/s13428-012-0314-x ]. The ANEW corpus consists of 1030 words, while Warriner's dataset includes 13,915 words rated on various emotional and semantic dimensions. The combined dataset was split into training, validation, and test sets in an 8:1:1 ratio.

## Performance

The model achieved the following Pearson correlations with human judgments on the test set:

- Valence: 0.95
- Arousal: 0.76
- Dominance: 0.86
- Concreteness: 0.95
- Age of Acquisition: 0.85



## Usage

You can use the model and tokenizer as follows:

First run the bash code below to clone the repository (this will take some time). Because of the custom model class, this model cannot be run with the usual huggingface Model setups.

```bash
git clone https://huggingface.co/hplisiecki/word2affect_english
```

Proceed as follows:

```python
from word2affect_polish.model_script import CustomModel # importing the custom model class
from transformers import AutoTokenizer

model_directory = "word2affect_english" # path to the cloned repository

model = CustomModel.from_pretrained(model_directory)
tokenizer = AutoTokenizer.from_pretrained(model_directory)

inputs = tokenizer("This is a test input.", return_tensors="pt")
outputs = model(inputs['input_ids'], inputs['attention_mask'])

# Print out the emotion ratings
for emotion, rating in zip(['Valence', 'Arousal', 'Dominance', 'Age of Acquisition', 'Concreteness'], outputs):
    print(f"{emotion}: {rating.item()}")
```

## Citation

If you use this model please cite the following paper.

```sql
@article{Plisiecki_Sobieszek_2023,
  title={Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection},
  author={Plisiecki, Hubert and Sobieszek, Adam},
  journal={Behavior Research Methods},
  year={2023},
  pages={1-16}
  doi={https://doi.org/10.3758/s13428-023-02212-3}
}
```