File size: 3,299 Bytes
c6ee0a4
 
ba30f5b
c6ee0a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4fd6b1
b6a482b
c6ee0a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4fd6b1
800f871
c6ee0a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: sv
license: mit
---

## Swedish BERT models for sentiment analysis
 [Recorded Future](https://www.recordedfuture.com/) together with [AI Sweden](https://www.ai.se/en) releases two language models for sentiment analysis in Swedish. The two models are based on the [KB\/bert-base-swedish-cased](https://huggingface.co/KB/bert-base-swedish-cased) model and has been fine-tuned to solve a multi-label sentiment analysis task. 

The models have been fine-tuned for the sentiments fear and violence. The models output three floats corresponding to the labels "Negative", "Weak sentiment", and "Strong Sentiment" at the respective indexes. 
The models have been trained on Swedish data with a conversational focus, collected from various internet sources and forums.

The models are only trained on Swedish data and only supports inference of Swedish input texts. The models inference metrics for all non-Swedish inputs are not defined, these inputs are considered as out of domain data.

The current models are supported at Transformers version >= 4.3.3 and Torch version 1.8.0, compatibility with older versions are not verified. 

### Swedish-Sentiment-Fear

The model can be imported from the transformers library by running

    from transformers import BertForSequenceClassification, BertTokenizerFast
    
    tokenizer = BertTokenizerFast.from_pretrained("RecordedFuture/Swedish-Sentiment-Fear")
    classifier_fear= BertForSequenceClassification.from_pretrained("RecordedFuture/Swedish-Sentiment-Fear") 

When the model and tokenizer are initialized the model can be used for inference. 

#### Sentiment definitions
#### The strong sentiment includes but are not limited to
Texts that:

 - Hold an expressive emphasis on fear and/ or anxiety 

#### The weak sentiment includes but are not limited to
Texts that: 

- Express fear and/ or anxiety in a neutral way

#### Verification metrics 

During training, the model had maximized validation metrics at the following classification breakpoint. 



| Classification Breakpoint | F-score | Precision | Recall |
|:-------------------------:|:-------:|:---------:|:------:|
|               0.45 |  0.8754 |   0.8618  | 0.8895 |

#### Swedish-Sentiment-Violence
The model be can imported from the transformers library by running

    from transformers import BertForSequenceClassification, BertTokenizerFast
    
    tokenizer = BertTokenizerFast.from_pretrained("RecordedFuture/Swedish-Sentiment-Violence")
    classifier_violence = BertForSequenceClassification.from_pretrained("RecordedFuture/Swedish-Sentiment-Violence") 

When the model and tokenizer are initialized the model can be used for inference. 

### Sentiment definitions
#### The strong sentiment includes but are not limited to
Texts that:
 -  Referencing highly violent acts
-   Hold an aggressive tone
#### The weak sentiment includes but are not limited to
Texts that:
-   Include general violent statements that do not fall under the strong sentiment
#### Verification metrics 
During training, the model had maximized validation metrics at the following classification breakpoint. 

| Classification Breakpoint | F-score | Precision | Recall |
|:-------------------------:|:-------:|:---------:|:------:|
|            0.35           |  0.7677 |   0.7456  |  0.791 |