jimnoneill commited on
Commit
3c2158c
·
verified ·
1 Parent(s): 3e2c08a

Model card: training sources, dates and label cutoffs; pilot design; archive links

Browse files
Files changed (1) hide show
  1. README.md +47 -26
README.md CHANGED
@@ -12,30 +12,47 @@ pipeline_tag: text-classification
12
 
13
  # Political provocation classifiers and the Toxicity Index (TI7)
14
 
15
- Eight SetFit classifiers for tactics of political provocation in short social media posts, released with O'Neill, Cabanillas, Kepner, Goggin, and Brooks (2026), *Forecasting provocation and posting rhythm in the United States Congress* (manuscript in preparation). Together with six off-the-shelf classifiers they produce the seven-dimension Toxicity Index used in the paper.
16
 
17
  ## Classifiers in this repository
18
 
19
- | Folder | Construct | Positive class |
20
- |---|---|---|
21
- | `setfit_ragebait` | Ragebait | Content designed to provoke outrage |
22
- | `setfit_tribal_signal` | Tribal signaling | Us-versus-them, in-group and out-group framing |
23
- | `setfit_performative_outrage` | Performative outrage | Theatrical outrage aimed at an audience |
24
- | `setfit_epistemic_manipulation` | Epistemic manipulation | Cherry-picking, straw-manning, false equivalence |
25
- | `setfit_engagement_bait` | Engagement baiting | Polls, calls to action, rhetorical bait |
26
- | `setfit_agency_language` | Agency language | Active, agentic framing (versus passive or victim framing) |
27
- | `setfit_political_advocacy` | Policy advocacy | Substantive policy communication |
28
- | `setfit_genuine_anger` | Genuine anger | Expressed anger (see the caution below) |
 
 
 
 
 
 
29
 
30
- Backbone: sentence-transformers all-mpnet-base-v2 with a logistic-regression head (SetFit). Load with `SetFitModel.from_pretrained("jimnoneill/xbox-compulsion-classifier", subfolder="setfit_ragebait")` and use `predict_proba` for the positive-class probability.
 
 
 
 
 
31
 
32
- ## Training labels
33
 
34
- Training posts were drawn from congressional accounts balanced by party (4,121 posts from 14 accounts). Labels were produced in two steps: a language model assigned initial scores from 0 to 1 using written definitions with examples from both parties, and one author then reviewed every score and corrected it where needed. Each classifier was trained on a balanced subset with an 80/20 train and test split (80 training posts for ragebait and epistemic manipulation, 252 for genuine anger, 320 for the others).
 
 
 
 
 
 
35
 
36
  ## Performance
37
 
38
- Five-fold cross-validation against the reviewed labels, folds stratified by label and grouped by account so that no account contributes posts to both sides of a fold; each fold retrains with the original hyperparameters and training-set size.
39
 
40
  | Classifier | n | AUC (SD) | F1 at 0.5 (SD) | Precision | Recall |
41
  |---|---|---|---|---|---|
@@ -48,21 +65,21 @@ Five-fold cross-validation against the reviewed labels, folds stratified by labe
48
  | Policy advocacy | 995 | 0.931 (0.013) | 0.905 (0.021) | 0.924 | 0.888 |
49
  | Genuine anger | 901 | 0.970 (0.021) | 0.766 (0.082) | 0.684 | 0.887 |
50
 
51
- The released checkpoints score AUC 0.89 to 0.94 on all labeled posts they never trained on.
52
 
53
- Independent validation: two coders independently coded 150 held-out congressional posts for genuine anger, policy advocacy, and performative outrage (Krippendorff alpha 0.83, 0.80, 0.81). Against the coder consensus, the performative outrage classifier reaches AUC 0.95 and the advocacy classifier 0.77.
54
 
55
  ## Caution on the genuine-anger classifier
56
 
57
- Against independent human coding, the genuine-anger classifier ranks human-coded anger well (AUC 0.87) but over-predicts it (it fires on about 29 percent of congressional posts against a human base rate near 5 percent), and it ranks human-coded performative outrage almost as well (AUC 0.92). It behaves as a hostility and partisan-attack detector, and it is excluded from the Toxicity Index. Use it only with that interpretation.
58
 
59
- A related finding concerns an off-the-shelf model: the CardiffNLP emotion classifier's anger label is inversely related to human-coded anger on congressional text (AUC 0.11) and mostly flags policy advocacy. We do not recommend it for measuring anger in political communication.
60
 
61
  ## Toxicity Index (TI7)
62
 
63
- TI7 for a post is the mean of seven positive-class probabilities: offensive language, toxicity, and negative sentiment (off-the-shelf), irony (off-the-shelf), and ragebait, tribal signaling, and performative outrage (this repository). It ranges from 0 to 1. A member's or account's index is the mean over posts. Policy advocacy is reported as a separate dimension.
64
 
65
- | Off-the-shelf head | Model |
66
  |---|---|
67
  | Sentiment | cardiffnlp/twitter-roberta-base-sentiment-latest |
68
  | Emotion | cardiffnlp/twitter-roberta-base-emotion |
@@ -71,18 +88,22 @@ TI7 for a post is the mean of seven positive-class probabilities: offensive lang
71
  | Hate | cardiffnlp/twitter-roberta-base-hate-multiclass-latest |
72
  | Toxicity | s-nlp/roberta_toxicity_classifier |
73
 
74
- ## Code
 
 
 
 
75
 
76
- The `xbox/` package in this repository contains the scoring code and the analysis modules (stream hygiene, rhythm descriptors, roll-call location model, point-process models, binned count models, and the forecasting experiments). The full analysis scripts will be released at github.com/jimnoneill/xbox-toxicity-index with the preprint.
77
 
78
  ## Superseded files
79
 
80
- `bayesian_model_results.json`, `calibrated_model_v2.json`, `cohort_signatures.csv`, `cohort_v2_results.csv`, and the modules `xbox/compulsion_signatures.py`, `xbox/disorder_baseline.py`, and `xbox/fusion.py` belong to an earlier version of this project that estimated a compulsion probability from posting rhythm. That model is not used in the paper and its earlier validation figures should not be relied on. Rhythm is described in the paper with model-free descriptors and evaluated through out-of-sample forecasts.
81
 
82
  ## Intended use and limits
83
 
84
- Research on political communication at the population level. The scores describe text; they are not designed to support inferences about the mental health or character of any individual. Training labels were reviewed by a single author; a multi-coder reliability study of all dimensions is planned.
85
 
86
  ## Citation
87
 
88
- O'Neill, J., Cabanillas, J., Kepner, W., Goggin, S. N., & Brooks, J. (2026). Forecasting provocation and posting rhythm in the United States Congress. Manuscript in preparation.
 
12
 
13
  # Political provocation classifiers and the Toxicity Index (TI7)
14
 
15
+ Eight SetFit classifiers for tactics of political provocation in short social media posts, released with O'Neill, Cabanillas, Kepner, Goggin, and Brooks (2026), *The Toxicity Index: measuring political provocation in the United States Congress* (manuscript in preparation). Three of them, together with four general-purpose classifiers, produce the seven-component Toxicity Index (TI7) used in the paper.
16
 
17
  ## Classifiers in this repository
18
 
19
+ | Folder | Construct | Positive class | Role in the paper |
20
+ |---|---|---|---|
21
+ | `setfit_ragebait` | Ragebait | Content framed to provoke outrage beyond its informational content | TI7 component |
22
+ | `setfit_tribal_signal` | Tribal signaling | Us-versus-them framing marking in-group loyalty or out-group hostility | TI7 component |
23
+ | `setfit_performative_outrage` | Performative outrage | Theatrical indignation staged for an audience | TI7 component |
24
+ | `setfit_political_advocacy` | Policy advocacy | Substantive communication of policy positions or legislative action | Reported beside TI7 |
25
+ | `setfit_genuine_anger` | Genuine anger | Text coded as angry rather than staged (see the caution below) | Excluded from TI7 |
26
+ | `setfit_epistemic_manipulation` | Epistemic manipulation | Cherry-picking, straw-manning, false equivalence | Released, not analyzed |
27
+ | `setfit_engagement_bait` | Engagement baiting | Polls, calls to action, rhetorical bait | Released, not analyzed |
28
+ | `setfit_agency_language` | Agency language | Active, agentic framing (versus passive or victim framing) | Released, not analyzed |
29
+
30
+ Each classifier turns a post into a numerical representation with a fine-tuned sentence-embedding model (sentence-transformers all-mpnet-base-v2) and applies a logistic-regression head (SetFit). Load with `SetFitModel.from_pretrained("jimnoneill/xbox-compulsion-classifier", subfolder="setfit_ragebait")` and use `predict_proba` for the positive-class probability.
31
+
32
+ ## Training data
33
+
34
+ Labels were produced in two steps. A language model assigned initial scores from 0 to 1 under written definitions with examples from both parties, and one author then reviewed every score and corrected it where needed.
35
 
36
+ | Pool | Posts | Source | Dates | Classifiers |
37
+ |---|---|---|---|---|
38
+ | A | 1,972 | One senator's personal account (X API archive) | 25 Jul 2022 to 22 Feb 2026 | Ragebait and epistemic manipulation (pool A only); the four below with pool B |
39
+ | B | 1,949 | 13 senators' accounts, from the Hugging Face dataset m-newhauser/senator-tweets | 20 Jan to 30 Dec 2021 | Tribal signaling, performative outrage, engagement baiting, agency language (with pool A) |
40
+ | B | 200 | Donald Trump's account, from the Trump Twitter Archive (the one noncongressional account) | 2010 to 2017 | As above |
41
+ | C | 1,000 | 562 congressional accounts in the congresstweets archive | 2017 to 2023 | Policy advocacy, genuine anger |
42
 
43
+ The 14 accounts of pool B are balanced by party: seven Democratic (counting Senator Sanders) and seven Republican.
44
 
45
+ Reviewed scores were converted to present and absent labels with construct-specific cutoffs; posts between the cutoffs were left out.
46
+
47
+ | Classifiers | Present at or above | Absent at or below |
48
+ |---|---|---|
49
+ | Ragebait, epistemic manipulation | 0.65 | 0.35 |
50
+ | Tribal signaling, performative outrage, engagement baiting, agency language, policy advocacy | 0.65 | 0.30 |
51
+ | Genuine anger (clearly angry posts were rare) | 0.40 | 0.10 |
52
 
53
  ## Performance
54
 
55
+ Five-fold cross-validation against the reviewed labels. Posts were grouped by account where account identifiers existed and by exact text for pool A, so that the same account or text never contributes to both sides of a fold. Each fold retrains with the original hyperparameters and training-set size.
56
 
57
  | Classifier | n | AUC (SD) | F1 at 0.5 (SD) | Precision | Recall |
58
  |---|---|---|---|---|---|
 
65
  | Policy advocacy | 995 | 0.931 (0.013) | 0.905 (0.021) | 0.924 | 0.888 |
66
  | Genuine anger | 901 | 0.970 (0.021) | 0.766 (0.082) | 0.684 | 0.887 |
67
 
68
+ Cross-validation measures agreement with the training-label scheme. It is not independent validation and does not show that the probabilities are calibrated.
69
 
70
+ Human-coding pilot: 150 congressional posts were drawn from four strata chosen to probe the anger question (60 that the general-purpose emotion model labeled anger with high confidence, 30 labeled joy, 30 with high advocacy and low hostility scores, and 30 random posts, balanced by party). The first coder affirmed a sheet prefilled with model scores; the second coder independently completed a blank sheet. Krippendorff's alpha was about 0.83 (genuine anger), 0.80 (advocacy) and 0.81 (performative outrage). Against the second coder's labels, the performative-outrage classifier reached AUC 0.93 and the policy-advocacy classifier 0.75. The pilot is a diagnostic check of three constructs, not a population performance estimate.
71
 
72
  ## Caution on the genuine-anger classifier
73
 
74
+ Against the second coder, the genuine-anger classifier ranked human-coded anger well (AUC 0.87), but only ten of the 150 pilot posts were anger-positive. In an every-third-day sample of the congresstweets archive it flagged 29 percent of posts, and its score correlated strongly with performative outrage (Spearman rho 0.80). It behaves as a hostility and partisan-attack detector and is excluded from TI7. Use it only with that interpretation.
75
 
76
+ A related finding concerns a general-purpose model: the anger score of the TweetNLP emotion model (cardiffnlp/twitter-roberta-base-emotion) ranked the second coder's anger labels inversely (AUC 0.13), and 63 of the 96 pilot posts it labeled anger were coded as policy advocacy. We do not recommend it for measuring anger in political communication.
77
 
78
  ## Toxicity Index (TI7)
79
 
80
+ TI7 for a post is the mean of seven positive-class probabilities: offensive language, toxicity, negative sentiment and irony (general-purpose), and ragebait, tribal signaling and performative outrage (this repository). It ranges from 0 to 1. A member's or account's score is the mean over non-repost posts. Policy advocacy is reported as a separate score.
81
 
82
+ | General-purpose classifier | Model |
83
  |---|---|
84
  | Sentiment | cardiffnlp/twitter-roberta-base-sentiment-latest |
85
  | Emotion | cardiffnlp/twitter-roberta-base-emotion |
 
88
  | Hate | cardiffnlp/twitter-roberta-base-hate-multiclass-latest |
89
  | Toxicity | s-nlp/roberta_toxicity_classifier |
90
 
91
+ ## Code and archives
92
+
93
+ - Analysis code: https://github.com/jimnoneill/xbox-toxicity-index
94
+ - Software archive: https://doi.org/10.5281/zenodo.24095873 (version 2026.11.09)
95
+ - Derived results and annotation metadata, including the numeric training-label projections and per-classifier cutoffs: https://doi.org/10.5281/zenodo.24095876 (version 2026.11.09)
96
 
97
+ The `xbox/` package in this repository contains the scoring code and the analysis modules (stream hygiene, rhythm descriptors, roll-call location model, point-process models, binned count models and the forecasting experiments).
98
 
99
  ## Superseded files
100
 
101
+ `bayesian_model_results.json`, `calibrated_model_v2.json`, `cohort_signatures.csv`, `cohort_v2_results.csv`, and the modules `xbox/compulsion_signatures.py`, `xbox/disorder_baseline.py` and `xbox/fusion.py` belong to an earlier version of this project that estimated a compulsion probability from posting rhythm. That model is not used in the paper and its earlier validation figures should not be relied on.
102
 
103
  ## Intended use and limits
104
 
105
+ Research on political communication at the population level. The scores describe text; they are not designed to support inferences about the mental health or character of any individual. Training labels were reviewed by a single author, and only performative outrage among the TI7 components was checked in the human-coding pilot. TI7 is an operational composite that has not been independently validated as a scale.
106
 
107
  ## Citation
108
 
109
+ O'Neill, J., Cabanillas, J., Kepner, W., Goggin, S. N., & Brooks, J. (2026). The Toxicity Index: measuring political provocation in the United States Congress. Manuscript in preparation.