Views
No views yet
| Model | F1 Score | Accuracy | Loss |
|---|---|---|---|
| CBSI-bert-base-uncased | 0.88 | 0.88 | 0.49 |
| CBSI-bert-large-uncased | 0.92 | 0.92 | 0.45 |
| CBSI-ModernBERT-base | 0.93 | 0.93 | 0.40 |
| CBSI-ModernBERT-large | 0.91 | 0.91 | 0.53 |
| CBSI-CentralBank-BERT | 0.92 | 0.92 | 0.36 |
1import pandas as pd
2from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
3
4# Load model and tokenizer
5model_name = "brjoey/CBSI-CentralBank-BERT"
6classifier = pipeline(
7 "text-classification",
8 model=model_name,
9 tokenizer=model_name
10)
11
12# Define label mapping
13cbsi_label_map = {
14 0: "neutral",
15 1: "dovish",
16 2: "hawkish"
17}
18
19# Classify a column in a Pandas DataFrame - replace with your DataFrame
20texts = [
21 "The Governing Council decided to lower interest rates.",
22 "The central bank will maintain its current policy stance."
23]
24
25df = pd.DataFrame({
26 "text": texts
27})
28
29# Run classification
30predictions = classifier(
31 df["text"].tolist()
32)
33
34# Store the results
35df["label"], df["score"] = zip(*[
36 (cbsi_label_map[int(pred["label"].split("_")[-1])], pred["score"])
37 for pred in predictions
38])
39
40print("\n === Results ===\n")
41print(df[["text", "label", "score"]])