CoolFace
Modelpublic

zastuck/roberta-base-bosnian-parliament-multilabel-v1

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes11downloads
Model Card

Model Description

<!-- Provide a longer summary of what this model is. -->

This model was fine-tuned for use in the master's thesis, "Politics, Identity, and Ontological Security in Bosnia and Herzegovina". It is a multi-label model designed to identify patterns of self, other, and relevant rhetorical devices for analysis of ontological security. The model was trained using active learning on a total sample size of 700 manually coded segments of parliamentary debate in Bosnia and Herzegovina. Due to limitations of the project scope, the dataset is only coded by 1 student and may have inconsistency due to coder bias or complex wordings. This model was not intended to be expanded upon, but it is freely accessible should someone find it useful.

Model Performance & Metrics

Sample SizeValidation LossF1 MacroF1 MicroHamming Loss
700 samples0.1080.8950.9390.026

python

from sklearn.metrics import f1_score, hamming_loss

def compute_metrics(eval_pred):
    logits, labels = eval_pred
    # Use sigmoid to get probabilities, then threshold at 0.5
    probs = 1 / (1 + np.exp(-logits))
    predictions = (probs > 0.5).astype(float)

    return {
        "f1_macro": f1_score(labels, predictions, average="macro"),
        "f1_micro": f1_score(labels, predictions, average="micro"),
        "hamming_loss": hamming_loss(labels, predictions)
    }

Use

<!-- Script to use -->

python

from transformers import pipeline
from tqdm.auto import tqdm

# Initialize the model
model_id = "zastuck/roberta-base-bosnian-parliament-multilabel-v1"
classifier = pipeline("text-classification", model=model_id, device=0, batch_size=32, top_k=None)

# Utilizing HuggingFace Dataset Objects for efficient batching
raw_scores = []
for out in tqdm(classifier(KeyDataset(raw_dataset, "segment")), total=len(raw_dataset)):
    # 'out' is a list: [{'label': 'PROCEDURAL', 'score': 0.9}, {'label': 'COLLECT_MEM', 'score': 0.1}, ...]
    # Turn this into a dictionary: {'PROCEDURAL': 0.9, 'COLLECT_MEM': 0.1, ...}
    label_dict = {item['label']: item['score'] for item in out}
    raw_scores.append(label_dict)

Training Details

Training Data

<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->

Training data was preprocessed from BiHCorp. It was machine translated and segmented into 512-token segments to fit into model context windows. This dataset is already split using MultilabelStratifiedShuffleSplit into a training and evaluation set.

zastuck/bosnian-parliament-700

Training Procedure

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

All training was done using Google Colab in a T4 environment. A total of 7 active learning rounds were applied. Active learning was used in batches of 100 with the following parameters for intial 4 runs.

python

from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer

training_args = TrainingArguments(output_dir="./results",
                                  eval_strategy="epoch",
                                  save_strategy="epoch",
                                  learning_rate=2e-5,
                                  per_device_train_batch_size=8,
                                  num_train_epochs=10,
                                  weight_decay=0.01,
                                  load_best_model_at_end=True,
                                  metric_for_best_model="f1_macro")

Final passes were completed using these parameters to avoid overfitting or other errors.

python

from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer

training_args = TrainingArguments(output_dir="./results",
                                  eval_strategy="epoch",
                                  save_strategy="epoch",
                                  learning_rate=5e-6,
                                  per_device_train_batch_size=7,
                                  label_smoothing_factor=0.1,
                                  num_train_epochs=10,
                                  weight_decay=0.3,
                                  load_best_model_at_end=True,
                                  metric_for_best_model="f1_macro")

Citation

<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->

BibTeX:

latex
@mastersthesis{stuck2026,
  author       = {Stuck, Zachary},
  title        = {Politics, Identity, and Ontological Security in Bosnia and Herzegovina},
  school       = {Charles University},
  year         = {2026},
  address      = {Prague},
  month        = {May},
  note         = {Advisor: doc. Aliaksei Kazharski, PhD.}
}

APA:

Stuck, Zachary: Politics, Identity, and Ontological Security in Bosnia and Herzegovina. Master’s thesis. Charles University, Faculty of Social Sciences, Institute of Political Studies, Prague. 2026, pages 46. Advisor: doc. Aliaksei Kazharski, PhD.