File size: 2,546 Bytes
fd07a91
 
 
 
 
 
 
 
 
 
 
 
3e57b17
 
 
 
 
71cc14d
843b7e8
 
 
 
 
afc547a
71cc14d
 
 
 
6ca647b
 
 
 
 
 
 
 
 
 
 
 
 
71cc14d
6ca647b
 
 
71cc14d
6ca647b
 
 
 
 
 
 
 
 
5f65a48
6ca647b
71cc14d
812b3ee
 
 
3c3e1a4
71cc14d
3c3e1a4
 
 
 
 
 
 
 
9090130
05217b2
3c3e1a4
 
 
775330b
6e51da4
 
 
bb071b8
 
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
---
license: apache-2.0
language:
- bs
- hr
- sr
- sl
- sk
- cs
- en
tags:
- sentiment-analysis
- text-regression
- text-classification
- sentiment-regression
- sentiment-classification
- parliament
inference: false
---


# Multilingual parliament sentiment regression model XLM-R-Parla-Sent

This model is based on [xlm-r-parla](https://huggingface.co/classla/xlm-r-parla), an XLM-R-large model additionally pre-trained on parliamentary proceedings. The model was fine-tuned on the [ParlaSent dataset](http://hdl.handle.net/11356/1868), a manually annotated selection of sentences of parliamentary proceedings from Bosnia and Herzegovina, Croatia, Czechia, Serbia, Slovakia, Slovenia, and the United Kingdom.

Both the additionally pre-trained model, as the training dataset are results of the [ParlaMint project](https://www.clarin.eu/parlamint). The details on the models and the dataset are described in the following publication (to be published soon):

Michal Mochtak, Peter Rupnik, Nikola Ljubešić: The ParlaSent Multilingual Training Dataset for Sentiment Identification in Parliamentary Proceedings.

## Annotation schema

The discrete labels, present in the original dataset, were mapped to integers as follows:

```
  "Negative": 0.0,
  "M_Negative": 1.0,
  "N_Neutral": 2.0,
  "P_Neutral": 3.0,
  "M_Positive": 4.0,
  "Positive": 5.0,
```
The model was then fine-tuned on numeric labels and set up as a regressor.

## Finetuning procedure

The fine-tuning procedure is described in the pending paper. Presumed optimal hyperparameters used are
```
  num_train_epochs=4,
  train_batch_size=32,
  learning_rate=8e-6,
  regression=True
```

## Results

Results reported were obtained from 5 fine-tuning runs.

test dataset | R^2 | MAE
--- | --- | ---
BCS | 0.6146 ± 0.0104 | 0.7050 ± 0.0089
EN | 0.6722 ± 0.0100 | 0.6755 ± 0.0076

## Usage Example

With `simpletransformers==0.64.3`.
```python
from simpletransformers.classification import ClassificationModel, ClassificationArgs
import torch
model_args = ClassificationArgs(
        regression=True,
    )
model = ClassificationModel(model_type="xlmroberta", model_name="classla/xlm-r-parlasent",use_cuda=torch.cuda.is_available(), num_labels=1,args=model_args)
model.predict(["I fully disagree with this argument.", "The ministers are entering the chamber.", "Things can always be improved in the future.", "These are great news."])
```

Output:
```python
(
  array([0.11633301, 3.63671875, 4.203125  , 5.30859375]),
  array([0.11633301, 3.63671875, 4.203125  , 5.30859375])
)
```