emotweetid-ekman7 / README.template.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 Contribute Delete
23.5 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

{{n_pool}} Indonesian tweets, one label each from Ekman's universal set - anger, contempt, disgust, enjoyment, fear, sadness, surprise. {{n_anger_pool}} 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 ({{n_anger_kept}}) and contempt ({{n_contempt}}) - contempt is {{share_contempt}}% 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
{{class_table}}

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 - {{prev_note}}.

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 (v{{laya_v}}), checkpoint convaiinnovations/laya, subfolder multilingual/: {{params}} params in {{tensors}} tensors - a {{params_enc}} {{enc_name}} encoder ({{model_type}}, bf16 weights, vocab {{vocab}}, laya's own context cap {{ctx_default}} tokens) plus {{params_heads}} 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 {{n_anger_pool}} anger-pool rows:

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

The decision rule, in order:

  1. the choice reading is decisive (|p(anger) - p(contempt)| >= {{margin}}) -> 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: {{sources_str}}. 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: {{repro_note}}. On a second, complete run of the labeller - fresh caches, same sandbox - {{reconfirm_note}}; 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 {{probe_author}}
the same 16 items in English, English question {{probe_en}}
the same 16 probes in Indonesian, English question - the reading this dataset uses {{probe_id}}
the same Indonesian probes with an Indonesian question {{probe_id_idq}}
English probes with an Indonesian question {{probe_en_idq}}
Indonesian probes, criteria order swapped (contempt first) {{probe_id_swapped}}

{{probe_gap}}. {{probe_mean_p}}. {{probe_order}}. 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 ({{probe_lang_q}}).

Option-order sensitivity on the corpus. {{order_note}}. 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. {{lexicon_note}} 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. {{audit_note}}

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 {{stageC}} rows come out inside the 0.10 margin, and {{noul_n}} of them are decided by those probes - so a weak tie-breaker settles {{noul_n}} labels. Prefer the probability columns to label if that matters for your use: ekman_choice_id decided {{choice_n}}, the option-order average {{orderavg_n}}, the upstream anger label {{kept_n}}.

Do not filter on p_not_anger_or_contempt. {{veto}}. 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. {{conf_note}}. ekman_confidence is laya's own confidence for the reading (1 - normalised entropy, 0 = a coin flip), and {{lowconf_laya}} 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 {{n_anger_pool}} 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 {{n_manual}} 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 {{n_pool}} rows at their natural class imbalance and anger_split is the {{n_anger_pool}}-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 {{per_class_balanced}} rows - the largest multiple of ten that fits the smallest class, contempt, at {{n_contempt}} eligible rows - giving N = {{n_balanced_s}} and b = {{balanced_b}}. No rounding is left anywhere: every class lands {{balanced_per_class_split}} 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: {{n_anger_balanced_s}} rows, {{anger_split_balanced_split}} overall and {{anger_balanced_per_class_split}} 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
{{split_table}}

{{duplicates_note}}

What the run cost, and what the optimisations were worth

Measured in a 2 vCPU / 2 GB CPU-only sandbox (torch {{torch_v}}, laya {{laya_v}}): {{scored_rows}} row-scores in {{laya_seconds}} s of model time ({{stages}}). Asking all four questions of every row would have cost {{naive_rows}}.

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 {{naive_rows}} row-scores {{scored_rows}} 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("{{repo}}", "balanced")        # default: exact 8:1:1, 7 classes, {{per_class_balanced}}/class
ds["train"][0]["text"], ds["train"][0]["label"]

whole = load_dataset("{{repo}}", "full")         # every row, one `train` split
whole["train"]                                   # {{n_pool}} rows, natural imbalance

# the anger work on its own, with every evidence column:
ang = load_dataset("{{repo}}", "anger_split")    # all {{n_anger_pool}} pool rows, one split
ang = load_dataset("{{repo}}", "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 {{laya_v}}, transformers {{transformers_v}}, datasets {{datasets_v}}, torch {{torch_v}} 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 {{probe_en}} in English and {{probe_id}} in Indonesian, the errors lean toward contempt, and the reading moves with the option order ({{order_flip}}% 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. {{n_anger_pool}} rows carry a machine decision; the other {{n_manual}} 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: {{n_contempt}} rows in the pool, so the balanced configs give it {{per_class_balanced}} 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.