File size: 8,971 Bytes
e7e1778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6619824
e7e1778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6619824
e7e1778
 
6619824
e7e1778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6619824
e7e1778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6619824
e7e1778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
---
license: mit
language:
  - en
tags:
  - generative-agents
  - emotion
  - multi-agent
  - simulation
  - reinforcement-learning
  - cognitive-science
  - occ-theory
  - predictive-processing
task_categories:
  - reinforcement-learning
  - text-classification
size_categories:
  - 100K<n<1M
pretty_name: "Emotion Engine: Emergent Emotional Appraisal in Generative Agents"
---

# Emotion Engine Dataset

**204,520 agent-step records** from a five-condition controlled experiment on emergent
emotional appraisal in generative agents.

> Paper: *Emergent Emotional Appraisal in Generative Agents via Predictive World Modeling*
> Author: Prem Babu Kanaparthi
> Code: [github.com/premxai/emotion_engine](https://github.com/premxai/emotion_engine)

---

## What This Dataset Is

Five emotion-engine architectures were compared in Ghost Town — a 12-agent survival
simulation across 6 scenario variants and 8 random seeds.

The central finding: **Condition D** (trained only to predict future world events)
independently rediscovers OCC cognitive appraisal signatures (fear, grief, suspicion)
with zero emotion rules, labels, or reward shaping.

Each record is one agent at one timestep: the full observation vector, emotion state,
latent representation, action taken, 12 future-event prediction probabilities,
and outcome metadata.

---

## Dataset Structure

### Splits

| Split | Condition | Scenario | Seeds | Records |
|-------|-----------|----------|-------|---------|
| `baseline` | Baseline (no emotion) | all 6 | 0–7 | 40,907 |
| `condition_a` | Hand-coded OCC rules | all 6 | 0–7 | 40,921 |
| `condition_b` | Behavioral cloning | all 6 | 0–7 | 40,838 |
| `condition_c` | Emotion dynamics model | all 6 | 0–7 | 40,916 |
| `condition_d` | Predictive world modeling | all 6 | 0–7 | 40,938 |

**Total: 204,520 records**

### Scenarios in Every Split

| Scenario | Primary OCC Signature | Description |
|----------|-----------------------|-------------|
| `standard_night` | Fear | 1 ghost per night, standard threat |
| `high_ghost_pressure` | Fear (extreme) | 3 simultaneous ghosts per night |
| `storm_scarcity` | Stress + Grief | Food supply reduced 70% by storm |
| `ally_death` | Grief | June Carter dies at step 1 (scripted) |
| `betrayal_refusal` | Suspicion | Rival pairs initialized with negative ties |
| `crowded_shelter` | Fear + Suspicion | Shelter capacity halved (6 slots / 12 agents) |

---

## Fields

Each record contains the following fields:

### Identity
| Field | Type | Description |
|-------|------|-------------|
| `run_id` | string | Unique run identifier, e.g. `condition_d_standard_night_seed0_12-agent` |
| `step` | int | Timestep within run (0–71, 3 simulated days × 24 steps/day) |
| `agent_id` | string | Agent name (one of 12 fixed agents) |
| `condition` | string | `baseline_0`, `condition_a`, `condition_b`, `condition_c`, `condition_d` |
| `seed` | int | Random seed (0–7) |
| `scenario` | string | One of the 6 scenario variants |

### Observation (14 dimensions)
| Field | Type | Description |
|-------|------|-------------|
| `obs_visible_ghosts` | int | Number of ghosts within sensor range |
| `obs_visible_deaths` | int | Number of ally deaths witnessed this step |
| `obs_nearby_allies` | int | Allies within 5 tiles |
| `obs_trusted_allies` | int | Allies with positive social tie nearby |
| `obs_supplies_seen` | int | Supply units visible |
| `obs_in_shelter` | bool | Agent is inside a safe building |
| `obs_nearest_refuge_distance` | float | Tiles to closest safe building |
| `obs_steps_since_ghost_seen` | int | Steps since last ghost sighting (capped at 20) |
| `obs_steps_since_ally_died` | int | Steps since last witnessed death (capped at 20) |
| `obs_steps_since_betrayal` | int | Steps since last betrayal received (capped at 20) |
| `obs_ally_deaths_witnessed` | int | Cumulative ally deaths witnessed |
| `obs_betrayals_received` | int | Cumulative betrayals received |
| `obs_average_trust` | float | Mean social tie value across all agents [−1, 1] |
| `obs_graph_tension` | float | Mean negative tie magnitude |

### Emotion / Affect (Condition D only — zeros for others)
| Field | Type | Description |
|-------|------|-------------|
| `affect_fear` | float | Fear activation [0, 1] |
| `affect_grief` | float | Grief activation [0, 1] |
| `affect_trust` | float | Trust activation [0, 1] |
| `affect_stress` | float | Stress activation [0, 1] |
| `affect_relief` | float | Relief activation [0, 1] |
| `affect_suspicion` | float | Suspicion activation [0, 1] |

### Latent Representation (8 dimensions)
| Field | Type | Description |
|-------|------|-------------|
| `latent_0``latent_7` | float | Internal learned representation (8-dim) |

### Future-Event Predictions (Condition D only — zeros for others)
| Field | Type | Description |
|-------|------|-------------|
| `pred_ghost_nearby_t3` | float | P(ghost visible in 3 steps) |
| `pred_my_death_t5` | float | P(this agent dies in 5 steps) |
| `pred_health_drop_t3` | float | P(health decreases in 3 steps) |
| `pred_nearby_death_t5` | float | P(an ally dies in 5 steps) |
| `pred_help_success_t5` | float | P(help action succeeds in 5 steps) |
| `pred_refusal_received_t5` | float | P(refusal received in 5 steps) |
| `pred_tie_increase_t5` | float | P(social tie increases in 5 steps) |
| `pred_shelter_achieved_t2` | float | P(agent in shelter in 2 steps) |
| `pred_storm_onset_t3` | float | P(storm starts in 3 steps) |
| `pred_scarcity_t5` | float | P(supply scarcity in 5 steps) |
| `pred_graph_tension_t3` | float | P(social tension increases in 3 steps) |
| `pred_valence_t5` | float | P(positive valence in 5 steps) |

### Action & Outcome
| Field | Type | Description |
|-------|------|-------------|
| `action` | string | Action taken: `hide`, `gather_supplies`, `seek_safe_house`, `seek_hospital`, `refuse_help`, `warn`, `patrol` |
| `goal` | string | Agent goal state at this step |
| `reward_survival` | float | Survival reward component |
| `reward_shelter` | float | Shelter reward component |
| `reward_health` | float | Health reward component |
| `reward_social` | float | Social reward component |
| `total_reward` | float | Sum of reward components |
| `alive` | bool | Agent survived this step |
| `health` | float | Health percentage (0–100) |
| `sheltered` | bool | Agent is in a safe building |
| `time_of_day` | string | `day`, `dusk`, `night`, `dawn` |

---

## Loading the Dataset

### With the `datasets` library (recommended)

```python
from datasets import load_dataset

# Load a specific condition
ds = load_dataset("PremC1F/emotion-engine", "condition_d")

# Load all conditions
ds = load_dataset("PremC1F/emotion-engine", "all")

# Filter to a specific scenario
night_only = ds["train"].filter(lambda x: x["scenario"] == "standard_night")

# Filter to ghost-present steps
threat_steps = ds["train"].filter(lambda x: x["obs_visible_ghosts"] > 0)
```

### Reproduce the Fear→Shelter result

```python
from datasets import load_dataset
import numpy as np
from scipy.stats import fisher_exact

ds = load_dataset("PremC1F/emotion-engine", "condition_d", split="train")
df = ds.to_pandas()

ghost_present = df[df["obs_visible_ghosts"] > 0]
ghost_absent  = df[df["obs_visible_ghosts"] == 0]

shelter_given_ghost    = (ghost_present["action"] == "seek_safe_house").mean()
shelter_given_no_ghost = (ghost_absent["action"]  == "seek_safe_house").mean()

# Contingency table
a = (ghost_present["action"] == "seek_safe_house").sum()
b = (ghost_present["action"] != "seek_safe_house").sum()
c = (ghost_absent["action"]  == "seek_safe_house").sum()
d = (ghost_absent["action"]  != "seek_safe_house").sum()

_, p = fisher_exact([[a, b], [c, d]])
print(f"Ghost present  → shelter: {shelter_given_ghost:.1%}")
print(f"Ghost absent   → shelter: {shelter_given_no_ghost:.1%}")
print(f"Fisher p = {p:.2e}")
# Expected: Ghost present → shelter: 99.0%, p = 3.3e-113
```

### Reproduce the Suspicion Decay result

```python
from datasets import load_dataset

ds = load_dataset("PremC1F/emotion-engine", "condition_d", split="train")
df = ds.to_pandas()

refusals = df[df["action"] == "refuse_help"].copy()

def bucket(steps):
    if steps <= 5:  return "recent"
    if steps <= 10: return "fading"
    return "forgotten"

refusals["bucket"] = refusals["obs_steps_since_betrayal"].apply(bucket)
all_social = df.copy()
all_social["bucket"] = all_social["obs_steps_since_betrayal"].apply(bucket)

for b in ["recent", "fading", "forgotten"]:
    denom = (all_social["bucket"] == b).sum()
    numer = ((refusals["bucket"] == b)).sum()
    print(f"{b}: {numer/denom:.1%} refusal rate")
# Expected: recent 64.6%, fading 4.5%, forgotten 35.2%
```

---

## Citation

```bibtex
@article{kanaparthi2026emotion,
  author  = {Kanaparthi, Prem Babu},
  title   = {Emergent Emotional Appraisal in Generative Agents
             via Predictive World Modeling},
  year    = {2026},
}
```

---

## License

MIT License.