Matthew Ford commited on
Commit
4f26cce
·
1 Parent(s): c89675d

chore: add model audit run artifacts

Browse files

Former-commit-id: a974668fb08fc9dc95c7f853939083dba4bba150
Former-commit-id: dbcc3914b49dfe0e7244036abec21b8b5cf0aad9

audit_trajectory.py ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Deep audit of PINO v6 dataset trajectory physics quality."""
3
+ import json
4
+ import math
5
+ import statistics
6
+ from collections import defaultdict, Counter
7
+
8
+ DATASET = "/home/hermes/pino/data/empirical_dataset_v6.jsonl"
9
+
10
+ def load():
11
+ records = []
12
+ with open(DATASET) as f:
13
+ for line in f:
14
+ records.append(json.loads(line))
15
+ return records
16
+
17
+ def analyze():
18
+ records = load()
19
+ print(f"Total records: {len(records)}")
20
+
21
+ # Collect all CAS keys and their trajectory appearances
22
+ all_cas = set()
23
+ cas_traj = defaultdict(list) # cas -> list of (formula_id, [OAV values across 49 steps])
24
+
25
+ for r in records:
26
+ fid = r['formula_id']
27
+ n_steps = len(r['trajectory'])
28
+ # Build per-CAS OAV series
29
+ cas_series = defaultdict(lambda: [None]*n_steps)
30
+ for i, step in enumerate(r['trajectory']):
31
+ for cas, oav in step.get('OAV', {}).items():
32
+ cas_series[cas][i] = oav
33
+ for cas, series in cas_series.items():
34
+ all_cas.add(cas)
35
+ cas_traj[cas].append((fid, series))
36
+
37
+ print(f"Distinct CAS keys in trajectories: {len(all_cas)}")
38
+
39
+ # Categorize CAS keys
40
+ natural_cas = [c for c in all_cas if c.startswith('NATURAL:')]
41
+ smiles_cas = [c for c in all_cas if c.startswith('SMILES:')]
42
+ plain_cas = [c for c in all_cas if not c.startswith('NATURAL:') and not c.startswith('SMILES:')]
43
+ print(f" Plain CAS: {len(plain_cas)}")
44
+ print(f" SMILES: prefixed: {len(smiles_cas)}")
45
+ print(f" NATURAL: prefixed: {len(natural_cas)}")
46
+
47
+ # =========================================================
48
+ # (1) FLAT TRAJECTORIES: peak at step 0, no decay
49
+ # =========================================================
50
+ # For each (cas, formula) pair, determine if trajectory is "flat"
51
+ # Flat = peak OAV at step 0 (or near step 0), and end/peak ratio ~ 1 or barely decays
52
+
53
+ flat_count = 0
54
+ flat_examples = []
55
+ non_flat_count = 0
56
+ total_pairs = 0
57
+ zero_traj = 0 # all zeros
58
+
59
+ for cas, occurrences in cas_traj.items():
60
+ for fid, series in occurrences:
61
+ total_pairs += 1
62
+ valid = [v for v in series if v is not None]
63
+ if not valid or all(v == 0 for v in valid):
64
+ zero_traj += 1
65
+ continue
66
+
67
+ peak_val = max(series)
68
+ peak_idx = series.index(peak_val)
69
+ end_val = series[-1]
70
+ start_val = series[0]
71
+
72
+ # Flat: peak at step 0 AND end/peak > 0.95 (minimal decay)
73
+ # Also catch: start == peak == end (truly flat)
74
+ if peak_idx == 0 and end_val > 0:
75
+ ratio = end_val / peak_val
76
+ if ratio > 0.95:
77
+ flat_count += 1
78
+ if len(flat_examples) < 10:
79
+ flat_examples.append({
80
+ 'cas': cas, 'formula': fid,
81
+ 'start': start_val, 'peak': peak_val, 'end': end_val,
82
+ 'ratio': ratio
83
+ })
84
+ else:
85
+ non_flat_count += 1
86
+ elif peak_idx <= 2 and start_val > 0:
87
+ ratio = end_val / peak_val if peak_val > 0 else 0
88
+ if ratio > 0.95:
89
+ flat_count += 1
90
+ if len(flat_examples) < 10:
91
+ flat_examples.append({
92
+ 'cas': cas, 'formula': fid,
93
+ 'start': start_val, 'peak': peak_val, 'end': end_val,
94
+ 'ratio': ratio, 'peak_idx': peak_idx
95
+ })
96
+ else:
97
+ non_flat_count += 1
98
+ else:
99
+ non_flat_count += 1
100
+
101
+ print(f"\n{'='*70}")
102
+ print(f"(1) FLAT OAV TRAJECTORIES")
103
+ print(f"{'='*70}")
104
+ print(f"Total (cas, formula) pairs analyzed: {total_pairs}")
105
+ print(f" Zero trajectories (all OAV=0): {zero_traj}")
106
+ print(f" Flat trajectories (peak@t0, end/peak>0.95): {flat_count}")
107
+ print(f" Non-flat (decaying): {non_flat_count}")
108
+ print(f" Flat % of non-zero: {flat_count/(flat_count+non_flat_count)*100:.1f}%" if (flat_count+non_flat_count) else "N/A")
109
+ print(f"\n Examples of flat trajectories:")
110
+ for ex in flat_examples[:5]:
111
+ print(f" {ex}")
112
+
113
+ # =========================================================
114
+ # (2) OAV INCREASES OVER TIME (peak not at step 0)
115
+ # =========================================================
116
+ increasing_count = 0
117
+ increasing_examples = []
118
+
119
+ for cas, occurrences in cas_traj.items():
120
+ for fid, series in occurrences:
121
+ valid = [v for v in series if v is not None]
122
+ if not valid or all(v == 0 for v in valid):
123
+ continue
124
+
125
+ peak_val = max(series)
126
+ peak_idx = series.index(peak_val)
127
+ start_val = series[0]
128
+
129
+ # Increasing = peak well after step 0 AND peak > 1.1 * start
130
+ if peak_idx > 5 and start_val > 0 and peak_val > 1.1 * start_val:
131
+ increasing_count += 1
132
+ if len(increasing_examples) < 15:
133
+ # Find peak and characterize
134
+ end_val = series[-1]
135
+ increasing_examples.append({
136
+ 'cas': cas, 'formula': fid,
137
+ 'start': start_val, 'peak': peak_val, 'peak_idx': peak_idx,
138
+ 'end': end_val, 'start_to_peak_ratio': peak_val/start_val
139
+ })
140
+ elif peak_idx > 5 and start_val == 0 and peak_val > 0:
141
+ # Starts at 0, increases later
142
+ increasing_count += 1
143
+ if len(increasing_examples) < 15:
144
+ increasing_examples.append({
145
+ 'cas': cas, 'formula': fid,
146
+ 'start': start_val, 'peak': peak_val, 'peak_idx': peak_idx,
147
+ 'end': series[-1], 'note': 'starts at 0'
148
+ })
149
+
150
+ print(f"\n{'='*70}")
151
+ print(f"(2) OAV INCREASING OVER TIME (physically suspicious)")
152
+ print(f"{'='*70}")
153
+ print(f"Count: {increasing_count}")
154
+ print(f"Examples:")
155
+ for ex in increasing_examples[:10]:
156
+ print(f" {ex}")
157
+
158
+ # =========================================================
159
+ # (3) OAV DECAY RATIO (end/peak) DISTRIBUTION PER TIER
160
+ # =========================================================
161
+ # Tier = ingredient count in formula
162
+ decay_by_tier = defaultdict(list)
163
+
164
+ for r in records:
165
+ n_ing = len(r['formula'])
166
+ fid = r['formula_id']
167
+ n_steps = len(r['trajectory'])
168
+ cas_series = defaultdict(lambda: [None]*n_steps)
169
+ for i, step in enumerate(r['trajectory']):
170
+ for cas, oav in step.get('OAV', {}).items():
171
+ cas_series[cas][i] = oav
172
+ for cas, series in cas_series.items():
173
+ valid = [v for v in series if v is not None]
174
+ if not valid or all(v == 0 for v in valid):
175
+ continue
176
+ peak_val = max(series)
177
+ end_val = series[-1]
178
+ if peak_val > 0:
179
+ ratio = end_val / peak_val
180
+ decay_by_tier[n_ing].append(ratio)
181
+
182
+ print(f"\n{'='*70}")
183
+ print(f"(3) OAV DECAY RATIO (end/peak) DISTRIBUTION PER TIER (n_ingredients)")
184
+ print(f"{'='*70}")
185
+ for tier in sorted(decay_by_tier.keys()):
186
+ ratios = decay_by_tier[tier]
187
+ if not ratios:
188
+ continue
189
+ pcts = {p: sorted(ratios)[int(len(ratios)*p)] for p in [0.1,0.25,0.5,0.75,0.9]}
190
+ mean_r = statistics.mean(ratios)
191
+ print(f" Tier n={tier:3d} (n={len(ratios):5d}): "
192
+ f"p10={pcts[0.1]:.4f} p25={pcts[0.25]:.4f} median={pcts[0.5]:.4f} "
193
+ f"p75={pcts[0.75]:.4f} p90={pcts[0.9]:.4f} mean={mean_r:.4f}")
194
+
195
+ # =========================================================
196
+ # (4) VP/OT REGRESSION PHYSICAL REASONABLENESS
197
+ # =========================================================
198
+ # Check if trajectories are monotonically decreasing after peak
199
+ # Also check for NaN/Inf values
200
+ nan_inf_count = 0
201
+ non_monotonic_after_peak = 0
202
+ monotonic_after_peak = 0
203
+ sudden_jumps = 0
204
+
205
+ for cas, occurrences in cas_traj.items():
206
+ for fid, series in occurrences:
207
+ valid = [v for v in series if v is not None]
208
+ if not valid or all(v == 0 for v in valid):
209
+ continue
210
+ # Check NaN/Inf
211
+ for v in series:
212
+ if v is not None and (isinstance(v, float) and (math.isnan(v) or math.isinf(v))):
213
+ nan_inf_count += 1
214
+ break
215
+
216
+ # Check monotonicity after peak
217
+ peak_val = max(series)
218
+ peak_idx = series.index(peak_val)
219
+ after_peak = series[peak_idx:]
220
+ non_none_after = [v for v in after_peak if v is not None]
221
+
222
+ if len(non_none_after) > 2:
223
+ is_mono_dec = all(non_none_after[i] >= non_none_after[i+1] for i in range(len(non_none_after)-1))
224
+ if is_mono_dec:
225
+ monotonic_after_peak += 1
226
+ else:
227
+ non_monotonic_after_peak += 1
228
+ # Check for sudden jumps (>2x in adjacent steps)
229
+ for i in range(len(non_none_after)-1):
230
+ if non_none_after[i] > 0 and non_none_after[i+1] > non_none_after[i]*2:
231
+ sudden_jumps += 1
232
+ break
233
+
234
+ print(f"\n{'='*70}")
235
+ print(f"(4) VP/OT REGRESSION PHYSICAL REASONABLENESS")
236
+ print(f"{'='*70}")
237
+ print(f"Records with NaN/Inf in OAV: {nan_inf_count}")
238
+ print(f"Monotonic decay after peak: {monotonic_after_peak}")
239
+ print(f"Non-monotonic after peak: {non_monotonic_after_peak}")
240
+ print(f"With sudden jumps (>2x adjacent): {sudden_jumps}")
241
+ print(f"Monotonicity rate: {monotonic_after_peak/(monotonic_after_peak+non_monotonic_after_peak)*100:.1f}%")
242
+
243
+ # =========================================================
244
+ # (5) NATURAL: vs PLAIN CAS COMPARISON
245
+ # =========================================================
246
+ def summarize_group(cas_list, label):
247
+ ratios = []
248
+ flat = 0
249
+ increasing = 0
250
+ peak_at_0 = 0
251
+ peak_after_5 = 0
252
+ total = 0
253
+ zero_all = 0
254
+ peak_vals = []
255
+
256
+ for cas in cas_list:
257
+ for fid, series in cas_traj[cas]:
258
+ total += 1
259
+ valid = [v for v in series if v is not None]
260
+ if not valid or all(v == 0 for v in valid):
261
+ zero_all += 1
262
+ continue
263
+ peak_val = max(series)
264
+ peak_idx = series.index(peak_val)
265
+ end_val = series[-1]
266
+ peak_vals.append(peak_val)
267
+
268
+ if peak_idx == 0:
269
+ peak_at_0 += 1
270
+ if end_val / peak_val > 0.95 if peak_val > 0 else False:
271
+ flat += 1
272
+ if peak_idx > 5 and peak_val > 1.1 * series[0]:
273
+ increasing += 1
274
+ if peak_idx > 5:
275
+ peak_after_5 += 1
276
+ if peak_val > 0:
277
+ ratios.append(end_val/peak_val)
278
+
279
+ print(f"\n {label}: {len(cas_list)} CAS keys, {total} trajectory pairs")
280
+ print(f" Zero trajectories: {zero_all} ({zero_all/total*100:.1f}%)")
281
+ print(f" Peak at step 0: {peak_at_0} ({peak_at_0/total*100:.1f}%)")
282
+ print(f" Peak after step 5: {peak_after_5} ({peak_after_5/total*100:.1f}%)")
283
+ print(f" Flat (peak@0 + no decay): {flat}")
284
+ print(f" Increasing (peak>5 + rise): {increasing}")
285
+ if ratios:
286
+ med = statistics.median(ratios)
287
+ mean = statistics.mean(ratios)
288
+ print(f" End/peak ratio: median={med:.4f}, mean={mean:.4f}")
289
+ if peak_vals:
290
+ med_peak = statistics.median(peak_vals)
291
+ mean_peak = statistics.mean(peak_vals)
292
+ print(f" Peak OAV: median={med_peak:.2f}, mean={mean_peak:.2f}")
293
+
294
+ print(f"\n{'='*70}")
295
+ print(f"(5) NATURAL: vs PLAIN CAS COMPARISON")
296
+ print(f"{'='*70}")
297
+ summarize_group(plain_cas, "PLAIN CAS")
298
+ summarize_group(smiles_cas, "SMILES: PREFIXED")
299
+ summarize_group(natural_cas, "NATURAL: PREFIXED")
300
+
301
+ # Specific NATURAL examples
302
+ print(f"\n Sample NATURAL: CAS keys:")
303
+ for c in sorted(natural_cas)[:20]:
304
+ print(f" {c}")
305
+
306
+ print(f"\n NATURAL: trajectory examples (first 5):")
307
+ nat_count = 0
308
+ for cas in sorted(natural_cas):
309
+ for fid, series in cas_traj[cas]:
310
+ valid = [v for v in series if v is not None]
311
+ if valid and not all(v == 0 for v in valid):
312
+ peak_val = max(series)
313
+ peak_idx = series.index(peak_val)
314
+ end_val = series[-1]
315
+ print(f" {cas} in {fid}: start={series[0]:.2f} peak={peak_val:.2f}@{peak_idx} end={end_val:.2f}")
316
+ nat_count += 1
317
+ if nat_count >= 10:
318
+ break
319
+ if nat_count >= 10:
320
+ break
321
+
322
+ # =========================================================
323
+ # ADDITIONAL: Overall trajectory shape distribution
324
+ # =========================================================
325
+ shapes = Counter()
326
+ for cas, occurrences in cas_traj.items():
327
+ for fid, series in occurrences:
328
+ valid = [v for v in series if v is not None]
329
+ if not valid or all(v == 0 for v in valid):
330
+ shapes['zero'] += 1
331
+ continue
332
+ peak_val = max(series)
333
+ peak_idx = series.index(peak_val)
334
+ end_val = series[-1]
335
+ start_val = series[0]
336
+
337
+ if peak_idx == 0:
338
+ if peak_val > 0 and end_val/peak_val > 0.95:
339
+ shapes['flat_peak0'] += 1
340
+ else:
341
+ shapes['decay_from_0'] += 1
342
+ elif peak_idx > 5:
343
+ if start_val > 0 and peak_val > 1.1 * start_val:
344
+ shapes['increasing'] += 1
345
+ else:
346
+ shapes['peak_late_flat'] += 1
347
+ else:
348
+ shapes['peak_early'] += 1
349
+
350
+ print(f"\n{'='*70}")
351
+ print(f"OVERALL TRAJECTORY SHAPE DISTRIBUTION")
352
+ print(f"{'='*70}")
353
+ for shape, cnt in shapes.most_common():
354
+ print(f" {shape}: {cnt}")
355
+
356
+ # =========================================================
357
+ # ADDITIONAL: Tier distribution of records
358
+ # =========================================================
359
+ tier_dist = Counter()
360
+ for r in records:
361
+ tier_dist[len(r['formula'])] += 1
362
+ print(f"\nFormula size distribution:")
363
+ for sz in sorted(tier_dist.keys()):
364
+ print(f" n={sz:3d}: {tier_dist[sz]:4d} formulas")
365
+
366
+ if __name__ == '__main__':
367
+ analyze()
audit_v6.py ADDED
@@ -0,0 +1,449 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Deep audit of PINO v6 dataset label quality and coverage gaps."""
3
+ import json
4
+ import numpy as np
5
+ from collections import Counter, defaultdict
6
+
7
+ DATA_PATH = "data/empirical_dataset_v6.jsonl"
8
+ VOCAB_PATH = "data/pyrfume_vocabulary.json"
9
+
10
+ with open(VOCAB_PATH) as f:
11
+ vocab = json.load(f)
12
+ DESCRIPTOR_NAMES = vocab["vocabulary"]
13
+ N_DESCRIPTORS = vocab["dimension"]
14
+
15
+ records = []
16
+ with open(DATA_PATH) as f:
17
+ for line in f:
18
+ line = line.strip()
19
+ if line:
20
+ records.append(json.loads(line))
21
+
22
+ N = len(records)
23
+ print(f"=" * 70)
24
+ print(f"PINO v6 DATASET AUDIT — {N} total records")
25
+ print(f"=" * 70)
26
+
27
+ controls = [r for r in records if r.get("is_control")]
28
+ non_controls = [r for r in records if not r.get("is_control")]
29
+ print(f"\nControls: {len(controls)}, Non-controls: {len(non_controls)}")
30
+
31
+ genre_counts = Counter(r.get("genre") for r in records)
32
+ print(f"Genres: {dict(genre_counts)}")
33
+
34
+ # =====================================================================
35
+ # (1) PER-FORMULA INGREDIENT COUNT DISTRIBUTION
36
+ # =====================================================================
37
+ print(f"\n{'=' * 70}")
38
+ print("(1) PER-FORMULA INGREDIENT COUNT DISTRIBUTION")
39
+ print(f"{'=' * 70}")
40
+
41
+ counts_all = [len(r["formula"]) for r in records]
42
+ counts_nc = [len(r["formula"]) for r in non_controls]
43
+ counts_c = [len(r["formula"]) for r in controls]
44
+
45
+ for label, counts in [("ALL", counts_all), ("NON-CONTROL", counts_nc), ("CONTROL", counts_c)]:
46
+ arr = np.array(counts)
47
+ dist = Counter(counts)
48
+ print(f"\n [{label}] n={len(arr)}")
49
+ print(f" min={arr.min()}, max={arr.max()}, mean={arr.mean():.2f}, median={np.median(arr):.1f}, std={arr.std():.2f}")
50
+ print(f" Distribution:")
51
+ for k in sorted(dist.keys()):
52
+ pct = dist[k] / len(arr) * 100
53
+ print(f" {k} ingredients: {dist[k]} ({pct:.1f}%)")
54
+
55
+ # =====================================================================
56
+ # (2) WEIGHT FRACTION DISTRIBUTION — ETHANOL DOMINANCE
57
+ # =====================================================================
58
+ print(f"\n{'=' * 70}")
59
+ print("(2) WEIGHT FRACTION DISTRIBUTION — ETHANOL DOMINANCE")
60
+ print(f"{'=' * 70}")
61
+
62
+ ETHANOL_CAS = {"64-17-5", "25265-71-8"}
63
+
64
+ ethanol_fracs = []
65
+ non_ethanol_fracs = []
66
+ ethanol_85plus = 0
67
+ ethanol_90plus = 0
68
+ formulas_with_ethanol = 0
69
+
70
+ for r in records:
71
+ formula = r["formula"]
72
+ eth_frac = 0.0
73
+ non_eth_total = 0.0
74
+ has_eth = False
75
+ for ing in formula:
76
+ cas = ing["cas"]
77
+ wf = ing["weight_fraction"]
78
+ if cas in ETHANOL_CAS:
79
+ eth_frac += wf
80
+ has_eth = True
81
+ else:
82
+ non_eth_total += wf
83
+ if has_eth:
84
+ formulas_with_ethanol += 1
85
+ ethanol_fracs.append(eth_frac)
86
+ non_ethanol_fracs.append(non_eth_total)
87
+ if eth_frac >= 0.85:
88
+ ethanol_85plus += 1
89
+ if eth_frac >= 0.90:
90
+ ethanol_90plus += 1
91
+
92
+ eth_arr = np.array(ethanol_fracs)
93
+ print(f"\n Ethanol (64-17-5 or 25265-71-8) weight fraction per formula:")
94
+ print(f" Formulas containing ethanol: {formulas_with_ethanol} / {N} ({formulas_with_ethanol/N*100:.1f}%)")
95
+ print(f" Mean ethanol fraction: {eth_arr.mean():.4f}")
96
+ print(f" Median ethanol fraction: {np.median(eth_arr):.4f}")
97
+ print(f" Min ethanol fraction: {eth_arr.min():.4f}")
98
+ print(f" Max ethanol fraction: {eth_arr.max():.4f}")
99
+ print(f" Formulas with ethanol >= 85%: {ethanol_85plus} ({ethanol_85plus/N*100:.1f}%)")
100
+ print(f" Formulas with ethanol >= 90%: {ethanol_90plus} ({ethanol_90plus/N*100:.1f}%)")
101
+
102
+ # Distribution buckets
103
+ buckets = [0, 0.01, 0.1, 0.3, 0.5, 0.7, 0.8, 0.85, 0.9, 0.95, 0.99, 1.01]
104
+ print(f"\n Ethanol fraction buckets:")
105
+ for i in range(len(buckets) - 1):
106
+ lo, hi = buckets[i], buckets[i+1]
107
+ cnt = int(np.sum((eth_arr >= lo) & (eth_arr < hi)))
108
+ if cnt > 0:
109
+ print(f" [{lo:.2f}, {hi:.2f}): {cnt} ({cnt/N*100:.1f}%)")
110
+
111
+ # Per-ingredient weight fraction stats (non-ethanol)
112
+ print(f"\n Per-ingredient weight fraction (excluding ethanol):")
113
+ all_ingredient_fracs = []
114
+ for r in records:
115
+ for ing in r["formula"]:
116
+ if ing["cas"] not in ETHANOL_CAS:
117
+ all_ingredient_fracs.append(ing["weight_fraction"])
118
+ if all_ingredient_fracs:
119
+ ing_arr = np.array(all_ingredient_fracs)
120
+ print(f" n={len(ing_arr)} ingredient-slots")
121
+ print(f" mean={ing_arr.mean():.4f}, median={np.median(ing_arr):.4f}")
122
+ print(f" min={ing_arr.min():.6f}, max={ing_arr.max():.4f}")
123
+ print(f" percentiles: 10%={np.percentile(ing_arr,10):.4f}, 25%={np.percentile(ing_arr,25):.4f}, "
124
+ f"75%={np.percentile(ing_arr,75):.4f}, 90%={np.percentile(ing_arr,90):.4f}")
125
+
126
+ # =====================================================================
127
+ # (3) PYRAMID TIER COVERAGE — formulas with at least one ingredient per tier
128
+ # =====================================================================
129
+ print(f"\n{'=' * 70}")
130
+ print("(3) PYRAMID TIER COVERAGE (top/mid/base)")
131
+ print(f"{'=' * 70}")
132
+ # pyramid_targets is 3 lists of 138 binary values
133
+ # Tier means at least one descriptor active in that tier
134
+
135
+ has_top = 0
136
+ has_mid = 0
137
+ has_base = 0
138
+ has_all_three = 0
139
+ has_none = 0
140
+ tier_sums = []
141
+
142
+ for r in records:
143
+ pt = r.get("pyramid_targets")
144
+ if pt is None:
145
+ continue
146
+ # Each tier is a list of 138 values
147
+ top_active = sum(1 for x in pt[0] if x > 0)
148
+ mid_active = sum(1 for x in pt[1] if x > 0)
149
+ base_active = sum(1 for x in pt[2] if x > 0)
150
+ tier_sums.append((top_active, mid_active, base_active))
151
+
152
+ t_has = top_active > 0
153
+ m_has = mid_active > 0
154
+ b_has = base_active > 0
155
+ if t_has: has_top += 1
156
+ if m_has: has_mid += 1
157
+ if b_has: has_base += 1
158
+ if t_has and m_has and b_has: has_all_three += 1
159
+ if not (t_has or m_has or b_has): has_none += 1
160
+
161
+ total_with_pyramid = len(tier_sums)
162
+ print(f"\n Formulas with pyramid_targets: {total_with_pyramid}")
163
+ print(f" Has top notes active: {has_top} ({has_top/total_with_pyramid*100:.1f}%)")
164
+ print(f" Has mid notes active: {has_mid} ({has_mid/total_with_pyramid*100:.1f}%)")
165
+ print(f" Has base notes active: {has_base} ({has_base/total_with_pyramid*100:.1f}%)")
166
+ print(f" Has ALL THREE tiers active: {has_all_three} ({has_all_three/total_with_pyramid*100:.1f}%)")
167
+ print(f" Has NO tiers active (all-zero): {has_none} ({has_none/total_with_pyramid*100:.1f}%)")
168
+
169
+ tier_arr = np.array(tier_sums)
170
+ print(f"\n Avg active descriptors per tier:")
171
+ print(f" Top: {tier_arr[:,0].mean():.2f} (min={tier_arr[:,0].min()}, max={tier_arr[:,0].max()})")
172
+ print(f" Mid: {tier_arr[:,1].mean():.2f} (min={tier_arr[:,1].min()}, max={tier_arr[:,1].max()})")
173
+ print(f" Base: {tier_arr[:,2].mean():.2f} (min={tier_arr[:,2].min()}, max={tier_arr[:,2].max()})")
174
+
175
+ # Also check only non-controls
176
+ has_all_nc = 0
177
+ for r in non_controls:
178
+ pt = r.get("pyramid_targets")
179
+ if pt and sum(1 for x in pt[0] if x>0) > 0 and sum(1 for x in pt[1] if x>0) > 0 and sum(1 for x in pt[2] if x>0) > 0:
180
+ has_all_nc += 1
181
+ print(f"\n [Non-controls only] Has ALL THREE tiers: {has_all_nc} / {len(non_controls)} ({has_all_nc/len(non_controls)*100:.1f}%)")
182
+
183
+ # =====================================================================
184
+ # (4) CHEMICAL FREQUENCY — over-represented chemicals
185
+ # =====================================================================
186
+ print(f"\n{'=' * 70}")
187
+ print("(4) CHEMICAL FREQUENCY / OVER-REPRESENTATION")
188
+ print(f"{'=' * 70}")
189
+
190
+ cas_counter = Counter()
191
+ cas_name = {}
192
+ for r in records:
193
+ for ing in r["formula"]:
194
+ cas = ing["cas"]
195
+ cas_counter[cas] += 1
196
+ if cas not in cas_name and ing.get("name"):
197
+ cas_name[cas] = ing["name"]
198
+
199
+ print(f"\n Unique chemicals (by CAS/SMILES key): {len(cas_counter)}")
200
+ print(f"\n Top 30 most frequent chemicals:")
201
+ print(f" {'Rank':>4} {'CAS':<20} {'Name':<30} {'Count':>6} {'% of formulas':>14}")
202
+ for i, (cas, cnt) in enumerate(cas_counter.most_common(30)):
203
+ name = cas_name.get(cas, "(no name)")
204
+ # Check if it's a SMILES key
205
+ display_cas = cas[:18] + ".." if len(cas) > 20 else cas
206
+ display_name = name[:28] + ".." if len(name) > 30 else name
207
+ print(f" {i+1:>4} {display_cas:<20} {display_name:<30} {cnt:>6} {cnt/N*100:>13.1f}%")
208
+
209
+ print(f"\n Chemicals appearing in >50% of formulas: {sum(1 for _,c in cas_counter.items() if c/N > 0.5)}")
210
+ print(f" Chemicals appearing in >25% of formulas: {sum(1 for _,c in cas_counter.items() if c/N > 0.25)}")
211
+ print(f" Chemicals appearing in >10% of formulas: {sum(1 for _,c in cas_counter.items() if c/N > 0.10)}")
212
+ print(f" Chemicals appearing in >5% of formulas: {sum(1 for _,c in cas_counter.items() if c/N > 0.05)}")
213
+ print(f" Chemicals appearing in only 1 formula: {sum(1 for _,c in cas_counter.items() if c == 1)}")
214
+ print(f" Chemicals appearing in <=2 formulas: {sum(1 for _,c in cas_counter.items() if c <= 2)}")
215
+
216
+ # Also check non-controls only
217
+ cas_counter_nc = Counter()
218
+ for r in non_controls:
219
+ for ing in r["formula"]:
220
+ cas_counter_nc[ing["cas"]] += 1
221
+ print(f"\n [Non-controls only] Top 15:")
222
+ for i, (cas, cnt) in enumerate(cas_counter_nc.most_common(15)):
223
+ name = cas_name.get(cas, "")
224
+ display_cas = cas[:18] + ".." if len(cas) > 20 else cas
225
+ print(f" {i+1:>4} {display_cas:<20} {cnt:>5} / {len(non_controls)} ({cnt/len(non_controls)*100:.1f}%) {name[:40]}")
226
+
227
+ # =====================================================================
228
+ # (5) DESCRIPTOR CO-OCCURRENCE — redundancy analysis
229
+ # =====================================================================
230
+ print(f"\n{'=' * 70}")
231
+ print("(5) DESCRIPTOR CO-OCCURRENCE / REDUNDANCY")
232
+ print(f"{'=' * 70}")
233
+ # Use pyramid_targets flattened across all 3 tiers to find descriptor activity
234
+ # Actually, use objective_targets which is per-timestep (49 × 138)
235
+ # But for descriptor co-occurrence, aggregate: a descriptor is "active" in a formula
236
+ # if it's non-zero in any tier of pyramid_targets OR in objective_targets
237
+
238
+ # Use pyramid_targets: flatten 3×138 → 138 (OR across tiers)
239
+ descriptor_active = [] # per formula: set of active descriptor indices
240
+ for r in records:
241
+ pt = r.get("pyramid_targets")
242
+ if pt is None:
243
+ descriptor_active.append(set())
244
+ continue
245
+ active = set()
246
+ for tier in pt:
247
+ for idx, val in enumerate(tier):
248
+ if val > 0:
249
+ active.add(idx)
250
+ descriptor_active.append(active)
251
+
252
+ # Co-occurrence: count pairs
253
+ pair_counts = Counter()
254
+ single_counts = Counter()
255
+ for active_set in descriptor_active:
256
+ active_sorted = sorted(active_set)
257
+ for idx in active_sorted:
258
+ single_counts[idx] += 1
259
+ for i in range(len(active_sorted)):
260
+ for j in range(i+1, len(active_sorted)):
261
+ pair_counts[(active_sorted[i], active_sorted[j])] += 1
262
+
263
+ # Find always-together pairs: P(B|A) and P(A|B) both near 1.0
264
+ print(f"\n Descriptor pairs with near-perfect co-occurrence (both directions >=0.95):")
265
+ perfect_pairs = []
266
+ for (a, b), co_occur in pair_counts.most_common():
267
+ ca = single_counts[a]
268
+ cb = single_counts[b]
269
+ if ca == 0 or cb == 0:
270
+ continue
271
+ p_b_given_a = co_occur / ca
272
+ p_a_given_b = co_occur / cb
273
+ if p_b_given_a >= 0.95 and p_a_given_b >= 0.95 and co_occur >= 5:
274
+ perfect_pairs.append((a, b, co_occur, p_b_given_a, p_a_given_b))
275
+
276
+ if perfect_pairs:
277
+ print(f" Found {len(perfect_pairs)} pairs:")
278
+ for a, b, co, pba, pab in perfect_pairs[:30]:
279
+ print(f" [{DESCRIPTOR_NAMES[a]:>15}] ↔ [{DESCRIPTOR_NAMES[b]:>15}] co={co:>5} P(B|A)={pba:.3f} P(A|B)={pab:.3f}")
280
+ else:
281
+ print(" None found.")
282
+
283
+ # High co-occurrence pairs (>= 0.90)
284
+ print(f"\n Descriptor pairs with high co-occurrence (both >=0.90, co-occur >=10):")
285
+ high_pairs = []
286
+ for (a, b), co_occur in pair_counts.most_common():
287
+ ca = single_counts[a]
288
+ cb = single_counts[b]
289
+ if ca == 0 or cb == 0:
290
+ continue
291
+ p_b_given_a = co_occur / ca
292
+ p_a_given_b = co_occur / cb
293
+ if p_b_given_a >= 0.90 and p_a_given_b >= 0.90 and co_occur >= 10:
294
+ high_pairs.append((a, b, co_occur, p_b_given_a, p_a_given_b))
295
+ print(f" Found {len(high_pairs)} pairs:")
296
+ for a, b, co, pba, pab in high_pairs[:30]:
297
+ print(f" [{DESCRIPTOR_NAMES[a]:>15}] ↔ [{DESCRIPTOR_NAMES[b]:>15}] co={co:>5} P(B|A)={pba:.3f} P(A|B)={pab:.3f}")
298
+
299
+ # Top 20 most co-occurring pairs by raw count
300
+ print(f"\n Top 20 descriptor pairs by raw co-occurrence count:")
301
+ for (a, b), co in pair_counts.most_common(20):
302
+ ca, cb = single_counts[a], single_counts[b]
303
+ pba = co / ca if ca else 0
304
+ pab = co / cb if cb else 0
305
+ print(f" [{DESCRIPTOR_NAMES[a]:>15}] + [{DESCRIPTOR_NAMES[b]:>15}] co={co:>5} P(B|A)={pba:.3f} P(A|B)={pab:.3f}")
306
+
307
+ # =====================================================================
308
+ # (6) PER-DESCRIPTOR POSITIVE COUNT
309
+ # =====================================================================
310
+ print(f"\n{'=' * 70}")
311
+ print("(6) PER-DESCRIPTOR POSITIVE COUNT")
312
+ print(f"{'=' * 70}")
313
+
314
+ # Count: how many formulas have each descriptor active (in any tier)
315
+ desc_pos_counts = np.zeros(N_DESCRIPTORS, dtype=int)
316
+ for active_set in descriptor_active:
317
+ for idx in active_set:
318
+ desc_pos_counts[idx] += 1
319
+
320
+ print(f"\n Total descriptors: {N_DESCRIPTORS}")
321
+ print(f" Descriptors with 0 positives: {int(np.sum(desc_pos_counts == 0))}")
322
+ print(f" Descriptors with <10 positives: {int(np.sum(desc_pos_counts < 10))}")
323
+ print(f" Descriptors with <50 positives: {int(np.sum(desc_pos_counts < 50))}")
324
+ print(f" Descriptors with <100 positives: {int(np.sum(desc_pos_counts < 100))}")
325
+ print(f" Descriptors with >=100 positives: {int(np.sum(desc_pos_counts >= 100))}")
326
+ print(f" Descriptors with >=500 positives: {int(np.sum(desc_pos_counts >= 500))}")
327
+
328
+ print(f"\n All {N_DESCRIPTORS} descriptors sorted by positive count:")
329
+ print(f" {'Idx':>4} {'Descriptor':<18} {'Positives':>9} {'% of N':>8}")
330
+ sorted_descs = sorted(range(N_DESCRIPTORS), key=lambda i: desc_pos_counts[i])
331
+ for i in sorted_descs:
332
+ cnt = desc_pos_counts[i]
333
+ name = DESCRIPTOR_NAMES[i] if i < len(DESCRIPTOR_NAMES) else f"idx_{i}"
334
+ flag = " *** ZERO" if cnt == 0 else (" ** <10" if cnt < 10 else (" * <50" if cnt < 50 else ""))
335
+ print(f" {i:>4} {name:<18} {cnt:>9} {cnt/N*100:>7.1f}%{flag}")
336
+
337
+ # Per-tier descriptor counts
338
+ print(f"\n Per-tier descriptor positive counts (pyramid_targets):")
339
+ for tier_idx, tier_name in enumerate(["TOP", "MID", "BASE"]):
340
+ tier_counts = np.zeros(N_DESCRIPTORS, dtype=int)
341
+ for r in records:
342
+ pt = r.get("pyramid_targets")
343
+ if pt and len(pt) > tier_idx:
344
+ for d_idx, val in enumerate(pt[tier_idx]):
345
+ if val > 0:
346
+ tier_counts[d_idx] += 1
347
+ print(f"\n [{tier_name}] Descriptors with 0 positives in this tier: {int(np.sum(tier_counts == 0))}")
348
+ print(f" [{tier_name}] Descriptors with <10 positives: {int(np.sum(tier_counts < 10))}")
349
+ print(f" [{tier_name}] Top 10: ", end="")
350
+ top10 = sorted(range(N_DESCRIPTORS), key=lambda i: tier_counts[i], reverse=True)[:10]
351
+ print(", ".join(f"{DESCRIPTOR_NAMES[i]}({tier_counts[i]})" for i in top10))
352
+
353
+ # =====================================================================
354
+ # (7) PSYCHOMETRIC TARGET DISTRIBUTION
355
+ # =====================================================================
356
+ print(f"\n{'=' * 70}")
357
+ print("(7) PSYCHOMETRIC TARGET DISTRIBUTION")
358
+ print(f"{'=' * 70}")
359
+
360
+ psy_records = [r for r in records if r.get("psychometric_targets") is not None]
361
+ print(f"\n Records with psychometric_targets: {len(psy_records)}")
362
+
363
+ if psy_records:
364
+ sample = psy_records[0]["psychometric_targets"]
365
+ print(f" Dimensionality: {len(sample)}")
366
+
367
+ psy_arr = np.array([r["psychometric_targets"] for r in psy_records])
368
+
369
+ # Per-dimension stats
370
+ print(f"\n Per-dimension statistics:")
371
+ dim_names = ["season_0 (winter)", "season_1 (spring)", "season_2 (summer)",
372
+ "season_3 (autumn)", "gender", "wear_day", "wear_night"]
373
+ for d in range(min(len(sample), 7)):
374
+ name = dim_names[d] if d < len(dim_names) else f"dim_{d}"
375
+ col = psy_arr[:, d]
376
+ print(f" {name}: mean={col.mean():.4f}, std={col.std():.4f}, "
377
+ f"min={col.min():.4f}, max={col.max():.4f}")
378
+
379
+ # Check unique values
380
+ unique_vals, counts = np.unique(col, return_counts=True)
381
+ if len(unique_vals) <= 20:
382
+ val_str = ", ".join(f"{v:.2f}({c})" for v, c in zip(unique_vals, counts))
383
+ print(f" Unique values: {val_str}")
384
+ else:
385
+ # Histogram
386
+ percentiles = [0, 10, 25, 50, 75, 90, 100]
387
+ print(f" Percentiles: {', '.join(f'{p}%={np.percentile(col,p):.3f}' for p in percentiles)}")
388
+
389
+ # Check if any dimension is constant
390
+ print(f"\n Constant dimensions (std < 0.01):")
391
+ for d in range(min(len(sample), 7)):
392
+ name = dim_names[d] if d < len(dim_names) else f"dim_{d}"
393
+ col = psy_arr[:, d]
394
+ if col.std() < 0.01:
395
+ print(f" {name}: CONSTANT at {col.mean():.4f}")
396
+
397
+ # Seasonality: which season is highest per formula
398
+ if len(sample) >= 4:
399
+ seasons = psy_arr[:, :4]
400
+ dominant_season = np.argmax(seasons, axis=1)
401
+ season_names = ["winter", "spring", "summer", "autumn"]
402
+ print(f"\n Dominant season distribution:")
403
+ for s in range(4):
404
+ cnt = int(np.sum(dominant_season == s))
405
+ print(f" {season_names[s]}: {cnt} ({cnt/len(psy_arr)*100:.1f}%)")
406
+
407
+ # Gender distribution
408
+ if len(sample) >= 5:
409
+ gender = psy_arr[:, 4]
410
+ print(f"\n Gender (dim 4):")
411
+ unique_vals, counts = np.unique(np.round(gender, 2), return_counts=True)
412
+ for v, c in zip(unique_vals, counts):
413
+ print(f" {v:.2f}: {c} ({c/len(gender)*100:.1f}%)")
414
+
415
+ # Wear day/night
416
+ if len(sample) >= 7:
417
+ wear_day = psy_arr[:, 5]
418
+ wear_night = psy_arr[:, 6]
419
+ print(f"\n Wear day (dim 5):")
420
+ unique_vals, counts = np.unique(np.round(wear_day, 2), return_counts=True)
421
+ for v, c in zip(unique_vals, counts):
422
+ print(f" {v:.2f}: {c} ({c/len(wear_day)*100:.1f}%)")
423
+ print(f"\n Wear night (dim 6):")
424
+ unique_vals, counts = np.unique(np.round(wear_night, 2), return_counts=True)
425
+ for v, c in zip(unique_vals, counts):
426
+ print(f" {v:.2f}: {c} ({c/len(wear_night)*100:.1f}%)")
427
+
428
+ # Day vs night
429
+ day_gt_night = int(np.sum(wear_day > wear_night))
430
+ night_gt_day = int(np.sum(wear_night > wear_day))
431
+ equal = int(np.sum(np.abs(wear_day - wear_night) < 0.01))
432
+ print(f"\n Day > Night: {day_gt_night}, Night > Day: {night_gt_day}, Equal: {equal}")
433
+
434
+ # Psychometric by genre
435
+ print(f"\n Psychometric means by genre:")
436
+ for genre in sorted(set(r.get("genre") for r in records)):
437
+ g_records = [r for r in psy_records if r.get("genre") == genre]
438
+ if g_records:
439
+ g_arr = np.array([r["psychometric_targets"] for r in g_records])
440
+ means = g_arr.mean(axis=0)
441
+ dim_strs = []
442
+ for d in range(min(7, len(means))):
443
+ name = dim_names[d] if d < len(dim_names) else f"d{d}"
444
+ dim_strs.append(f"{name}={means[d]:.3f}")
445
+ print(f" [{genre}] n={len(g_records)}: {', '.join(dim_strs)}")
446
+
447
+ print(f"\n{'=' * 70}")
448
+ print("AUDIT COMPLETE")
449
+ print(f"{'=' * 70}")
scripts/discrimination_probe.py ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Task 0.5.1 — Discrimination probe.
3
+
4
+ Loads current tier labels, filters the descriptor vocabulary to a
5
+ perfumery-relevant subset, and recomputes cross-genre Jaccard to determine
6
+ whether the vocabulary carries recoverable signal (Option A) or must be
7
+ replaced entirely (Option B).
8
+
9
+ Decision rule:
10
+ - Filtered Jaccard ≤ 0.70 → Path A (remapping is viable)
11
+ - Filtered Jaccard > 0.85 → Path B (vocabulary is non-discriminative)
12
+ - In between → Partial; escalate
13
+ """
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import numpy as np
18
+ from pathlib import Path
19
+ from collections import Counter
20
+
21
+ DATA = Path("data")
22
+ ARTIFACTS = Path("artifacts")
23
+ ARTIFACTS.mkdir(exist_ok=True)
24
+
25
+ # ─── 1. Descriptor keep/drop mapping ─────────────────────────────────────────
26
+
27
+ # Perfumery-relevant descriptors — terms used in actual fragrance pyramids.
28
+ # Includes: floral families, citrus, woods, resins, spices, gourmand, musk/amber,
29
+ # green/herbal, aldehydic, and common qualitative notes (clean, powdery, sweet).
30
+ KEEP = {
31
+ # Floral
32
+ "floral", "rose", "jasmin", "jasmine", "muguet", "hyacinth", "lily",
33
+ "violet", "geranium", "orris",
34
+ # Citrus
35
+ "citrus", "lemon", "orange", "grapefruit", "bergamot",
36
+ # Woody / resin
37
+ "woody", "cedar", "sandalwood", "pine", "cypress",
38
+ # Amber / balsamic / resinous
39
+ "amber", "balsamic", "vanilla", "coumarinic", "tonka",
40
+ # Musk / animalic (perfumery-relevant)
41
+ "musk", "leathery", "animal",
42
+ # Spicy
43
+ "spicy", "cinnamon", "clove", "pepper",
44
+ # Green / herbal
45
+ "green", "herbal", "grassy", "leafy", "lavender", "tea", "tobacco",
46
+ "hay", "aromatic",
47
+ # Aldehydic / clean
48
+ "aldehydic", "clean", "fresh", "soapy",
49
+ # Fruity (perfumery subset)
50
+ "fruity", "apple", "peach", "pear", "berry", "plum",
51
+ # Gourmand / sweet
52
+ "sweet", "honey", "caramellic", "chocolate", "cocoa", "coconut",
53
+ "creamy", "milky",
54
+ # Powder / soft
55
+ "powdery", "warm",
56
+ # Earthy / mossy (perfumery-relevant)
57
+ "earthy", "mossy", "oakmoss",
58
+ # Marine / ozonic
59
+ "ozone",
60
+ # Miscellaneous perfumery
61
+ "waxy", "dry",
62
+ }
63
+
64
+ # Off-odor / raw-material GC-O descriptors that have no place in perfume pyramids
65
+ DROP_EXPLICIT = {
66
+ # Food/spoilage off-odors
67
+ "sulfurous", "fishy", "cheesy", "burnt", "popcorn", "fatty", "garlic",
68
+ "onion", "cabbage", "radish", "horseradish", "potato", "tomato",
69
+ "vegetable", "brothy", "beefy", "meaty", "chicken", "mushroom",
70
+ "fermented", "rummy", "brandy", "cognac", "winey", "rum",
71
+ # Chemical / industrial
72
+ "acidic", "alliaceous", "camphoreous", "ketonic", "lactonic", "estery",
73
+ "ethereal", "solvent", "gasoline", "metallic", "medicinal", "phenolic",
74
+ "musty", "moldy",
75
+ # Redundant / too generic to be discriminative
76
+ "bland", "mild", "odorless", "cooked", "roasted", "ripe", "juicy",
77
+ "sour", "sharp", "terpenic", "weedy", "celery",
78
+ # Food-specific (non-perfumery)
79
+ "banana", "cherry", "grape", "melon", "pineapple", "raspberry",
80
+ "strawberry", "tropical", "cucumber", "cortex", "almond", "hazelnut",
81
+ "nutty", "malty", "bready", "brown", "buttery", "dairy",
82
+ # Duplicate / variant
83
+ "minty", "mint", "mentholic", # keep "cooling" or "fresh" instead
84
+ "caramellic", # keep "sweet" instead
85
+ "chamomile", # rarely used in perfume pyramids
86
+ "tropical",
87
+ }
88
+
89
+ # Any descriptor not in KEEP or DROP_EXPLICIT gets flagged for manual review
90
+ NEEDS_REVIEW: set[str] = set()
91
+
92
+
93
+ def build_descriptor_map(vocab: list[str]) -> dict[str, dict]:
94
+ """Classify each vocabulary descriptor into keep/drop/review."""
95
+ mapping = {}
96
+ for idx, desc in enumerate(vocab):
97
+ desc_lower = desc.lower()
98
+ if desc_lower in KEEP:
99
+ status = "keep"
100
+ elif desc_lower in DROP_EXPLICIT:
101
+ status = "drop"
102
+ elif desc_lower in {d.lower() for d in KEEP}: # case-insensitive catch
103
+ status = "keep"
104
+ elif desc_lower in {d.lower() for d in DROP_EXPLICIT}:
105
+ status = "drop"
106
+ else:
107
+ status = "review"
108
+ NEEDS_REVIEW.add(desc)
109
+ mapping[desc] = {"index": idx, "status": status}
110
+ return mapping
111
+
112
+
113
+ def main() -> None:
114
+ # Load data
115
+ vocab = json.loads((DATA / "pyrfume_vocabulary.json").read_text())["vocabulary"]
116
+ assert len(vocab) == 138
117
+
118
+ with open(DATA / "empirical_dataset_v8.jsonl") as f:
119
+ records = [json.loads(l) for l in f]
120
+
121
+ # Build descriptor mapping
122
+ mapping = build_descriptor_map(vocab)
123
+ keep_indices = [v["index"] for v in mapping.values() if v["status"] == "keep"]
124
+ drop_indices = [v["index"] for v in mapping.values() if v["status"] == "drop"]
125
+ review_indices = [v["index"] for v in mapping.values() if v["status"] == "review"]
126
+
127
+ print(f"=== Descriptor Mapping ({len(vocab)} total) ===")
128
+ print(f" KEEP: {len(keep_indices):3d} descriptors")
129
+ print(f" DROP: {len(drop_indices):3d} descriptors")
130
+ print(f" REVIEW: {len(review_indices):3d} descriptors")
131
+ if review_indices:
132
+ print(f" Review items: {[vocab[i] for i in review_indices]}")
133
+ print()
134
+
135
+ # Auto-resolve review items: default to DROP for anything not explicitly kept
136
+ # (conservative — prefer signal over noise)
137
+ for desc in NEEDS_REVIEW:
138
+ mapping[desc]["status"] = "drop_auto"
139
+ final_keep = [v["index"] for v in mapping.values() if v["status"] in ("keep",)]
140
+ final_drop = [v["index"] for v in mapping.values() if v["status"] in ("drop", "drop_auto")]
141
+
142
+ print(f"After auto-resolution (review → drop):")
143
+ print(f" Final KEEP: {len(final_keep)} descriptors")
144
+ print(f" Final DROP: {len(final_drop)} descriptors")
145
+ print(f" Kept: {[vocab[i] for i in sorted(final_keep)]}")
146
+ print()
147
+
148
+ # Persist mapping artifact
149
+ artifact = {
150
+ "version": "v1",
151
+ "total_descriptors": len(vocab),
152
+ "keep_count": len(final_keep),
153
+ "drop_count": len(final_drop),
154
+ "keep_indices": sorted(final_keep),
155
+ "drop_indices": sorted(final_drop),
156
+ "mapping": mapping,
157
+ }
158
+ (ARTIFACTS / "descriptor_map_v1.json").write_text(json.dumps(artifact, indent=2))
159
+ print(f"Mapping persisted to artifacts/descriptor_map_v1.json")
160
+ print()
161
+
162
+ # ─── 2. Recompute cross-genre Jaccard on filtered subset ──────────────────
163
+
164
+ # Build target matrix
165
+ targets = []
166
+ genres = []
167
+ for r in records:
168
+ if r.get("is_control"):
169
+ continue
170
+ targets.append(np.array(r["pyramid_targets"]))
171
+ genres.append(r.get("genre", "unknown"))
172
+
173
+ targets = np.stack(targets) # (N, 3, 138)
174
+ genres = np.array(genres)
175
+
176
+ keep_arr = np.array(sorted(final_keep))
177
+
178
+ # ─── ORIGINAL (unfiltered) Jaccard ────────────────────────────────────────
179
+ # Jaccard is computed per-sample (binary vectors), then averaged within
180
+ # each genre pair. Genre means are fractional (0-1 across samples), so
181
+ # we must binarize at a lower threshold that reflects "this descriptor
182
+ # appears in a meaningful fraction of formulas of this genre."
183
+ BINARIZE_THRESHOLD = 0.05 # descriptor active in ≥5% of genre formulas
184
+
185
+ print(f"=== ORIGINAL (unfiltered) Cross-Genre Jaccard — TOP tier ===")
186
+ print(f" (binarizing genre-mean vectors at {BINARIZE_THRESHOLD} frequency threshold)")
187
+ genre_means = {}
188
+ for genre in sorted(set(genres)):
189
+ mask = genres == genre
190
+ if mask.sum() < 10:
191
+ continue
192
+ genre_means[genre] = targets[mask, 0, :].mean(axis=0)
193
+
194
+ genres_list = list(genre_means.keys())
195
+ orig_jaccards_top = []
196
+ for gi in range(len(genres_list)):
197
+ for gj in range(gi + 1, len(genres_list)):
198
+ v1, v2 = genre_means[genres_list[gi]], genre_means[genres_list[gj]]
199
+ b1 = (v1 >= BINARIZE_THRESHOLD).astype(float)
200
+ b2 = (v2 >= BINARIZE_THRESHOLD).astype(float)
201
+ intersection = np.sum((b1 > 0) & (b2 > 0))
202
+ union = np.sum((b1 > 0) | (b2 > 0))
203
+ jac = intersection / max(1, union)
204
+ orig_jaccards_top.append(jac)
205
+ print(f" {genres_list[gi]:16s} vs {genres_list[gj]:16s}: Jaccard={jac:.3f} (|A∩B|={int(intersection)}, |A∪B|={int(union)})")
206
+ print(f" MEAN original Jaccard (top): {np.mean(orig_jaccards_top):.3f}")
207
+ print()
208
+
209
+ # ─── Filtered Jaccard — TOP ───────────────────────────────────────────────
210
+ print("=== FILTERED Cross-Genre Jaccard — TOP tier ===")
211
+ filt_jaccards_top = []
212
+ for gi in range(len(genres_list)):
213
+ for gj in range(gi + 1, len(genres_list)):
214
+ v1 = genre_means[genres_list[gi]][keep_arr]
215
+ v2 = genre_means[genres_list[gj]][keep_arr]
216
+ b1 = (v1 >= BINARIZE_THRESHOLD).astype(float)
217
+ b2 = (v2 >= BINARIZE_THRESHOLD).astype(float)
218
+ intersection = np.sum((b1 > 0) & (b2 > 0))
219
+ union = np.sum((b1 > 0) | (b2 > 0))
220
+ jac = intersection / max(1, union)
221
+ filt_jaccards_top.append(jac)
222
+ print(f" {genres_list[gi]:16s} vs {genres_list[gj]:16s}: Jaccard={jac:.3f} (|A∩B|={int(intersection)}, |A∪B|={int(union)})")
223
+ mean_filt_top = np.mean(filt_jaccards_top)
224
+ print(f" MEAN filtered Jaccard (top): {mean_filt_top:.3f}")
225
+ print()
226
+
227
+ # ─── Filtered Jaccard — MIDDLE ────────────────────────────────────────────
228
+ genre_means_mid = {}
229
+ for genre in sorted(set(genres)):
230
+ mask = genres == genre
231
+ if mask.sum() < 10:
232
+ continue
233
+ genre_means_mid[genre] = targets[mask, 1, :].mean(axis=0)
234
+
235
+ print("=== FILTERED Cross-Genre Jaccard — MIDDLE tier ===")
236
+ filt_jaccards_mid = []
237
+ for gi in range(len(genres_list)):
238
+ for gj in range(gi + 1, len(genres_list)):
239
+ v1 = genre_means_mid[genres_list[gi]][keep_arr]
240
+ v2 = genre_means_mid[genres_list[gj]][keep_arr]
241
+ b1 = (v1 >= BINARIZE_THRESHOLD).astype(float)
242
+ b2 = (v2 >= BINARIZE_THRESHOLD).astype(float)
243
+ intersection = np.sum((b1 > 0) & (b2 > 0))
244
+ union = np.sum((b1 > 0) | (b2 > 0))
245
+ jac = intersection / max(1, union)
246
+ filt_jaccards_mid.append(jac)
247
+ print(f" {genres_list[gi]:16s} vs {genres_list[gj]:16s}: Jaccard={jac:.3f} (|A∩B|={int(intersection)}, |A∪B|={int(union)})")
248
+ mean_filt_mid = np.mean(filt_jaccards_mid)
249
+ print(f" MEAN filtered Jaccard (mid): {mean_filt_mid:.3f}")
250
+ print()
251
+
252
+ # ─── 3. Decision ──────────────────────────────────────────────────────────
253
+ print("=" * 60)
254
+ print("=== DECISION ===")
255
+ print(f" Filtered top Jaccard: {mean_filt_top:.3f}")
256
+ print(f" Filtered mid Jaccard: {mean_filt_mid:.3f}")
257
+ print()
258
+
259
+ worst = max(mean_filt_top, mean_filt_mid)
260
+ if worst <= 0.70:
261
+ decision = "PATH A — Vocabulary carries recoverable signal. Remapping is viable."
262
+ elif worst > 0.85:
263
+ decision = "PATH B — Vocabulary is fundamentally non-discriminative. Label SOURCE must change."
264
+ else:
265
+ decision = "PARTIAL — Vocabulary has some signal but insufficient. Escalate to Matt."
266
+
267
+ print(f" Decision: {decision}")
268
+ print("=" * 60)
269
+
270
+
271
+ if __name__ == "__main__":
272
+ main()
scripts/eval_v6.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import torch, json, numpy as np
3
+ from torch.utils.data import DataLoader
4
+ from pino.pimt_model import FragranceTrajectoryDataset, PhysicsInformedMixtureTransformer
5
+ from pino.heads import PIMTHeads
6
+ from pino.train import pad_trajectory_collate, DEFAULT_EMBEDDING_DIM
7
+ from scipy.spatial.distance import pdist
8
+
9
+ ckpt = torch.load("models/pimt_v6.pt", map_location="cpu", weights_only=False)
10
+ sd = ckpt["model_state_dict"]
11
+ emb_dim = sd["input_proj.weight"].shape[1]
12
+ hidden_dim = sd["input_proj.weight"].shape[0]
13
+ state_dim = sd["gating.physics_scaler"].shape[0]
14
+
15
+ model = PhysicsInformedMixtureTransformer(
16
+ embedding_dim=emb_dim, state_dim=state_dim, hidden_dim=hidden_dim,
17
+ num_heads=8, num_layers=4
18
+ )
19
+ model.load_state_dict(ckpt["model_state_dict"])
20
+ model.eval()
21
+
22
+ heads = PIMTHeads(hidden_dim=hidden_dim, objective_dim=138)
23
+ heads.load_state_dict(ckpt["heads_state_dict"])
24
+ heads.eval()
25
+
26
+ dataset = FragranceTrajectoryDataset(
27
+ "data/empirical_dataset_v8.jsonl",
28
+ max_ingredients=50, state_dim=state_dim, embedding_dim=emb_dim
29
+ )
30
+ n_total = len(dataset)
31
+ n_train = int(n_total * 0.8)
32
+ val_dataset = torch.utils.data.Subset(dataset, list(range(n_train, n_total)))
33
+ val_loader = DataLoader(val_dataset, batch_size=8, shuffle=False, collate_fn=pad_trajectory_collate)
34
+ print(f"Total: {n_total}, Val: {len(val_dataset)}")
35
+
36
+ all_preds, all_targets = [], []
37
+
38
+ with torch.no_grad():
39
+ for batch in val_loader:
40
+ tokens = batch["tokens"]
41
+ physics = batch["physics"]
42
+ mask = batch["src_key_padding_mask"]
43
+ latent = model(tokens, physics, src_key_padding_mask=mask)
44
+ output = heads(latent, physics, mask)
45
+ all_preds.append(output["objective"].numpy())
46
+ all_targets.append(batch["target_obj"].numpy())
47
+
48
+ preds = np.concatenate(all_preds, axis=0) # (N, 3, 138)
49
+ targets = np.concatenate(all_targets, axis=0)
50
+
51
+ tier_names = ["Top", "Middle", "Base"]
52
+ print()
53
+ print("=== Prediction Quality ===")
54
+ header = f"{'Tier':<10} {'MSE':<10} {'MAE':<10} {'Var(pred)':<12} {'Var(tgt)':<12}"
55
+ print(header)
56
+ print("-" * len(header))
57
+ for t, name in enumerate(tier_names):
58
+ p, gt = preds[:, t, :], targets[:, t, :]
59
+ mse = ((p - gt) ** 2).mean()
60
+ mae = np.abs(p - gt).mean()
61
+ print(f"{name:<10} {mse:<10.4f} {mae:<10.4f} {p.var():<12.6f} {gt.var():<12.6f}")
62
+
63
+ print()
64
+ print("=== Prediction Diversity (pairwise cosine sim, lower = more diverse) ===")
65
+ for t, name in enumerate(tier_names):
66
+ p = preds[:, t, :]
67
+ sims = 1 - pdist(p, metric="cosine")
68
+ print(f" {name:8s}: {sims.mean():.4f}")
69
+
70
+ # Descriptor ranking
71
+ with open("data/pyrfume_vocabulary.json") as f:
72
+ vocab_raw = json.load(f)
73
+ if isinstance(vocab_raw, dict):
74
+ vocab = [str(v) for v in vocab_raw.values()]
75
+ elif isinstance(vocab_raw, list):
76
+ vocab = [str(v) for v in vocab_raw]
77
+ else:
78
+ vocab = []
79
+ vocab = sorted(vocab)
80
+
81
+ print()
82
+ print("=== Top 5 Predicted Descriptors per Tier ===")
83
+ for t, name in enumerate(tier_names):
84
+ p = preds[:, t, :].mean(axis=0)
85
+ top5 = np.argsort(p)[-5:][::-1]
86
+ items = [(vocab[i] if i < len(vocab) else f"d{i}", round(float(p[i]), 3)) for i in top5]
87
+ print(f" {name}: {items}")
88
+
89
+ print()
90
+ print("=== Top 5 Target Descriptors per Tier (ground truth) ===")
91
+ for t, name in enumerate(tier_names):
92
+ p = targets[:, t, :].mean(axis=0)
93
+ top5 = np.argsort(p)[-5:][::-1]
94
+ items = [(vocab[i] if i < len(vocab) else f"d{i}", round(float(p[i]), 3)) for i in top5]
95
+ print(f" {name}: {items}")
96
+
97
+ # Rank correlation
98
+ print()
99
+ print("=== Rank Correlation (Spearman, pred vs target per tier) ===")
100
+ from scipy.stats import spearmanr
101
+ for t, name in enumerate(tier_names):
102
+ rho_list = []
103
+ for i in range(len(preds)):
104
+ rho, _ = spearmanr(preds[i, t, :], targets[i, t, :])
105
+ if rho is not None and not np.isnan(rho):
106
+ rho_list.append(rho)
107
+ print(f" {name:8s}: mean Spearman rho = {np.mean(rho_list):.4f} (n={len(rho_list)})")
smoke_145d.log ADDED
The diff for this file is too large to render. See raw diff
 
smoke_145d_v2.log ADDED
The diff for this file is too large to render. See raw diff
 
smoke_alignment.log ADDED
The diff for this file is too large to render. See raw diff
 
training.log.REMOVED.git-id ADDED
@@ -0,0 +1 @@
 
 
1
+ 3e6621283bff941925b4bb974583016c34ebaf10
training_5epoch.log ADDED
The diff for this file is too large to render. See raw diff
 
training_5epoch_bs32.log ADDED
The diff for this file is too large to render. See raw diff
 
training_5epoch_final.log ADDED
The diff for this file is too large to render. See raw diff
 
training_5epoch_v2.log ADDED
The diff for this file is too large to render. See raw diff
 
training_formula_disjoint.log ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ 2026-07-07 14:51:51,944 INFO pino.train: Training PIMT with fallback embeddings (use_fallback=True)
2
+ 2026-07-07 14:51:51,944 INFO pino.train: Embedding backend: deterministic 128-bit Morgan + 10 physicochemical descriptors
3
+ 2026-07-07 14:51:51,945 INFO pino.train: Device: cpu
4
+ 2026-07-07 14:51:51,945 INFO pino.train: Configuration: {'hidden_dim': 256, 'num_layers': 4, 'num_heads': 4, 'batch_size': 8, 'max_batches_per_epoch': None, 'lr': 0.001, 'weight_decay': 0.01, 'checkpoint_name': 'pimt_v1.pt'}
5
+ 2026-07-07 14:51:51,945 INFO pino.upload_data: Loading raw corpus from data/synthetic_dataset_v2.jsonl
training_formula_disjoint_final.log.REMOVED.git-id ADDED
@@ -0,0 +1 @@
 
 
1
+ ae6e5db2ac36fc45d127b61574808445d4560b3f
training_formula_disjoint_v2.log ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2026-07-07 15:04:09,017 INFO pino.train: Training PIMT with fallback embeddings (use_fallback=True)
2
+ 2026-07-07 15:04:09,017 INFO pino.train: Embedding backend: deterministic 128-bit Morgan + 10 physicochemical descriptors
3
+ 2026-07-07 15:04:09,018 INFO pino.train: Device: cpu
4
+ 2026-07-07 15:04:09,018 INFO pino.train: Configuration: {'hidden_dim': 256, 'num_layers': 4, 'num_heads': 4, 'batch_size': 8, 'max_batches_per_epoch': None, 'lr': 0.001, 'weight_decay': 0.01, 'checkpoint_name': 'pimt_v1.pt'}
5
+ ⏳ Initiating formula-disjoint dataset partitioning...
6
+ 2026-07-07 15:04:09,018 INFO pino.upload_data: Loading raw corpus from data/synthetic_dataset_v2.jsonl
7
+ 2026-07-07 15:04:09,370 INFO httpx: HTTP Request: HEAD https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/json/json.py "HTTP/1.1 200 OK"
8
+ ✅ Formula-Disjoint Split Complete.
9
+ - Training Recipes: 15911
10
+ - Validation Recipes: 4089
11
+ 🔒 Formula isolation check: 598 identical recipes shared between splits.
12
+ Traceback (most recent call last):
13
+ File "/home/hermes/pino/src/pino/train.py", line 386, in <module>
14
+ main()
15
+ File "/home/hermes/pino/src/pino/train.py", line 302, in main
16
+ assert len(overlap) == 0, f"Formula leakage detected: {overlap}"
17
+ ^^^^^^^^^^^^^^^^^
18
+ AssertionError: Formula leakage detected: {'gen_citr_0293', 'gen_citr_1400', 'gen_citr_1457', 'gen_citr_1148', 'gen_citr_0826', 'gen_citr_1753', 'gen_citr_0347', 'gen_citr_0457', 'gen_citr_0906', 'gen_citr_1737', 'gen_citr_1483', 'gen_citr_1147', 'gen_citr_0269', 'gen_citr_1152', 'gen_citr_1648', 'gen_citr_1449', 'gen_citr_0989', 'gen_citr_0285', 'gen_citr_0139', 'gen_citr_0661', 'gen_citr_0351', 'gen_citr_1372', 'gen_citr_0802', 'gen_citr_1488', 'gen_citr_1594', 'gen_citr_1364', 'gen_citr_0385', 'gen_citr_0030', 'gen_citr_1024', 'gen_citr_1092', 'gen_citr_1408', 'gen_citr_0964', 'gen_citr_0853', 'gen_citr_1522', 'gen_citr_1767', 'gen_citr_0068', 'gen_citr_1630', 'gen_citr_1513', 'gen_citr_1056', 'gen_citr_0249', 'gen_citr_0092', 'gen_citr_1077', 'gen_citr_0947', 'gen_citr_1015', 'gen_citr_1730', 'gen_citr_0694', 'gen_citr_0189', 'gen_citr_1027', 'gen_citr_0148', 'gen_citr_1502', 'gen_citr_1016', 'gen_citr_0129', 'gen_citr_0640', 'gen_citr_1696', 'gen_citr_1358', 'gen_citr_0509', 'gen_citr_0427', 'gen_citr_0794', 'gen_citr_1398', 'gen_citr_0191', 'gen_citr_0895', 'gen_citr_1806', 'gen_citr_1319', 'gen_citr_0911', 'gen_citr_1338', 'gen_citr_0098', 'gen_citr_0418', 'gen_citr_1190', 'gen_citr_0278', 'gen_citr_1267', 'gen_citr_0085', 'gen_citr_1670', 'gen_citr_1275', 'gen_citr_1099', 'gen_citr_0879', 'gen_citr_0914', 'gen_citr_0018', 'gen_citr_0696', 'gen_citr_0636', 'gen_citr_0733', 'gen_citr_1344', 'gen_citr_0620', 'gen_citr_1664', 'gen_citr_0645', 'gen_citr_0232', 'gen_citr_1575', 'gen_citr_1095', 'gen_citr_0974', 'gen_citr_0921', 'gen_citr_0089', 'gen_citr_0616', 'gen_citr_0358', 'gen_citr_0316', 'gen_citr_1711', 'gen_citr_0975', 'gen_citr_1233', 'gen_citr_1140', 'gen_citr_1272', 'gen_citr_0527', 'gen_citr_0523', 'gen_citr_1517', 'gen_citr_0724', 'gen_citr_1425', 'gen_citr_1610', 'gen_citr_0049', 'gen_citr_1672', 'gen_citr_0944', 'gen_citr_0350', 'gen_citr_1744', 'gen_citr_0606', 'gen_citr_1743', 'gen_citr_0834', 'gen_citr_1698', 'gen_citr_0230', 'gen_citr_1157', 'gen_citr_1214', 'gen_citr_1072', 'gen_citr_0301', 'gen_citr_1404', 'gen_citr_1770', 'gen_citr_0884', 'gen_citr_0820', 'gen_citr_1102', 'gen_citr_1110', 'gen_citr_0913', 'gen_citr_0037', 'gen_citr_0445', 'gen_citr_0978', 'gen_citr_1029', 'gen_citr_1306', 'gen_citr_0547', 'gen_citr_0647', 'gen_citr_1665', 'gen_citr_1739', 'gen_citr_1427', 'gen_citr_0997', 'gen_citr_1210', 'gen_citr_1486', 'gen_citr_1563', 'gen_citr_0335', 'gen_citr_1001', 'gen_citr_0849', 'gen_citr_0226', 'gen_citr_1089', 'gen_citr_0262', 'gen_citr_0222', 'gen_citr_1576', 'gen_citr_1192', 'gen_citr_0392', 'gen_citr_1588', 'gen_citr_0315', 'gen_citr_0933', 'gen_citr_0973', 'gen_citr_0745', 'gen_citr_1728', 'gen_citr_0184', 'gen_citr_1417', 'gen_citr_0553', 'gen_citr_0169', 'gen_citr_1219', 'gen_citr_1479', 'gen_citr_1414', 'gen_citr_0410', 'gen_citr_1631', 'gen_citr_0141', 'gen_citr_0058', 'gen_citr_1676', 'gen_citr_1366', 'gen_citr_0676', 'gen_citr_1312', 'gen_citr_0029', 'gen_citr_0360', 'gen_citr_1660', 'gen_citr_0845', 'gen_citr_0555', 'gen_citr_0526', 'gen_citr_0352', 'gen_citr_0099', 'gen_citr_1680', 'gen_citr_0292', 'gen_citr_1080', 'gen_citr_1008', 'gen_citr_0178', 'gen_citr_0012', 'gen_citr_0774', 'gen_citr_0498', 'gen_citr_0214', 'gen_citr_0460', 'gen_citr_1175', 'gen_citr_1252', 'gen_citr_0899', 'gen_citr_1462', 'gen_citr_1752', 'gen_citr_0119', 'gen_citr_0395', 'gen_citr_1437', 'gen_citr_0397', 'gen_citr_0468', 'gen_citr_0894', 'gen_citr_1617', 'gen_citr_1201', 'gen_citr_1383', 'gen_citr_0446', 'gen_citr_0536', 'gen_citr_0570', 'gen_citr_0663', 'gen_citr_1144', 'gen_citr_1131', 'gen_citr_0044', 'gen_citr_0111', 'gen_citr_0192', 'gen_citr_0411', 'gen_citr_0218', 'gen_citr_1518', 'gen_citr_0380', 'gen_citr_0789', 'gen_citr_0147', 'gen_citr_1443', 'gen_citr_1373', 'gen_citr_1692', 'gen_citr_0753', 'gen_citr_0581', 'gen_citr_1224', 'gen_citr_1482', 'gen_citr_1374', 'gen_citr_1280', 'gen_citr_1555', 'gen_citr_1573', 'gen_citr_0337', 'gen_citr_0690', 'gen_citr_0025', 'gen_citr_0251', 'gen_citr_1470', 'gen_citr_1032', 'gen_citr_1694', 'gen_citr_0771', 'gen_citr_0297', 'gen_citr_0327', 'gen_citr_1161', 'gen_citr_0920', 'gen_citr_0499', 'gen_citr_1173', 'gen_citr_1652', 'gen_citr_1506', 'gen_citr_1322', 'gen_citr_0072', 'gen_citr_1647', 'gen_citr_1199', 'gen_citr_0346', 'gen_citr_0064', 'gen_citr_1651', 'gen_citr_0132', 'gen_citr_0182', 'gen_citr_1035', 'gen_citr_0067', 'gen_citr_0071', 'gen_citr_0401', 'gen_citr_1495', 'gen_citr_1697', 'gen_citr_1487', 'gen_citr_0736', 'gen_citr_1350', 'gen_citr_1316', 'gen_citr_0692', 'gen_citr_0562', 'gen_citr_0435', 'gen_citr_0666', 'gen_citr_0255', 'gen_citr_0082', 'gen_citr_1065', 'gen_citr_0786', 'gen_citr_1232', 'gen_citr_1402', 'gen_citr_0575', 'gen_citr_1723', 'gen_citr_0461', 'gen_citr_0809', 'gen_citr_0889', 'gen_citr_0017', 'gen_citr_1160', 'gen_citr_1003', 'gen_citr_1621', 'gen_citr_0414', 'gen_citr_0477', 'gen_citr_0873', 'gen_citr_0065', 'gen_citr_1305', 'gen_citr_0742', 'gen_citr_0117', 'gen_citr_0002', 'gen_citr_0939', 'gen_citr_0890', 'gen_citr_0003', 'gen_citr_1516', 'gen_citr_0007', 'gen_citr_1205', 'gen_citr_1271', 'gen_citr_0437', 'gen_citr_0670', 'gen_citr_0982', 'gen_citr_0053', 'gen_citr_0991', 'gen_citr_0444', 'gen_citr_0309', 'gen_citr_0217', 'gen_citr_0115', 'gen_citr_0379', 'gen_citr_0770', 'gen_citr_0508', 'gen_citr_0083', 'gen_citr_0280', 'gen_citr_0996', 'gen_citr_1485', 'gen_citr_1230', 'gen_citr_0172', 'gen_citr_0413', 'gen_citr_0540', 'gen_citr_1159', 'gen_citr_1174', 'gen_citr_0149', 'gen_citr_1178', 'gen_citr_0440', 'gen_citr_1342', 'gen_citr_0196', 'gen_citr_0681', 'gen_citr_0143', 'gen_citr_0726', 'gen_citr_0511', 'gen_citr_0761', 'gen_citr_0276', 'gen_citr_1276', 'gen_citr_0747', 'gen_citr_0660', 'gen_citr_0384', 'gen_citr_0637', 'gen_citr_1076', 'gen_citr_0966', 'gen_citr_1644', 'gen_citr_1734', 'gen_citr_1123', 'gen_citr_1028', 'gen_citr_1791', 'gen_citr_0600', 'gen_citr_1606', 'gen_citr_1571', 'gen_citr_0948', 'gen_citr_1773', 'gen_citr_1632', 'gen_citr_1363', 'gen_citr_1074', 'gen_citr_1638', 'gen_citr_0901', 'gen_citr_0842', 'gen_citr_1055', 'gen_citr_0829', 'gen_citr_1273', 'gen_citr_1801', 'gen_citr_1524', 'gen_citr_0187', 'gen_citr_0317', 'gen_citr_0258', 'gen_citr_0295', 'gen_citr_0118', 'gen_citr_1434', 'gen_citr_0810', 'gen_citr_0396', 'gen_citr_1763', 'gen_citr_0941', 'gen_citr_0882', 'gen_citr_0375', 'gen_citr_0195', 'gen_citr_1798', 'gen_citr_1329', 'gen_citr_0532', 'gen_citr_1387', 'gen_citr_1809', 'gen_citr_1500', 'gen_citr_1163', 'gen_citr_0896', 'gen_citr_0571', 'gen_citr_0472', 'gen_citr_0046', 'gen_citr_1046', 'gen_citr_1128', 'gen_citr_1302', 'gen_citr_0250', 'gen_citr_0866', 'gen_citr_1197', 'gen_citr_1054', 'gen_citr_0781', 'gen_citr_0950', 'gen_citr_1359', 'gen_citr_1293', 'gen_citr_1433', 'gen_citr_0928', 'gen_citr_0105', 'gen_citr_0709', 'gen_citr_0758', 'gen_citr_0669', 'gen_citr_0538', 'gen_citr_1472', 'gen_citr_0364', 'gen_citr_1732', 'gen_citr_0240', 'gen_citr_1721', 'gen_citr_1745', 'gen_citr_0525', 'gen_citr_0566', 'gen_citr_0861', 'gen_citr_0378', 'gen_citr_1569', 'gen_citr_0773', 'gen_citr_1815', 'gen_citr_0486', 'gen_citr_1639', 'gen_citr_1640', 'gen_citr_1536', 'gen_citr_0133', 'gen_citr_0377', 'gen_citr_0916', 'gen_citr_0937', 'gen_citr_1069', 'gen_citr_0219', 'gen_citr_1257', 'gen_citr_1401', 'gen_citr_0371', 'gen_citr_0436', 'gen_citr_1684', 'gen_citr_1290', 'gen_citr_0767', 'gen_citr_0824', 'gen_citr_0858', 'gen_citr_1426', 'gen_citr_1011', 'gen_citr_1598', 'gen_citr_0878', 'gen_citr_0403', 'gen_citr_0940', 'gen_citr_1314', 'gen_citr_0942', 'gen_citr_1085', 'gen_citr_0644', 'gen_citr_1245', 'gen_citr_0399', 'gen_citr_0252', 'gen_citr_0247', 'gen_citr_1709', 'gen_citr_1667', 'gen_citr_0463', 'gen_citr_0171', 'gen_citr_0193', 'gen_citr_1519', 'gen_citr_0615', 'gen_citr_0061', 'gen_citr_0343', 'gen_citr_0124', 'gen_citr_1688', 'gen_citr_1552', 'gen_citr_1399', 'gen_citr_0272', 'gen_citr_1020', 'gen_citr_0212', 'gen_citr_1155', 'gen_citr_0972', 'gen_citr_0569', 'gen_citr_1303', 'gen_citr_1291', 'gen_citr_0559', 'gen_citr_1476', 'gen_citr_0368', 'gen_citr_1356', 'gen_citr_0369', 'gen_citr_0390', 'gen_citr_1543', 'gen_citr_1296', 'gen_citr_0593', 'gen_citr_0323', 'gen_citr_1671', 'gen_citr_0568', 'gen_citr_1792', 'gen_citr_1611', 'gen_citr_0464', 'gen_citr_1757', 'gen_citr_0811', 'gen_citr_0077', 'gen_citr_1460', 'gen_citr_1706', 'gen_citr_0086', 'gen_citr_1572', 'gen_citr_1531', 'gen_citr_1691', 'gen_citr_0607', 'gen_citr_1816', 'gen_citr_1138', 'gen_citr_0848', 'gen_citr_0756', 'gen_citr_1453', 'gen_citr_0248', 'gen_citr_0239', 'gen_citr_1478', 'gen_citr_1265', 'gen_citr_0563', 'gen_citr_1281', 'gen_citr_0158', 'gen_citr_0888', 'gen_citr_0712', 'gen_citr_0412', 'gen_citr_0389', 'gen_citr_0348', 'gen_citr_0979', 'gen_citr_0325', 'gen_citr_1778', 'gen_citr_0898', 'gen_citr_0267', 'gen_citr_0985', 'gen_citr_1031', 'gen_citr_1362', 'gen_citr_0026', 'gen_citr_0955', 'gen_citr_0775', 'gen_citr_0406', 'gen_citr_1590', 'gen_citr_1299', 'gen_citr_0308', 'gen_citr_0039', 'gen_citr_0177', 'gen_citr_0201', 'gen_citr_0090', 'gen_citr_0441', 'gen_citr_0678', 'gen_citr_0400', 'gen_citr_1475', 'gen_citr_1108', 'gen_citr_1045', 'gen_citr_0863', 'gen_citr_1658', 'gen_citr_1036', 'gen_citr_0855', 'gen_citr_0453', 'gen_citr_1339', 'gen_citr_1251', 'gen_citr_0638', 'gen_citr_1328', 'gen_citr_1599', 'gen_citr_0020', 'gen_citr_0621', 'gen_citr_0725', 'gen_citr_0564', 'gen_citr_1609', 'gen_citr_0176', 'gen_citr_0503', 'gen_citr_0417', 'gen_citr_0549', 'gen_citr_1474', 'gen_citr_0366', 'gen_citr_1018', 'gen_citr_1633', 'gen_citr_1423', 'gen_citr_0900', 'gen_citr_0886', 'gen_citr_1589', 'gen_citr_1780', 'gen_citr_1716', 'gen_citr_0493', 'gen_citr_0655', 'gen_citr_1203', 'gen_citr_0229', 'gen_citr_1596', 'gen_citr_0095', 'gen_citr_0504', 'gen_citr_1115', 'gen_citr_1375', 'gen_citr_1439', 'gen_citr_0812', 'gen_citr_0289', 'gen_citr_1620', 'gen_citr_0565', 'gen_citr_0592', 'gen_citr_1674', 'gen_citr_1634', 'gen_citr_1294', 'gen_citr_1431', 'gen_citr_1088', 'gen_citr_1700', 'gen_citr_1357', 'gen_citr_0541', 'gen_citr_1090', 'gen_citr_0703', 'gen_citr_1547', 'gen_citr_0234', 'gen_citr_1103', 'gen_citr_0963', 'gen_citr_1213', 'gen_citr_1556', 'gen_citr_0331', 'gen_citr_1551', 'gen_citr_1521', 'gen_citr_0730'}