|
--- |
|
license: apache-2.0 |
|
language: |
|
- it |
|
widget: |
|
- text: "una fantastica giornata di #calcio! grande prestazione del mister e della squadra" |
|
example_title: "Example 1" |
|
- text: "il governo dovrebbe fare politica, non soltanto propaganda! #vergogna" |
|
example_title: "Example 2" |
|
- text: "che serata da sogno sul #redcarpet! grazie a tutti gli attori e registi del cinema italiano #oscar #awards" |
|
example_title: "Example 3" |
|
--- |
|
|
|
-------------------------------------------------------------------------------------------------- |
|
|
|
<body> |
|
<span class="vertical-text" style="background-color:lightgreen;border-radius: 3px;padding: 3px;">β</span> |
|
<br> |
|
<span class="vertical-text" style="background-color:orange;border-radius: 3px;padding: 3px;">ββββTask: Sentiment Analysis</span> |
|
<br> |
|
<span class="vertical-text" style="background-color:lightblue;border-radius: 3px;padding: 3px;">ββββModel: BERT-TWEET</span> |
|
<br> |
|
<span class="vertical-text" style="background-color:tomato;border-radius: 3px;padding: 3px;">ββββLang: IT</span> |
|
<br> |
|
<span class="vertical-text" style="background-color:lightgrey;border-radius: 3px;padding: 3px;">ββ</span> |
|
<br> |
|
<span class="vertical-text" style="background-color:#CF9FFF;border-radius: 3px;padding: 3px;">β</span> |
|
</body> |
|
|
|
-------------------------------------------------------------------------------------------------- |
|
|
|
<h3>Model description</h3> |
|
|
|
This is a <b>BERT</b> <b>[1]</b> uncased model for the <b>Italian</b> language, fine-tuned for <b>Sentiment Analysis</b> (<b>positive</b> and <b>negative</b> classes only) on the [SENTIPOLC-16](https://www.evalita.it/campaigns/evalita-2016/tasks-challenge/sentipolc/) dataset, using <b>BERT-TWEET-ITALIAN</b> ([bert-tweet-base-italian-uncased](https://huggingface.co/osiria/bert-tweet-base-italian-uncased)) as a pre-trained model. |
|
|
|
<h3>Training and Performances</h3> |
|
|
|
The model is trained to perform binary sentiment classification (<b>positive</b> vs <b>negative</b>) and it's meant to be used primarily on tweets or other social media posts. It has been fine-tuned for Sentiment Analysis, using the SENTIPOLC-16 dataset, for 3 epochs with a constant learning rate of 1e-5 and exploiting class weighting to compensate for the class imbalance. |
|
Instances having both positive and negative sentiment have been excluded, resulting in 4154 training instances and 1050 test instances |
|
|
|
The performances on the test set are reported in the following table: |
|
|
|
| Accuracy | Recall | Precision | F1 | |
|
| ------ | ------ | ------ | ------ | |
|
| 83.67 | 83.15 | 80.48 | 81.49 | |
|
|
|
The Recall, Precision and F1 metrics are averaged over the two classes |
|
|
|
<h3>Quick usage</h3> |
|
|
|
```python |
|
from transformers import BertTokenizerFast, BertForSequenceClassification |
|
|
|
tokenizer = BertTokenizerFast.from_pretrained("osiria/bert-tweet-italian-uncased-sentiment") |
|
model = BertForSequenceClassification.from_pretrained("osiria/bert-tweet-italian-uncased-sentiment") |
|
|
|
from transformers import pipeline |
|
classifier = pipeline("text-classification", model = model, tokenizer = tokenizer) |
|
|
|
classifier("una fantastica giornata di #calcio! grande prestazione del mister e della squadra") |
|
|
|
# [{'label': 'POSITIVE', 'score': 0.9883694648742676}] |
|
``` |
|
|
|
<h3>References</h3> |
|
|
|
[1] https://arxiv.org/abs/1810.04805 |
|
|
|
<h3>Limitations</h3> |
|
|
|
This model was trained on tweets, so it's mainly suitable for general-purpose social media text processing, involving short texts written in a social network style. |
|
It might show limitations when it comes to longer and more structured text, or domain-specific text. |
|
|
|
<h3>License</h3> |
|
|
|
The model is released under <b>Apache-2.0</b> license |
|
|
|
|