CoolFace
Modelpublic

z-dickson/CAP_multilingual

sourceHugging Faceafl-3.0updated 5mo agoView on Hugging Face
3likes41downloads
Model Card

Multilingual Bert base (multilingual uncased) model trained to predict CAP issue codes from text documents such as speeches, press releases, social media messages, news articles, bills, laws etc..

Model training on 120,000 assorted political documents -- mostly from the Comparative Agendas Project

Countries:

  • —Italy
  • —Sweden
  • —France
  • —Switzerland
  • —Poland
  • —Netherlands
  • —Germany
  • —Denmark
  • —Spain
  • —UK
  • —Austria
  • —Ireland

LABELS USED IN TRAINING

  • —Model labels -> CAP labels:
  • —{0: 1.0, 1: 2.0, 2: 3.0, 3: 4.0, 4: 5.0, 5: 6.0, 6: 7.0, 7: 8.0, 8: 9.0, 9: 10.0, 10: 12.0, 11: 13.0, 12: 14.0, 13: 15.0, 14: 16.0, 15: 17.0, 16: 18.0, 17: 19.0, 18: 20.0, 19: 23.0}
  • —Model labels -> CAP issues:
  • —{0: 'macroeconomics', 1: 'civilrights', 2: 'healthcare', 3: 'agriculture', 4: 'labour', 5: 'education', 6: 'environment', 7: 'energy', 8: 'immigration', 9: 'transportation', 10: 'lawcrime', 11: 'socialwelfare', 12: 'housing', 13: 'domesticcommerce', 14: 'defense', 15: 'technology', 16: 'foreigntrade', 17: 'internationalaffairs', 18: 'government_operations', 19: 'culture'}

# Validation

ClassPrecisionRecallF1-scoreSupport
00.720.830.77211
10.820.770.79242
20.820.860.84251
30.920.890.90228
40.810.850.83220
50.900.930.91244
60.870.870.87230
70.920.880.90251
80.940.900.92237
90.870.880.87263
100.700.880.78189
110.900.810.85248
120.870.900.88222
130.760.720.74255
140.840.840.84241
150.920.790.85276
160.950.900.92258
170.710.820.76200
180.770.730.75215
190.920.910.92239
Accuracy--- 0.85 ---
Macro Avg0.850.850.854720
Weighted Avg0.850.850.854720
python
from transformers import AutoModelForSequenceClassification
from transformers import TextClassificationPipeline, AutoTokenizer

mp = 'z-dickson/CAP_multilingual'
model = AutoModelForSequenceClassification.from_pretrained(mp)
tokenizer =  AutoTokenizer.from_pretrained(mp)

classifier = TextClassificationPipeline(tokenizer=tokenizer, model=model, device=0)

classifier("""
To ask the Secretary of State for Energy and Climate \\
Change what estimate he has made of the proportion of carbon \\
dioxide emissions arising in the UK attributable to burning.
"""
)