emotweetid-ekman7 / README.md
mahalisyarifuddin's picture
Anger pool re-decided from the Indonesian text only; exact 8b:1b:1b balanced splits; whole pools unsplit in `full`/`anger_split`; option-order control, probe matrix, flip audit and second-run reconfirmation shipped
675bd91 verified
|
Raw History Blame
27.1 kB
metadata
license: cc-by-4.0
pretty_name: >-
  EmoTweetID Ekman-7: five human-tagged Ekman emotions + the anger pool split
  into anger vs contempt by laya, from the Indonesian text
language:
  - id
  - en
tags:
  - emotion
  - anger
  - contempt
  - ekman
  - universal-emotions
  - text-classification
  - tweets
  - indonesian
  - weak-labels
  - laya
size_categories:
  - 1K<n<10K
task_categories:
  - text-classification
annotations_creators:
  - expert-generated
  - machine-generated
language_creators:
  - found
source_datasets:
  - EmoTweetID
task_ids:
  - multi-class-classification
configs:
  - config_name: balanced
    default: true
    data_files:
      - split: train
        path: balanced/train.parquet
      - split: valid
        path: balanced/valid.parquet
      - split: test
        path: balanced/test.parquet
  - config_name: full
    data_files:
      - split: train
        path: full/train.parquet
  - config_name: anger_split
    data_files:
      - split: train
        path: anger_split/train.parquet
  - config_name: anger_split_balanced
    data_files:
      - split: train
        path: anger_split_balanced/train.parquet
      - split: valid
        path: anger_split_balanced/valid.parquet
      - split: test
        path: anger_split_balanced/test.parquet

EmoTweetID under Ekman's seven universal emotions

2,243 Indonesian tweets, one label each from Ekman's universal set - anger, contempt, disgust, enjoyment, fear, sadness, surprise. 475 of them are the pool EmoTweetID tagged anger, and that pool is the only place this dataset makes a decision of its own: laya reads each of those tweets, in Indonesian, against Ekman's own definitions of the two emotions, and splits them into anger (289) and contempt (186) - contempt is 39.2% of the pool. The other five classes are EmoTweetID's human annotations, carried over verbatim. Four configs: full and anger_split are the complete pools, each in a single split; balanced (default) and anger_split_balanced are exact 8:1:1 train/valid/test, seed 0, no duplicate leakage.

Why bother: Ekman lists anger and contempt as two different universal emotions with different triggers, different messages and different facial signatures, but emotion corpora - and the models trained on them - fold contempt into anger. That loses exactly the distinction that matters when a system has to tell "you wronged me, put it right" from "you are beneath me".

class rows share origin
anger 289 12.9% split here: laya on the anger pool
contempt 186 8.3% split here: laya on the anger pool
disgust 355 15.8% EmoTweetID annotators, kept verbatim
enjoyment 429 19.1% EmoTweetID annotators, kept verbatim
fear 395 17.6% EmoTweetID annotators, kept verbatim
sadness 303 13.5% EmoTweetID annotators, kept verbatim
surprise 286 12.8% EmoTweetID annotators, kept verbatim

How each class got its label

source label (EmoTweetID, human) rows treatment here
joy 429 kept, renamed to Ekman's enjoyment
fear 395 kept
disgust 355 kept
sadness 303 kept
surprise 286 kept
anger 475 re-read by laya, in Indonesian, and split into anger / contempt

label_origin on every row says which of the two applies, and source_label always keeps the upstream name. Nothing else in the schema was modelled; there is no neutral class because EmoTweetID did not tag one (its keyword sampling deliberately selected emotional tweets), unlike GoEmotions - which is why this card has 7 classes where the reference has 8.

Source

  • EmoTweetID - Nugroho, Bachtiar, Mahmudy, Henry, Isnan, Pangestu, Pardamean, Data in Brief 68:113119 (2026), PMC13495581. 2,243 Indonesian X/Twitter posts annotated into Ekman's six basic emotions by three psychology students, lexicon-assisted, majority vote, substantial inter-annotator agreement (Fleiss' kappa). Files: the labelled CSV (tweet, label) and its English translation (tweet_en) from Mendeley Data jzgnjsff9f.
  • Licence: CC BY 4.0 on the source; this derived dataset is CC BY 4.0 as well.
  • Definitions: What is Anger? and What is Contempt?, Paul Ekman Group. The criteria shown to the model are condensed from these two pages.
  • Language: every label here is decided from text, the tweet as written. text_en is EmoTweetID's machine translation and is never an input to any label; it ships only because it is upstream data. An earlier reading of this same pool used text and text_en together; those rows, their probabilities and the caches behind them are kept in out_prev/, so the two readings can be compared row by row - it labelled 381 anger / 94 contempt; the labels here differ on 116 of the 475 rows, 104 of them anger -> contempt.

The two classes the split turns on, in Ekman's words

anger "...arises when we are blocked from pursuing a goal and/or treated unfairly. ... The primary message of anger is, 'Get out of my way!' and communicates anything from mere dissatisfaction to threats." Triggers: interference, injustice, someone trying to hurt us or a loved one, another person's anger, betrayal/abandonment/rejection, seeing someone break a law or cultural rule. The constructive form "focus[es] on the action, not the actor".

contempt "...the feeling of dislike for and superiority (usually morally) over another person, group of people, and/or their actions. ... The basic notion of contempt is: 'I'm better than you and you are lesser than me.'" Its usual trigger is "immoral action by a person or group of people to whom you feel superior"; it "asserts power or status" and signals "not needing to accomodate or engage". Unlike disgust it carries that superiority component; unlike anger, "in contempt we don't necessarily want to remove ourselves from the situation".

Operational boundary: anger wants the obstacle gone; contempt puts the target below the argument.

How the anger split was decided

pip install laya (v0.3.4), checkpoint convaiinnovations/laya, subfolder multilingual/: 321.9M params in 170 tensors - a 306.9M jhu-clsp/mmBERT-base encoder (modernbert, bf16 weights, vocab 256000, laya's own context cap 1024 tokens) plus 15.0M of decision heads that turn one forward pass into probabilities over the options you asked about. For each tweet: one choice question whose two options are Ekman's criteria above, the same question again with the options in the opposite order, noul probes of each emotion's core feature (superiority, blocked-or-unfair) on the rows the choice head could not settle, and a not_anger_or_contempt veto as a diagnostic. One non-autoregressive forward pass per question - no generation, so nothing to parse and nothing to hallucinate. Every tweet is read in Indonesian; the question itself stays laya's own English prompt, i.e. Ekman's criteria are quoted in the language they were written in.

The four stages, over the 475 anger-pool rows:

stage question(s) rows scored (state x question) what it is for
id_core ekman (choice) 475 the decision
id_core_swap same, contempt listed first 475 option-order control (p_anger_swapped)
id_diag superiority, blocked_or_unfair 108 only on the rows id_core left under a 0.10 margin
id_veto not_anger_or_contempt 475 off-topic diagnostic - do not filter on it

The decision rule, in order:

  1. the choice reading is decisive (|p(anger) - p(contempt)| >= 0.1) -> its argmax (ekman_choice_id);
  2. not decisive -> Ekman's core-feature probes break the tie, superiority => contempt, blocked-or-unfair => anger (ekman_noul_tiebreak);
  3. both still under the margin -> the average of the two option orders decides, if it has a side (ekman_choice_order_avg);
  4. nothing at all -> keep the upstream EmoTweetID label anger (kept_original_label): this dataset only ever splits an existing anger pool, it never re-litigates it.

Realised as: ekman_choice_id 421, ekman_noul_tiebreak 33, ekman_choice_order_avg 18, kept_original_label 3. Every probability is on the row - p_anger_id (as prompted), p_anger_swapped (options reversed), ekman_p_anger, ekman_p_contempt, ekman_margin_id, p_superiority, p_blocked_or_unfair, p_not_anger_or_contempt - so you can re-cut the split with your own threshold instead of trusting this rule.

Reproducibility: the id_core stage matches the earlier two-language run's out_prev/cache_id_core.json (shipped here) to the last digit - 471/471 unique texts on the same side of the decision line, mean |delta p(anger)| 0.0000, max 0.0000. On a second, complete run of the labeller - fresh caches, same sandbox - every stage (id_core, id_core_swap, id_diag, id_veto) matched row for row and reproduced 475/475 labels, down to a byte-identical anger_ekman_rows.csv, the largest probability difference anywhere being 0.000000 (856.6 s of model time against 851.2 s for the shipped run); that run's summary is out/reconfirm.json and its console log runs/label_run_id_reconfirm.log.

Quality checks on the machine labels - read before using them

Fit-for-purpose probes, in both languages. 16 hand-written unambiguous sentences (8 clear anger, 8 clear contempt, written from the two Ekman pages, not from the corpus) in Indonesian and in English, plus the project's reference English probe set, and the two controls that matter (question language, option order). Chance is 0.50.

condition accuracy
the project's 16 reference English probes, English question 13/16 (0.812)
the same 16 items in English, English question 14/16 (0.875)
the same 16 probes in Indonesian, English question - the reading this dataset uses 11/16 (0.688)
the same Indonesian probes with an Indonesian question 12/16 (0.750)
English probes with an Indonesian question 14/16 (0.875)
Indonesian probes, criteria order swapped (contempt first) 11/16 (0.688)

The gap is 3 items out of 16: the same sentences are called correctly 14 times in English and 11 times in Indonesian. Mean P(anger) on the anger probes 0.68 in Indonesian vs 0.80 in English; on the contempt probes 0.31 vs 0.20. On the contempt items the mean P(anger) is 0.31 with anger listed first and 0.48 with contempt listed first - the order effect seen on the corpus. The Indonesian reading is therefore the weaker of the two on these probes, and its errors lean toward contempt; putting the question in Indonesian does not recover the gap (with the question in Indonesian instead of English, the gap closes only 11 -> 12 items).

Option-order sensitivity on the corpus. Listing contempt first moved the argmax on 25.1% of the pool (mean |delta p(anger)| 0.191; mean P(anger) 0.589 as prompted vs 0.726 with the options swapped), so the prompt's option order is worth roughly a third of the contempt shift. p_anger_swapped ships on every row, so the debiased reading is (p_anger_id + p_anger_swapped) / 2 if you want it.

The corpus's own anger vocabulary. 373 of the 475 pool rows contain an explicit Indonesian anger word (kesal, marah, murka, benci, jengkel, geram, tersinggung, muak, ngamuk) - which is how EmoTweetID's annotators sampled, so the word is upstream evidence for anger. 141 of those 373 rows (38%) are labelled contempt here. This is the sharpest single piece of evidence on this card: the words that most plainly mean anger in Indonesian are where the Indonesian reading calls contempt most often.

One-reader audit of the disagreements. A sample of 37 rows where the readings disagree was judged against the operational boundary by one reader working from the tweet text alone, before seeing any probability: 18/37 of those judgements land on the two-language reading, 4/37 on the label here, and 13/37 read as neither emotion. Of the 20 rows labelled contempt here and anger by the two-language reading, 1 was accepted as contempt. The reader is a machine reader, not a human annotator, and works on short code-mixed text - a signal, not gold labels.

The noul probes are weak - and here they do more work than they should. Their separation on the probe sentences is small (mean P(superiority) 0.16 on contempt vs 0.13 on anger, which is why an earlier reading of this pool only trusted them for 2 of 475 rows). On this reading 54 rows come out inside the 0.10 margin, and 33 of them are decided by those probes - so a weak tie-breaker settles 33 labels. Prefer the probability columns to label if that matters for your use: ekman_choice_id decided 421, the option-order average 18, the upstream anger label 3.

Do not filter on p_not_anger_or_contempt. 18 of 475 rows above 0.5 (mean P(neither) 0.12) - Indonesian reading. The most-flagged rows include some of the angriest tweets in the pool (AK MURKA, SUMPAH GUA MURKA LIAT INI. PEN GUA TEBAS JUGA LU PAK), so the probe is picking up register, not mislabels. It ships as a documented dead end.

Confidence. 99 of 475 rows land within 0.10 of a coin flip on the primary reading (max probability of the two options under 0.60), and the mean max probability across the pool is 0.754. ekman_confidence is laya's own confidence for the reading (1 - normalised entropy, 0 = a coin flip), and 391 rows sit under 0.6. Note that out_prev/ stores max P(anger) in that column instead - a different scale, so the two are not directly comparable.

Bottom line: all 475 pool labels are a machine decision from a 322M model whose own card calls it "a fast base to specialise, not a zero-shot decision engine", asked in the language that measures weaker on the probes above. The other 1,768 rows are human labels. label_origin marks which is which; model and human error are not comparable across it, and the anger/contempt rows are the noisier subset.

Schema

field type meaning
text string the tweet as written (Indonesian) - the model input
text_en string EmoTweetID's English machine translation. Not an input to any label here - kept because it is upstream data
label string one of the 7 Ekman classes
label_idx ClassLabel label as an int, in the order anger, contempt, disgust, enjoyment, fear, sadness, surprise (anger, contempt in the anger_split configs)
source_label string upstream EmoTweetID label (anger, joy, fear, disgust, sadness, surprise)
label_origin string upstream_manual (human label kept) or laya_anger_split (machine relabelled)
label_source string which rule produced an anger-pool label; null elsewhere
ambiguous bool the Indonesian choice reading stayed under the 0.10 margin
ekman_p_anger, ekman_p_contempt float32 the probabilities behind the label; null off the anger pool
ekman_confidence float32 laya's normalised-entropy confidence (0 = a coin flip)
p_anger_id, ekman_margin_id float32 the Indonesian reading: P(anger) and p(anger) - p(contempt)
p_anger_swapped float32 the same question with the criteria reversed - the option-order control
p_superiority, p_blocked_or_unfair float32 Ekman core-feature probes; only run on the rows the choice head could not settle, so null on most rows
p_not_anger_or_contempt float32 veto probe - weak, see quality checks
row_src int32 row index in EmoTweetID's Data-Annotated-Tweet-File-RESULT.csv

Configs, splits, sizes

Two kinds of config, on purpose.

Whole pools. full is all 2,243 rows at their natural class imbalance and anger_split is the 475-row anger pool on its own, every evidence column populated. Each ships a single train split holding the complete pool - nothing is held out, and if you want a validation set you take it from there yourself.

Exact 8:1:1. balanced (the default) and anger_split_balanced are the two configs that carry a train/valid/test. b = floor(N/10) is the bottleneck and the unit of the split: each class is sampled to 180 rows - the largest multiple of ten that fits the smallest class, contempt, at 186 eligible rows - giving N = 1,260 and b = 126. No rounding is left anywhere: every class lands 144 / 18 / 18 per split, so the config is exactly balanced per class and exactly 8b : 1b : 1b overall. anger_split_balanced applies the same rule to the 2-class pool: 360 rows, 288 / 36 / 36 overall and 144 / 18 / 18 per class. Sampling uses seed 0 and keeps whole duplicate groups, so a wording never straddles two splits and a dropped row never orphans its duplicate.

split_exact.py and test_split_exact.py hold the arithmetic and the assertions; verify() re-checks the written parquet, including that each class is the same size in every split.

config split rows per class
balanced train 1,008 anger 144 / contempt 144 / disgust 144 / enjoyment 144 / fear 144 / sadness 144 / surprise 144
balanced valid 126 anger 18 / contempt 18 / disgust 18 / enjoyment 18 / fear 18 / sadness 18 / surprise 18
balanced test 126 anger 18 / contempt 18 / disgust 18 / enjoyment 18 / fear 18 / sadness 18 / surprise 18
full train 2,243 anger 289 / contempt 186 / disgust 355 / enjoyment 429 / fear 395 / sadness 303 / surprise 286 (the whole pool, one split)
anger_split train 475 anger 289 / contempt 186 (the whole pool, one split)
anger_split_balanced train 288 anger 144 / contempt 144
anger_split_balanced valid 36 anger 18 / contempt 18
anger_split_balanced test 36 anger 18 / contempt 18

29 rows share an identical text string with another row (more, if you count pairs whose English translation collides), and 14 of those repeated wordings repeat with different upstream labels - the annotators disagreed, and this dataset inherits that rather than re-judging it. Splitting is therefore group-aware: every member of a duplicate group lands in one split, so no wording appears in either side of a train/valid/test boundary (verify() fails the build if one does). The balanced configs sample whole groups as well, so a dropped row never orphans its duplicate.

What the run cost, and what the optimisations were worth

Measured in a 2 vCPU / 2 GB CPU-only sandbox (torch 2.14.0+cpu, laya 0.3.4): 1533 row-scores in 851.2 s of model time (id core 299.8 s, id core swap 299.5 s, id diag 53.5 s, id veto 198.4 s). Asking all four questions of every row would have cost 1900.

change why measured effect
keep the encoder at bf16 instead of laya's forced fp32 laya sets dtype = torch.float32 on CPU, upcasting the bf16 checkpoint to 1.29 GB; the stock path was OOM-killed with exit 137 before it made a single prediction the run goes from impossible to a 1420 MB peak RSS
zero-copy checkpoint load (mmap views instead of safetensors.load_file) the stock loader materialises the 643 MB a second time before copying it into the model removes a 643 MB transient; weights verified bitwise-identical to stock load_file
staged questions - the choice on every row, the core-feature probes only where the reading was not decisive, the veto and the order control as their own passes asking every question everywhere costs 1900 row-scores 1533 instead
length-sorted, token-budgeted batches laya's predict costs one forward pass per state 1.25x on the biggest stage at a 1024-token cap; small caps win because attention is quadratic per row and laya pads every row of a pass to that pass's longest sequence
per-stage resumable cache (out/cache_<stage>.json, shipped) the decision rule can change after the model has run all labels re-derived in seconds instead of a 15-minute re-run

Two traps worth knowing:

  • max_len is not a speed dial. laya builds [CLS] <question + options> [SEP] <state> [SEP] and only truncates at max_len, so a 214-token sequence costs the same at max_len=1024 as at 256 (measured 1.04x). The ~150-token prompt head every row pays is what dominates, so criteria length is the real budget: cutting head_max_len 256 -> 128 left all 48 sampled argmaxes unchanged (mean abs probability shift 0.045, exactly 0.000 at >=160), while 96 flipped 23% of them - so 144 was chosen (sweep_config.py).
  • laya truncates every option at 48 tokens (build_sequence), so the criteria have to fit that cap or the model scores half of Ekman's definition; assert_option_budget() fails the run if they ever stop fitting, in either language.

Using it

from datasets import load_dataset
ds = load_dataset("mahalisyarifuddin/emotweetid-ekman7", "balanced")        # default: exact 8:1:1, 7 classes, 180/class
ds["train"][0]["text"], ds["train"][0]["label"]

whole = load_dataset("mahalisyarifuddin/emotweetid-ekman7", "full")         # every row, one `train` split
whole["train"]                                   # 2,243 rows, natural imbalance

# the anger work on its own, with every evidence column:
ang = load_dataset("mahalisyarifuddin/emotweetid-ekman7", "anger_split")    # all 475 pool rows, one split
ang = load_dataset("mahalisyarifuddin/emotweetid-ekman7", "anger_split_balanced")   # same pool, 1:1, exact 8:1:1

If you want the option-order-debiased reading, recompute it from the shipped columns:

p = (ang["train"]["p_anger_id"] + ang["train"]["p_anger_swapped"]) / 2   # 1 = anger, 0 = contempt

Or reproduce it end to end:

pip install laya scikit-learn pandas pyarrow datasets huggingface_hub scipy
python fetch_source_data.py                       # data/file1.csv + data/file2.csv (CC BY 4.0)
python prepare_checkpoint.py                      # models/laya-ml + models/enc-bf16 (bf16, low-mem)
python probe_quality_id.py                        # the probe matrix -> out/probe_quality_id.json
python label_anger_id.py --out out                # ~15 min on 2 CPU cores, Indonesian only
python test_split_exact.py                        # exact 8:1:1 + no-leakage assertions
python make_dataset.py                            # splits + parquet + this card, with verification
python publish.py --repo <namespace>/<name>        # HF upload; needs HF_TOKEN with write scope

Built with laya 0.3.4, transformers 5.17.0, datasets 5.0.1, torch 2.14.0+cpu on CPU. The model was never loaded to build this repo's numbers: build_info.checkpoint_facts reads them from the checkpoint's safetensors header.

Everything is in this repo: label_anger_id.py (the labeller as run), ekman_questions.py, ekman_questions_id.py, laya_opt.py, split_exact.py + test_split_exact.py, zcsafe.py, prepare_checkpoint.py, make_dataset.py, probe_quality_id.py, probes.py / probes_id.py, audit_flips.py, fetch_source_data.py, publish.py, and the benchmarking scripts (bench_speedup.py, bench_batch.py, sweep_config.py, check_veto_and_speed.py). The score caches and evidence behind every label are in out/ (cache_id_core.json, cache_id_core_swap.json, cache_id_diag.json, cache_id_veto.json, anger_ekman_rows.csv, probe_quality_id.json, audit_flips.csv, timings.json), and the project's earlier two-language reading of the pool in out_prev/, so every claim on this card can be re-derived from the repo without the model. build_info.json holds the exact counts behind it.

Limitations

  • The Indonesian reading is the weaker of the two this project has measured, and the probe matrix above says by how much: the same 16 sentences are called correctly 14/16 (0.875) in English and 11/16 (0.688) in Indonesian, the errors lean toward contempt, and the reading moves with the option order (25.1% of the pool). For the best anger/contempt discriminator this pipeline has produced, take the two-language labels in out_prev/anger_ekman_rows.csv; for a decision that never depends on a machine translation, use these.
  • Machine labels are weak-ish in general. A 322M base model that laya's own card describes as "a fast base to specialise, not a zero-shot decision engine" means the hard middle of the anger pool is genuinely uncertain - exactly where Ekman says contempt rides along with mild anger ("often accompanied by anger, usually in a mild form such as annoyance").
  • Mixed provenance. 475 rows carry a machine decision; the other 1,768 carry the annotators' labels. label_origin marks it; comparisons across the two are not apples-to-apples, and any error analysis should be stratified by it.
  • contempt is still small for a production need: 186 rows in the pool, so the balanced configs give it 180 rows per class - enough for a two-way study or a fine-tuning seed, not for a claim about contempt detection in the wild.
  • text_en is machine translation and stays in the schema for reference only. Every label is decided from text.
  • Upstream noise carries into the pool. Only anger was audited; a mislabelled joy/disgust row stays mislabelled here. The upstream annotation had substantial, not perfect, agreement, and the audit above found several pool rows that read as neither anger nor contempt.
  • No neutral class, and no intensity scores: an intensity question was written and measured, did not discriminate (1.1-1.8 on all 16 probes), so it is not asked - it stays in ekman_questions.py as a documented dead end rather than shipping as noise.
  • Tweets are raw: all-caps, code-mixed Indonesian/Javanese/Malay, slang, emoji, insults and slurs. Only whitespace was normalised.

Citation

@article{NUGROHO2026113119,
  title   = {EmoTweetID: A dataset of Indonesian tweets for emotion classification and word
             embedding construction},
  author  = {Kuncahyo Setyo Nugroho and Fitra Abdurrachman Bachtiar and Wayan Firdaus Mahmudy and
             Matthew Martianus Henry and Mahmud Isnan and Gusti Pangestu and Bens Pardamean},
  journal = {Data in Brief},
  volume  = {68},
  pages   = {113119},
  year    = {2026},
  doi     = {10.1016/j.dib.2026.113119}
}

Licence and ethics

CC BY 4.0 (the source dataset's licence), with attribution to EmoTweetID and quoting of the Paul Ekman Group's definitions. The tweets are public posts but are not de-identified - handles and self-identifying details can appear inside text; EmoTweetID removed retweets, sensitive replies and duplicates, but re-publishing raw text carries residual privacy risk. Nothing here is a judgement about the people in the tweets: do not use these labels to infer anything about an individual.