republic / README.md
jenslemmens's picture
Update README.md
2a72ead
|
raw
history blame
2.62 kB
metadata
pipeline_tag: text-classification
language:
  - nl
tags:
  - text classification
  - sentiment analysis
  - domain adaptation
widget:
  - text: De NMBS heeft recent de airconditioning in alle treinen vernieuwd.
    example_title: Positive
  - text: De reizigers van de NMBS kregen met lange wachttijden te kampen.
    example_title: Negative
  - text: De NMBS is een vervoermaatschappij.
    example_title: Neutral

RePublic

Model description

RePublic (reputation analyzer for public agencies) is a Dutch BERT model based on BERTje (De Vries, 2019). The model was designed to predict the sentiment in Dutch-language news article text about public agencies. RePublic was developed in colaboration with Jan Boon.

How to use

The model can be loaded and used to make predictions as follows:

from transformers import pipeline
model_path = 'clips/republic'
pipe = pipeline(task="text-classification", 
          model=model_path, tokenizer=model_path)	
text = … # load your text here
output = pipe(text)
prediction  = output[0]['label'] # 0=”neutral”; 1=”positive”; 2=”negative”

Training and data procedure

RePublic was domain-adapted on 91 661 Flemish news articles from three popular Flemish news providers (“Het Laatste Nieuws”, “Het Nieuwsblad” and “De Morgen”) that mention public agencies. This was done by performing BERT’s language modeling tasks (masked language modeling & next sentence prediction).

The model was then fine-tuned on a sentiment classification task (“positive”, “negative”, “neutral”). The supervised data consisted of 4 404 annotated sentences mentioning Flemish public agencies of which 1 257 sentences were positive, 1 485 sentences were negative and 1 662 sentences were neutral. Fine-tuning was performed for 4 epochs using a batch size of 8 and a learning rate of 5e-5.

Evaluation

The model was evaluated by performing 10-fold cross validation on the annotated data described above. During cross validation, the optimal number of epochs (4), batch size (8), and learning rate (5e-5) were determined. The standard deviation of the macro-averaged F1-scores of the cross validation experiments amounts to 1.5%. The detailed results of predictions in the cross validation experiments can be found below:

Class Precision (%) Recall (%) F1-score (%)
Positive 87.3 88.6 88.0
Negative 86.4 86.5 86.5
Neutral 85.3 84.2 84.7
Macro-averaged 86.3 86.4 86.4