Matthew Ford commited on
Commit
cda8f3a
·
unverified ·
1 Parent(s): cc71055

feat: expand descriptor target coverage

Browse files
artifacts/descriptor_map_v1.json ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v1",
3
+ "total_descriptors": 138,
4
+ "keep_count": 58,
5
+ "drop_count": 80,
6
+ "keep_indices": [
7
+ 2,
8
+ 5,
9
+ 6,
10
+ 8,
11
+ 10,
12
+ 13,
13
+ 23,
14
+ 24,
15
+ 30,
16
+ 31,
17
+ 32,
18
+ 33,
19
+ 34,
20
+ 35,
21
+ 41,
22
+ 42,
23
+ 45,
24
+ 46,
25
+ 52,
26
+ 53,
27
+ 54,
28
+ 57,
29
+ 59,
30
+ 60,
31
+ 61,
32
+ 62,
33
+ 64,
34
+ 65,
35
+ 67,
36
+ 68,
37
+ 69,
38
+ 73,
39
+ 74,
40
+ 75,
41
+ 76,
42
+ 77,
43
+ 85,
44
+ 88,
45
+ 90,
46
+ 96,
47
+ 97,
48
+ 98,
49
+ 99,
50
+ 100,
51
+ 102,
52
+ 104,
53
+ 107,
54
+ 112,
55
+ 118,
56
+ 121,
57
+ 124,
58
+ 125,
59
+ 127,
60
+ 130,
61
+ 132,
62
+ 133,
63
+ 134,
64
+ 137
65
+ ],
66
+ "drop_indices": [
67
+ 0,
68
+ 1,
69
+ 3,
70
+ 4,
71
+ 7,
72
+ 9,
73
+ 11,
74
+ 12,
75
+ 14,
76
+ 15,
77
+ 16,
78
+ 17,
79
+ 18,
80
+ 19,
81
+ 20,
82
+ 21,
83
+ 22,
84
+ 25,
85
+ 26,
86
+ 27,
87
+ 28,
88
+ 29,
89
+ 36,
90
+ 37,
91
+ 38,
92
+ 39,
93
+ 40,
94
+ 43,
95
+ 44,
96
+ 47,
97
+ 48,
98
+ 49,
99
+ 50,
100
+ 51,
101
+ 55,
102
+ 56,
103
+ 58,
104
+ 63,
105
+ 66,
106
+ 70,
107
+ 71,
108
+ 72,
109
+ 78,
110
+ 79,
111
+ 80,
112
+ 81,
113
+ 82,
114
+ 83,
115
+ 84,
116
+ 86,
117
+ 87,
118
+ 89,
119
+ 91,
120
+ 92,
121
+ 93,
122
+ 94,
123
+ 95,
124
+ 101,
125
+ 103,
126
+ 105,
127
+ 106,
128
+ 108,
129
+ 109,
130
+ 110,
131
+ 111,
132
+ 113,
133
+ 114,
134
+ 115,
135
+ 116,
136
+ 117,
137
+ 119,
138
+ 120,
139
+ 122,
140
+ 123,
141
+ 126,
142
+ 128,
143
+ 129,
144
+ 131,
145
+ 135,
146
+ 136
147
+ ],
148
+ "mapping": {
149
+ "acidic": {
150
+ "index": 0,
151
+ "status": "drop"
152
+ },
153
+ "alcoholic": {
154
+ "index": 1,
155
+ "status": "drop_auto"
156
+ },
157
+ "aldehydic": {
158
+ "index": 2,
159
+ "status": "keep"
160
+ },
161
+ "alliaceous": {
162
+ "index": 3,
163
+ "status": "drop"
164
+ },
165
+ "almond": {
166
+ "index": 4,
167
+ "status": "drop"
168
+ },
169
+ "amber": {
170
+ "index": 5,
171
+ "status": "keep"
172
+ },
173
+ "animal": {
174
+ "index": 6,
175
+ "status": "keep"
176
+ },
177
+ "anisic": {
178
+ "index": 7,
179
+ "status": "drop_auto"
180
+ },
181
+ "apple": {
182
+ "index": 8,
183
+ "status": "keep"
184
+ },
185
+ "apricot": {
186
+ "index": 9,
187
+ "status": "drop_auto"
188
+ },
189
+ "balsamic": {
190
+ "index": 10,
191
+ "status": "keep"
192
+ },
193
+ "banana": {
194
+ "index": 11,
195
+ "status": "drop"
196
+ },
197
+ "beefy": {
198
+ "index": 12,
199
+ "status": "drop"
200
+ },
201
+ "berry": {
202
+ "index": 13,
203
+ "status": "keep"
204
+ },
205
+ "bland": {
206
+ "index": 14,
207
+ "status": "drop"
208
+ },
209
+ "brandy": {
210
+ "index": 15,
211
+ "status": "drop"
212
+ },
213
+ "bready": {
214
+ "index": 16,
215
+ "status": "drop"
216
+ },
217
+ "brothy": {
218
+ "index": 17,
219
+ "status": "drop"
220
+ },
221
+ "brown": {
222
+ "index": 18,
223
+ "status": "drop"
224
+ },
225
+ "burnt": {
226
+ "index": 19,
227
+ "status": "drop"
228
+ },
229
+ "buttery": {
230
+ "index": 20,
231
+ "status": "drop"
232
+ },
233
+ "cabbage": {
234
+ "index": 21,
235
+ "status": "drop"
236
+ },
237
+ "camphoreous": {
238
+ "index": 22,
239
+ "status": "drop"
240
+ },
241
+ "caramellic": {
242
+ "index": 23,
243
+ "status": "keep"
244
+ },
245
+ "cedar": {
246
+ "index": 24,
247
+ "status": "keep"
248
+ },
249
+ "celery": {
250
+ "index": 25,
251
+ "status": "drop"
252
+ },
253
+ "chamomile": {
254
+ "index": 26,
255
+ "status": "drop"
256
+ },
257
+ "cheesy": {
258
+ "index": 27,
259
+ "status": "drop"
260
+ },
261
+ "cherry": {
262
+ "index": 28,
263
+ "status": "drop"
264
+ },
265
+ "chicken": {
266
+ "index": 29,
267
+ "status": "drop"
268
+ },
269
+ "chocolate": {
270
+ "index": 30,
271
+ "status": "keep"
272
+ },
273
+ "cinnamon": {
274
+ "index": 31,
275
+ "status": "keep"
276
+ },
277
+ "citrus": {
278
+ "index": 32,
279
+ "status": "keep"
280
+ },
281
+ "clean": {
282
+ "index": 33,
283
+ "status": "keep"
284
+ },
285
+ "cocoa": {
286
+ "index": 34,
287
+ "status": "keep"
288
+ },
289
+ "coconut": {
290
+ "index": 35,
291
+ "status": "keep"
292
+ },
293
+ "coffee": {
294
+ "index": 36,
295
+ "status": "drop_auto"
296
+ },
297
+ "cognac": {
298
+ "index": 37,
299
+ "status": "drop"
300
+ },
301
+ "cooked": {
302
+ "index": 38,
303
+ "status": "drop"
304
+ },
305
+ "cooling": {
306
+ "index": 39,
307
+ "status": "drop_auto"
308
+ },
309
+ "cortex": {
310
+ "index": 40,
311
+ "status": "drop"
312
+ },
313
+ "coumarinic": {
314
+ "index": 41,
315
+ "status": "keep"
316
+ },
317
+ "creamy": {
318
+ "index": 42,
319
+ "status": "keep"
320
+ },
321
+ "cucumber": {
322
+ "index": 43,
323
+ "status": "drop"
324
+ },
325
+ "dairy": {
326
+ "index": 44,
327
+ "status": "drop"
328
+ },
329
+ "dry": {
330
+ "index": 45,
331
+ "status": "keep"
332
+ },
333
+ "earthy": {
334
+ "index": 46,
335
+ "status": "keep"
336
+ },
337
+ "estery": {
338
+ "index": 47,
339
+ "status": "drop"
340
+ },
341
+ "ethereal": {
342
+ "index": 48,
343
+ "status": "drop"
344
+ },
345
+ "fatty": {
346
+ "index": 49,
347
+ "status": "drop"
348
+ },
349
+ "fermented": {
350
+ "index": 50,
351
+ "status": "drop"
352
+ },
353
+ "fishy": {
354
+ "index": 51,
355
+ "status": "drop"
356
+ },
357
+ "floral": {
358
+ "index": 52,
359
+ "status": "keep"
360
+ },
361
+ "fresh": {
362
+ "index": 53,
363
+ "status": "keep"
364
+ },
365
+ "fruity": {
366
+ "index": 54,
367
+ "status": "keep"
368
+ },
369
+ "garlic": {
370
+ "index": 55,
371
+ "status": "drop"
372
+ },
373
+ "gasoline": {
374
+ "index": 56,
375
+ "status": "drop"
376
+ },
377
+ "geranium": {
378
+ "index": 57,
379
+ "status": "keep"
380
+ },
381
+ "grape": {
382
+ "index": 58,
383
+ "status": "drop"
384
+ },
385
+ "grapefruit": {
386
+ "index": 59,
387
+ "status": "keep"
388
+ },
389
+ "grassy": {
390
+ "index": 60,
391
+ "status": "keep"
392
+ },
393
+ "green": {
394
+ "index": 61,
395
+ "status": "keep"
396
+ },
397
+ "hay": {
398
+ "index": 62,
399
+ "status": "keep"
400
+ },
401
+ "hazelnut": {
402
+ "index": 63,
403
+ "status": "drop"
404
+ },
405
+ "herbal": {
406
+ "index": 64,
407
+ "status": "keep"
408
+ },
409
+ "honey": {
410
+ "index": 65,
411
+ "status": "keep"
412
+ },
413
+ "horseradish": {
414
+ "index": 66,
415
+ "status": "drop"
416
+ },
417
+ "hyacinth": {
418
+ "index": 67,
419
+ "status": "keep"
420
+ },
421
+ "jasmin": {
422
+ "index": 68,
423
+ "status": "keep"
424
+ },
425
+ "jasmine": {
426
+ "index": 69,
427
+ "status": "keep"
428
+ },
429
+ "juicy": {
430
+ "index": 70,
431
+ "status": "drop"
432
+ },
433
+ "ketonic": {
434
+ "index": 71,
435
+ "status": "drop"
436
+ },
437
+ "lactonic": {
438
+ "index": 72,
439
+ "status": "drop"
440
+ },
441
+ "lavender": {
442
+ "index": 73,
443
+ "status": "keep"
444
+ },
445
+ "leafy": {
446
+ "index": 74,
447
+ "status": "keep"
448
+ },
449
+ "leathery": {
450
+ "index": 75,
451
+ "status": "keep"
452
+ },
453
+ "lemon": {
454
+ "index": 76,
455
+ "status": "keep"
456
+ },
457
+ "lily": {
458
+ "index": 77,
459
+ "status": "keep"
460
+ },
461
+ "malty": {
462
+ "index": 78,
463
+ "status": "drop"
464
+ },
465
+ "meaty": {
466
+ "index": 79,
467
+ "status": "drop"
468
+ },
469
+ "medicinal": {
470
+ "index": 80,
471
+ "status": "drop"
472
+ },
473
+ "melon": {
474
+ "index": 81,
475
+ "status": "drop"
476
+ },
477
+ "mentholic": {
478
+ "index": 82,
479
+ "status": "drop"
480
+ },
481
+ "metallic": {
482
+ "index": 83,
483
+ "status": "drop"
484
+ },
485
+ "mild": {
486
+ "index": 84,
487
+ "status": "drop"
488
+ },
489
+ "milky": {
490
+ "index": 85,
491
+ "status": "keep"
492
+ },
493
+ "mint": {
494
+ "index": 86,
495
+ "status": "drop"
496
+ },
497
+ "minty": {
498
+ "index": 87,
499
+ "status": "drop"
500
+ },
501
+ "muguet": {
502
+ "index": 88,
503
+ "status": "keep"
504
+ },
505
+ "mushroom": {
506
+ "index": 89,
507
+ "status": "drop"
508
+ },
509
+ "musk": {
510
+ "index": 90,
511
+ "status": "keep"
512
+ },
513
+ "musty": {
514
+ "index": 91,
515
+ "status": "drop"
516
+ },
517
+ "nutty": {
518
+ "index": 92,
519
+ "status": "drop"
520
+ },
521
+ "odorless": {
522
+ "index": 93,
523
+ "status": "drop"
524
+ },
525
+ "oily": {
526
+ "index": 94,
527
+ "status": "drop_auto"
528
+ },
529
+ "onion": {
530
+ "index": 95,
531
+ "status": "drop"
532
+ },
533
+ "orange": {
534
+ "index": 96,
535
+ "status": "keep"
536
+ },
537
+ "orris": {
538
+ "index": 97,
539
+ "status": "keep"
540
+ },
541
+ "ozone": {
542
+ "index": 98,
543
+ "status": "keep"
544
+ },
545
+ "peach": {
546
+ "index": 99,
547
+ "status": "keep"
548
+ },
549
+ "pear": {
550
+ "index": 100,
551
+ "status": "keep"
552
+ },
553
+ "phenolic": {
554
+ "index": 101,
555
+ "status": "drop"
556
+ },
557
+ "pine": {
558
+ "index": 102,
559
+ "status": "keep"
560
+ },
561
+ "pineapple": {
562
+ "index": 103,
563
+ "status": "drop"
564
+ },
565
+ "plum": {
566
+ "index": 104,
567
+ "status": "keep"
568
+ },
569
+ "popcorn": {
570
+ "index": 105,
571
+ "status": "drop"
572
+ },
573
+ "potato": {
574
+ "index": 106,
575
+ "status": "drop"
576
+ },
577
+ "powdery": {
578
+ "index": 107,
579
+ "status": "keep"
580
+ },
581
+ "radish": {
582
+ "index": 108,
583
+ "status": "drop"
584
+ },
585
+ "raspberry": {
586
+ "index": 109,
587
+ "status": "drop"
588
+ },
589
+ "ripe": {
590
+ "index": 110,
591
+ "status": "drop"
592
+ },
593
+ "roasted": {
594
+ "index": 111,
595
+ "status": "drop"
596
+ },
597
+ "rose": {
598
+ "index": 112,
599
+ "status": "keep"
600
+ },
601
+ "rum": {
602
+ "index": 113,
603
+ "status": "drop"
604
+ },
605
+ "rummy": {
606
+ "index": 114,
607
+ "status": "drop"
608
+ },
609
+ "savory": {
610
+ "index": 115,
611
+ "status": "drop_auto"
612
+ },
613
+ "sharp": {
614
+ "index": 116,
615
+ "status": "drop"
616
+ },
617
+ "smoky": {
618
+ "index": 117,
619
+ "status": "drop_auto"
620
+ },
621
+ "soapy": {
622
+ "index": 118,
623
+ "status": "keep"
624
+ },
625
+ "solvent": {
626
+ "index": 119,
627
+ "status": "drop"
628
+ },
629
+ "sour": {
630
+ "index": 120,
631
+ "status": "drop"
632
+ },
633
+ "spicy": {
634
+ "index": 121,
635
+ "status": "keep"
636
+ },
637
+ "strawberry": {
638
+ "index": 122,
639
+ "status": "drop"
640
+ },
641
+ "sulfurous": {
642
+ "index": 123,
643
+ "status": "drop"
644
+ },
645
+ "sweet": {
646
+ "index": 124,
647
+ "status": "keep"
648
+ },
649
+ "tea": {
650
+ "index": 125,
651
+ "status": "keep"
652
+ },
653
+ "terpenic": {
654
+ "index": 126,
655
+ "status": "drop"
656
+ },
657
+ "tobacco": {
658
+ "index": 127,
659
+ "status": "keep"
660
+ },
661
+ "tomato": {
662
+ "index": 128,
663
+ "status": "drop"
664
+ },
665
+ "tropical": {
666
+ "index": 129,
667
+ "status": "drop"
668
+ },
669
+ "vanilla": {
670
+ "index": 130,
671
+ "status": "keep"
672
+ },
673
+ "vegetable": {
674
+ "index": 131,
675
+ "status": "drop"
676
+ },
677
+ "violet": {
678
+ "index": 132,
679
+ "status": "keep"
680
+ },
681
+ "warm": {
682
+ "index": 133,
683
+ "status": "keep"
684
+ },
685
+ "waxy": {
686
+ "index": 134,
687
+ "status": "keep"
688
+ },
689
+ "weedy": {
690
+ "index": 135,
691
+ "status": "drop"
692
+ },
693
+ "winey": {
694
+ "index": 136,
695
+ "status": "drop"
696
+ },
697
+ "woody": {
698
+ "index": 137,
699
+ "status": "keep"
700
+ }
701
+ }
702
+ }
data/adversarial_brief.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Adversarial Heavy Musk Test",
3
+ "brief": "winter amber masculine heavy musk",
4
+ "max_iterations": 50,
5
+ "palette_size": 20,
6
+ "allow_synthetic": true
7
+ }
data/incremental_feedback.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"formula_id": "sim_001", "rating": null, "notes": "Masculine tilt, boost woody descriptor.", "axis_scores": {}, "correct_gender": 0.7, "correct_notes": {"42": 0.85}}
data/ingredient_master_matrix_v3.json ADDED
The diff for this file is too large to render. See raw diff
 
data/odor_descriptor_vocab.json ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "resin",
3
+ "eugenol",
4
+ "rose",
5
+ "ionone",
6
+ "musk",
7
+ "sweet",
8
+ "jasmin",
9
+ "geraniol",
10
+ "bergamot",
11
+ "ylang",
12
+ "balsam",
13
+ "orange",
14
+ "linalol",
15
+ "heliotropin",
16
+ "linalyl",
17
+ "benzoin",
18
+ "geranyl",
19
+ "civet",
20
+ "anisic",
21
+ "dimethyl",
22
+ "terpineol",
23
+ "vanillin",
24
+ "phenylacetate",
25
+ "decyl",
26
+ "coumarin",
27
+ "petitgrain",
28
+ "citronellal",
29
+ "orris",
30
+ "styrax",
31
+ "nerol",
32
+ "taste",
33
+ "material",
34
+ "laurinic",
35
+ "java",
36
+ "nonyl",
37
+ "use",
38
+ "fruity",
39
+ "french",
40
+ "santal",
41
+ "rhodinol",
42
+ "tuberose",
43
+ "vetivert",
44
+ "flower",
45
+ "ambrette",
46
+ "clove",
47
+ "tolu",
48
+ "carbonate",
49
+ "acetal",
50
+ "paracresyl",
51
+ "for",
52
+ "peru",
53
+ "seed",
54
+ "acet",
55
+ "citronellol",
56
+ "palmarosa",
57
+ "suggested",
58
+ "naphthyl",
59
+ "neroly",
60
+ "rosewood",
61
+ "cassie",
62
+ "title",
63
+ "glycidate",
64
+ "undecalactone",
65
+ "octyl",
66
+ "acetaldehyde",
67
+ "patchouli",
68
+ "used",
69
+ "guaiac",
70
+ "wood",
71
+ "jonquille",
72
+ "citral",
73
+ "cyclamen",
74
+ "labdanum",
75
+ "heptine",
76
+ "geranium",
77
+ "clary",
78
+ "sage",
79
+ "violet",
80
+ "citronellyl",
81
+ "oakmoss",
82
+ "undecylic",
83
+ "acetophenone",
84
+ "indole",
85
+ "lemon",
86
+ "tenacity",
87
+ "bitter",
88
+ "anisol",
89
+ "leaf",
90
+ "costus",
91
+ "benzaldehyde",
92
+ "olibanum",
93
+ "rhodinyl",
94
+ "neroli",
95
+ "flavor",
96
+ "perfume",
97
+ "compositions",
98
+ "oily",
99
+ "floral",
100
+ "extreme",
101
+ "mace",
102
+ "cardamon",
103
+ "mimosa",
104
+ "octine",
105
+ "tonka",
106
+ "lavender",
107
+ "benzophenone",
108
+ "castoreum",
109
+ "ndecalactone",
110
+ "esters",
111
+ "narcissus",
112
+ "verbena",
113
+ "diphenyl",
114
+ "cassia",
115
+ "commercial",
116
+ "pleasant",
117
+ "acetyl",
118
+ "application",
119
+ "anisate",
120
+ "finds",
121
+ "herbaceous",
122
+ "good",
123
+ "ambergris",
124
+ "quinone",
125
+ "grasse",
126
+ "hydro",
127
+ "myrrh",
128
+ "coriander",
129
+ "example",
130
+ "galbanum",
131
+ "opoponax",
132
+ "neryl",
133
+ "lonone",
134
+ "benzylidene",
135
+ "acetone",
136
+ "xylene",
137
+ "cananga",
138
+ "useful",
139
+ "moderate"
140
+ ]
data/perfumer_tier_aliases.json ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "PubChem SMILES-to-CAS synonym resolution; tier is inherited only when the resolved CAS is already present in perfumer_tier_lookup inputs.",
3
+ "aliases": {
4
+ "SMILES:CCc1cc2c(cc1C(C)=O)C(C)(C)CCC2(C)C": {
5
+ "source_cas": "88-29-9",
6
+ "pubchem_cid": 6930,
7
+ "pubchem_name": "Versalide"
8
+ },
9
+ "SMILES:CC(=O)OCC(COC(C)=O)OC(C)=O": {
10
+ "source_cas": "102-76-1",
11
+ "pubchem_cid": 5541,
12
+ "pubchem_name": "triacetin"
13
+ },
14
+ "SMILES:COC(=O)CCC(=O)OC": {
15
+ "source_cas": "106-65-0",
16
+ "pubchem_cid": 7820,
17
+ "pubchem_name": "DIMETHYL SUCCINATE"
18
+ },
19
+ "SMILES:CC(=O)OC(C)(C)C1CCC(C)CC1": {
20
+ "source_cas": "58985-18-5",
21
+ "pubchem_cid": 6631,
22
+ "pubchem_name": "Dihydroterpinyl acetate"
23
+ },
24
+ "SMILES:CC1=CCC2CC1C2(C)C": {
25
+ "source_cas": "80-56-8",
26
+ "pubchem_cid": 6654,
27
+ "pubchem_name": "ALPHA-PINENE"
28
+ },
29
+ "SMILES:COc1ccc(C)cc1": {
30
+ "source_cas": "104-93-8",
31
+ "pubchem_cid": 7731,
32
+ "pubchem_name": "4-Methylanisole"
33
+ },
34
+ "SMILES:C=CCc1ccc(OC(C)=O)c(OC)c1": {
35
+ "source_cas": "93-28-7",
36
+ "pubchem_cid": 7136,
37
+ "pubchem_name": "Eugenol acetate"
38
+ },
39
+ "SMILES:CCCCOC(=O)CC(CC(=O)OCCCC)(OC(C)=O)C(=O)OCCCC": {
40
+ "source_cas": "77-90-7",
41
+ "pubchem_cid": 6505,
42
+ "pubchem_name": "ACETYL TRIBUTYL CITRATE"
43
+ },
44
+ "SMILES:CCCCCC#CC(=O)OC": {
45
+ "source_cas": "111-12-6",
46
+ "pubchem_cid": 8092,
47
+ "pubchem_name": "Methyl 2-octynoate"
48
+ },
49
+ "SMILES:CC=Cc1ccc(OC)c(OC)c1": {
50
+ "source_cas": "93-16-3",
51
+ "pubchem_cid": 7128,
52
+ "pubchem_name": "Methyl isoeugenol"
53
+ },
54
+ "SMILES:CC(C)C(=O)O": {
55
+ "source_cas": "79-31-2",
56
+ "pubchem_cid": 6590,
57
+ "pubchem_name": "ISOBUTYRIC ACID"
58
+ },
59
+ "SMILES:Cc1cncc(C)n1": {
60
+ "source_cas": "108-50-9",
61
+ "pubchem_cid": 7938,
62
+ "pubchem_name": "2,6-DIMETHYLPYRAZINE"
63
+ },
64
+ "SMILES:C=CC(C)(CCC=C(C)C)OC(=O)C(C)C": {
65
+ "source_cas": "78-35-3",
66
+ "pubchem_cid": 6532,
67
+ "pubchem_name": "Linalyl isobutyrate"
68
+ },
69
+ "SMILES:CC(CC=O)CCCC(C)(C)O": {
70
+ "source_cas": "107-75-5",
71
+ "pubchem_cid": 7888,
72
+ "pubchem_name": "Hydroxycitronellal"
73
+ },
74
+ "SMILES:CC(C)=CCC[C@H](C)CCO": {
75
+ "source_cas": "7540-51-4",
76
+ "pubchem_cid": 7793,
77
+ "pubchem_name": "l-Citronellol"
78
+ },
79
+ "SMILES:CCCCCCC#CC(=O)OC": {
80
+ "source_cas": "111-80-8",
81
+ "pubchem_cid": 8137,
82
+ "pubchem_name": "Methyl 2-nonynoate"
83
+ },
84
+ "SMILES:CC(=O)C(C)=O": {
85
+ "source_cas": "431-03-8",
86
+ "pubchem_cid": 650,
87
+ "pubchem_name": "2,3-butanedione"
88
+ },
89
+ "SMILES:CCCCCCCCCC(=O)O": {
90
+ "source_cas": "334-48-5",
91
+ "pubchem_cid": 2969,
92
+ "pubchem_name": "Decanoic acid"
93
+ },
94
+ "SMILES:CSC": {
95
+ "source_cas": "75-18-3",
96
+ "pubchem_cid": 1068,
97
+ "pubchem_name": "dimethyl sulfide"
98
+ },
99
+ "SMILES:CC(C)(O)C(C)(C)O": {
100
+ "source_cas": "76-09-5",
101
+ "pubchem_cid": 6425,
102
+ "pubchem_name": "PINACOL"
103
+ },
104
+ "SMILES:CCCCCCCOC=O": {
105
+ "source_cas": "112-23-2",
106
+ "pubchem_cid": 8169,
107
+ "pubchem_name": "Heptyl formate"
108
+ },
109
+ "SMILES:CCCCCCCCCCCC(=O)OC": {
110
+ "source_cas": "111-82-0",
111
+ "pubchem_cid": 8139,
112
+ "pubchem_name": "Methyl laurate"
113
+ },
114
+ "SMILES:CC(C)=CCCC(C)CC=O": {
115
+ "source_cas": "106-23-0",
116
+ "pubchem_cid": 7794,
117
+ "pubchem_name": "CITRONELLAL"
118
+ },
119
+ "SMILES:CC(=O)c1ccccc1": {
120
+ "source_cas": "98-86-2",
121
+ "pubchem_cid": 7410,
122
+ "pubchem_name": "ACETOPHENONE"
123
+ },
124
+ "SMILES:CCCCCCCCCC(C)=O": {
125
+ "source_cas": "112-12-9",
126
+ "pubchem_cid": 8163,
127
+ "pubchem_name": "2-Undecanone"
128
+ },
129
+ "SMILES:CC(=O)c1ccc(C)cc1C": {
130
+ "source_cas": "89-74-7",
131
+ "pubchem_cid": 6985,
132
+ "pubchem_name": "2,4-Dimethylacetophenone"
133
+ },
134
+ "SMILES:CC(=O)c1ccc(Cl)cc1": {
135
+ "source_cas": "99-91-2",
136
+ "pubchem_cid": 7467,
137
+ "pubchem_name": "4'-Chloroacetophenone"
138
+ },
139
+ "SMILES:COC(=O)Cc1ccccc1": {
140
+ "source_cas": "101-41-7",
141
+ "pubchem_cid": 7559,
142
+ "pubchem_name": "METHYL PHENYLACETATE"
143
+ }
144
+ }
145
+ }
data/perfumer_tier_lookup.json CHANGED
@@ -1,14 +1,15 @@
1
  {
2
- "unique_cas": 1323,
3
  "tier_distribution": {
4
- "base": 388,
5
- "top": 289,
6
- "mid": 646
7
  },
8
  "sources": {
9
  "poucher": 160,
10
  "goodscents_prose": 96,
11
- "goodscents_substantivity": 1067
 
12
  },
13
  "cas_to_tier": {
14
  "100-06-1": "base",
@@ -1333,6 +1334,34 @@
1333
  "99-91-2": "mid",
1334
  "99-93-4": "base",
1335
  "99-96-7": "mid",
1336
- "996-97-4": "mid"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1337
  }
1338
  }
 
1
  {
2
+ "unique_cas": 1351,
3
  "tier_distribution": {
4
+ "base": 395,
5
+ "top": 296,
6
+ "mid": 660
7
  },
8
  "sources": {
9
  "poucher": 160,
10
  "goodscents_prose": 96,
11
+ "goodscents_substantivity": 1067,
12
+ "pubchem_cas_alias": 28
13
  },
14
  "cas_to_tier": {
15
  "100-06-1": "base",
 
1334
  "99-91-2": "mid",
1335
  "99-93-4": "base",
1336
  "99-96-7": "mid",
1337
+ "996-97-4": "mid",
1338
+ "SMILES:C=CC(C)(CCC=C(C)C)OC(=O)C(C)C": "top",
1339
+ "SMILES:C=CCc1ccc(OC(C)=O)c(OC)c1": "base",
1340
+ "SMILES:CC(=O)C(C)=O": "mid",
1341
+ "SMILES:CC(=O)OC(C)(C)C1CCC(C)CC1": "top",
1342
+ "SMILES:CC(=O)OCC(COC(C)=O)OC(C)=O": "mid",
1343
+ "SMILES:CC(=O)c1ccc(C)cc1C": "base",
1344
+ "SMILES:CC(=O)c1ccc(Cl)cc1": "mid",
1345
+ "SMILES:CC(=O)c1ccccc1": "base",
1346
+ "SMILES:CC(C)(O)C(C)(C)O": "base",
1347
+ "SMILES:CC(C)=CCCC(C)CC=O": "mid",
1348
+ "SMILES:CC(C)=CCC[C@H](C)CCO": "mid",
1349
+ "SMILES:CC(C)C(=O)O": "top",
1350
+ "SMILES:CC(CC=O)CCCC(C)(C)O": "mid",
1351
+ "SMILES:CC1=CCC2CC1C2(C)C": "top",
1352
+ "SMILES:CC=Cc1ccc(OC)c(OC)c1": "mid",
1353
+ "SMILES:CCCCCC#CC(=O)OC": "mid",
1354
+ "SMILES:CCCCCCC#CC(=O)OC": "mid",
1355
+ "SMILES:CCCCCCCCCC(=O)O": "base",
1356
+ "SMILES:CCCCCCCCCC(C)=O": "mid",
1357
+ "SMILES:CCCCCCCCCCCC(=O)OC": "base",
1358
+ "SMILES:CCCCCCCOC=O": "top",
1359
+ "SMILES:CCCCOC(=O)CC(CC(=O)OCCCC)(OC(C)=O)C(=O)OCCCC": "mid",
1360
+ "SMILES:CCc1cc2c(cc1C(C)=O)C(C)(C)CCC2(C)C": "base",
1361
+ "SMILES:COC(=O)CCC(=O)OC": "top",
1362
+ "SMILES:COC(=O)Cc1ccccc1": "mid",
1363
+ "SMILES:COc1ccc(C)cc1": "mid",
1364
+ "SMILES:CSC": "top",
1365
+ "SMILES:Cc1cncc(C)n1": "mid"
1366
  }
1367
  }
scripts/generate_targets_v3.py CHANGED
@@ -13,11 +13,14 @@ from __future__ import annotations
13
  import argparse
14
  import json
15
  import re
 
16
  from pathlib import Path
17
  from typing import Any
18
 
19
  import numpy as np
20
 
 
 
21
  DESCRIPTOR_DIM = 138
22
 
23
  # Tier 3 hard volatility categories in the Pyrfume vocabulary.
@@ -1596,6 +1599,48 @@ def normalize_cas(cas: str) -> str:
1596
  return cas
1597
 
1598
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1599
  def load_vocabulary(path: Path) -> list[str]:
1600
  data = json.loads(path.read_text())
1601
  vocab = data["vocabulary"] if isinstance(data, dict) else data
@@ -1614,6 +1659,19 @@ def build_tier3_vectors(vocab: list[str]) -> tuple[np.ndarray, np.ndarray, np.nd
1614
  return _vec(TOP_TOKENS), _vec(HEART_TOKENS), _vec(BASE_TOKENS)
1615
 
1616
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1617
  def tokenize_text(text: str) -> list[str]:
1618
  """Lowercase and split into alpha tokens."""
1619
  text = text.lower()
@@ -1679,9 +1737,12 @@ def build_master_matrix(
1679
  vocab: list[str],
1680
  pyrfume_path: Path,
1681
  registry_path: Path,
 
1682
  ) -> dict[str, np.ndarray]:
1683
  """Compile the (CAS -> 138-D) ingredient descriptor matrix."""
1684
  top_vec, heart_vec, base_vec = build_tier3_vectors(vocab)
 
 
1685
 
1686
  # Tier 1: Pyrfume exact 138-D vectors.
1687
  pyrfume = json.loads(pyrfume_path.read_text())
@@ -1717,6 +1778,22 @@ def build_master_matrix(
1717
  else:
1718
  matrix[cas] = heart_vec
1719
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1720
  return matrix
1721
 
1722
 
@@ -1758,6 +1835,7 @@ def main() -> None:
1758
  parser.add_argument("--vocab", default="data/pyrfume_vocabulary.json")
1759
  parser.add_argument("--pyrfume", default="data/pyrfume_descriptors_by_cas.json")
1760
  parser.add_argument("--registry", default="data/aroma_chemicals.jsonl")
 
1761
  parser.add_argument("--matrix-out", default="data/ingredient_master_matrix_v3.json")
1762
  args = parser.parse_args()
1763
 
@@ -1768,6 +1846,7 @@ def main() -> None:
1768
  vocab,
1769
  Path(args.pyrfume),
1770
  Path(args.registry),
 
1771
  )
1772
  print(f"Compiled ingredient master matrix: {len(matrix)} CAS")
1773
 
@@ -1783,12 +1862,31 @@ def main() -> None:
1783
  for line in f:
1784
  rec = json.loads(line)
1785
  registry[rec["cas"]] = rec
 
 
1786
 
1787
  with Path(args.matrix_out).parent.joinpath("matrix_coverage_v3.json").open("w") as f:
1788
  json.dump({
1789
  "tier1_count": len(tier1),
1790
  "tier2_count": sum(1 for cas, rec in registry.items() if cas not in tier1 and rec.get("odor_description")),
1791
- "tier3_count": sum(1 for cas in matrix if cas not in tier1 and not registry.get(cas, {}).get("odor_description")),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1792
  "total": len(matrix),
1793
  }, f, indent=2)
1794
 
@@ -1796,7 +1894,15 @@ def main() -> None:
1796
  input_path = Path(args.input)
1797
  output_path = Path(args.output)
1798
  out_file = output_path.open("w")
1799
- stats = {"tier1": 0, "tier2": 0, "tier3": 0, "missing": 0, "records": 0}
 
 
 
 
 
 
 
 
1800
 
1801
  with input_path.open() as f:
1802
  for line in f:
@@ -1817,6 +1923,12 @@ def main() -> None:
1817
  elif cas in registry and registry[cas].get("odor_description"):
1818
  tier = "tier2"
1819
  stats["tier2"] += 1
 
 
 
 
 
 
1820
  elif cas in matrix:
1821
  tier = "tier3"
1822
  stats["tier3"] += 1
@@ -1835,12 +1947,23 @@ def main() -> None:
1835
 
1836
  print(f"Wrote {stats['records']} records to {output_path}")
1837
  print(f"Ingredient tier counts: {stats}")
 
 
 
 
 
 
 
 
 
1838
  print(
1839
  "Tier fractions: "
1840
- f"tier1={stats['tier1'] / max(stats['tier1'] + stats['tier2'] + stats['tier3'] + stats['missing'], 1):.3f}, "
1841
- f"tier2={stats['tier2'] / max(stats['tier1'] + stats['tier2'] + stats['tier3'] + stats['missing'], 1):.3f}, "
1842
- f"tier3={stats['tier3'] / max(stats['tier1'] + stats['tier2'] + stats['tier3'] + stats['missing'], 1):.3f}, "
1843
- f"missing={stats['missing'] / max(stats['tier1'] + stats['tier2'] + stats['tier3'] + stats['missing'], 1):.3f}"
 
 
1844
  )
1845
 
1846
 
 
13
  import argparse
14
  import json
15
  import re
16
+ import sys
17
  from pathlib import Path
18
  from typing import Any
19
 
20
  import numpy as np
21
 
22
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
23
+
24
  DESCRIPTOR_DIM = 138
25
 
26
  # Tier 3 hard volatility categories in the Pyrfume vocabulary.
 
1599
  return cas
1600
 
1601
 
1602
+ def load_perfumer_tiers(path: Path) -> dict[str, str]:
1603
+ if not path.exists():
1604
+ return {}
1605
+ data = json.loads(path.read_text())
1606
+ raw = data.get("cas_to_tier", data)
1607
+ tiers: dict[str, str] = {}
1608
+ for cas, tier in raw.items():
1609
+ if tier == "middle":
1610
+ tier = "mid"
1611
+ if tier in {"top", "mid", "base"}:
1612
+ tiers[cas] = tier
1613
+ tiers[normalize_cas(cas)] = tier
1614
+ return tiers
1615
+
1616
+
1617
+ def load_alias_descriptions() -> dict[str, str]:
1618
+ descriptions: dict[str, list[str]] = {}
1619
+
1620
+ try:
1621
+ from pino.trade_name_resolver import TRADE_TO_CAS
1622
+ except Exception:
1623
+ TRADE_TO_CAS = {}
1624
+
1625
+ for name, cas in TRADE_TO_CAS.items():
1626
+ if cas:
1627
+ descriptions.setdefault(cas, []).append(name)
1628
+ descriptions.setdefault(normalize_cas(cas), []).append(name)
1629
+
1630
+ try:
1631
+ from pino.thermo.naturals import NATURAL_PROFILES
1632
+ except Exception:
1633
+ NATURAL_PROFILES = {}
1634
+
1635
+ for cas, profile in NATURAL_PROFILES.items():
1636
+ name = profile.get("name")
1637
+ if name:
1638
+ descriptions.setdefault(cas, []).append(name)
1639
+ descriptions.setdefault(normalize_cas(cas), []).append(name)
1640
+
1641
+ return {cas: " ".join(names) for cas, names in descriptions.items()}
1642
+
1643
+
1644
  def load_vocabulary(path: Path) -> list[str]:
1645
  data = json.loads(path.read_text())
1646
  vocab = data["vocabulary"] if isinstance(data, dict) else data
 
1659
  return _vec(TOP_TOKENS), _vec(HEART_TOKENS), _vec(BASE_TOKENS)
1660
 
1661
 
1662
+ def vector_for_perfumer_tier(
1663
+ tier: str,
1664
+ top_vec: np.ndarray,
1665
+ heart_vec: np.ndarray,
1666
+ base_vec: np.ndarray,
1667
+ ) -> np.ndarray:
1668
+ if tier == "top":
1669
+ return top_vec
1670
+ if tier == "base":
1671
+ return base_vec
1672
+ return heart_vec
1673
+
1674
+
1675
  def tokenize_text(text: str) -> list[str]:
1676
  """Lowercase and split into alpha tokens."""
1677
  text = text.lower()
 
1737
  vocab: list[str],
1738
  pyrfume_path: Path,
1739
  registry_path: Path,
1740
+ perfumer_tier_path: Path | None = None,
1741
  ) -> dict[str, np.ndarray]:
1742
  """Compile the (CAS -> 138-D) ingredient descriptor matrix."""
1743
  top_vec, heart_vec, base_vec = build_tier3_vectors(vocab)
1744
+ alias_descriptions = load_alias_descriptions()
1745
+ perfumer_tiers = load_perfumer_tiers(perfumer_tier_path) if perfumer_tier_path else {}
1746
 
1747
  # Tier 1: Pyrfume exact 138-D vectors.
1748
  pyrfume = json.loads(pyrfume_path.read_text())
 
1778
  else:
1779
  matrix[cas] = heart_vec
1780
 
1781
+ # Tier 4: material-name text from resolver/natural-profile aliases. These
1782
+ # cover literature-only naturals and trade materials absent from the registry.
1783
+ for cas, text in alias_descriptions.items():
1784
+ if cas in matrix:
1785
+ continue
1786
+ vec = description_to_vector(text, vocab)
1787
+ if vec.sum() > 0:
1788
+ matrix[cas] = vec
1789
+
1790
+ # Tier 5: curated perfumer top/mid/base labels for materials present in
1791
+ # literature formulas but missing from the aroma-chemical registry.
1792
+ for cas, tier in perfumer_tiers.items():
1793
+ if cas in matrix:
1794
+ continue
1795
+ matrix[cas] = vector_for_perfumer_tier(tier, top_vec, heart_vec, base_vec)
1796
+
1797
  return matrix
1798
 
1799
 
 
1835
  parser.add_argument("--vocab", default="data/pyrfume_vocabulary.json")
1836
  parser.add_argument("--pyrfume", default="data/pyrfume_descriptors_by_cas.json")
1837
  parser.add_argument("--registry", default="data/aroma_chemicals.jsonl")
1838
+ parser.add_argument("--perfumer-tiers", default="data/perfumer_tier_lookup.json")
1839
  parser.add_argument("--matrix-out", default="data/ingredient_master_matrix_v3.json")
1840
  args = parser.parse_args()
1841
 
 
1846
  vocab,
1847
  Path(args.pyrfume),
1848
  Path(args.registry),
1849
+ Path(args.perfumer_tiers),
1850
  )
1851
  print(f"Compiled ingredient master matrix: {len(matrix)} CAS")
1852
 
 
1862
  for line in f:
1863
  rec = json.loads(line)
1864
  registry[rec["cas"]] = rec
1865
+ alias_descriptions = load_alias_descriptions()
1866
+ perfumer_tiers = load_perfumer_tiers(Path(args.perfumer_tiers))
1867
 
1868
  with Path(args.matrix_out).parent.joinpath("matrix_coverage_v3.json").open("w") as f:
1869
  json.dump({
1870
  "tier1_count": len(tier1),
1871
  "tier2_count": sum(1 for cas, rec in registry.items() if cas not in tier1 and rec.get("odor_description")),
1872
+ "tier3_count": sum(
1873
+ 1 for cas in matrix
1874
+ if cas not in tier1
1875
+ and cas not in perfumer_tiers
1876
+ and cas not in alias_descriptions
1877
+ and not registry.get(cas, {}).get("odor_description")
1878
+ ),
1879
+ "alias_text_fallback_count": sum(
1880
+ 1 for cas in matrix
1881
+ if cas not in tier1 and cas not in registry and cas in alias_descriptions
1882
+ ),
1883
+ "perfumer_tier_fallback_count": sum(
1884
+ 1 for cas in matrix
1885
+ if cas not in tier1
1886
+ and cas not in registry
1887
+ and cas not in alias_descriptions
1888
+ and cas in perfumer_tiers
1889
+ ),
1890
  "total": len(matrix),
1891
  }, f, indent=2)
1892
 
 
1894
  input_path = Path(args.input)
1895
  output_path = Path(args.output)
1896
  out_file = output_path.open("w")
1897
+ stats = {
1898
+ "tier1": 0,
1899
+ "tier2": 0,
1900
+ "tier3": 0,
1901
+ "alias_text": 0,
1902
+ "perfumer_tier": 0,
1903
+ "missing": 0,
1904
+ "records": 0,
1905
+ }
1906
 
1907
  with input_path.open() as f:
1908
  for line in f:
 
1923
  elif cas in registry and registry[cas].get("odor_description"):
1924
  tier = "tier2"
1925
  stats["tier2"] += 1
1926
+ elif cas not in registry and cas in alias_descriptions and cas in matrix:
1927
+ tier = "alias_text"
1928
+ stats["alias_text"] += 1
1929
+ elif cas not in registry and cas in perfumer_tiers:
1930
+ tier = "perfumer_tier"
1931
+ stats["perfumer_tier"] += 1
1932
  elif cas in matrix:
1933
  tier = "tier3"
1934
  stats["tier3"] += 1
 
1947
 
1948
  print(f"Wrote {stats['records']} records to {output_path}")
1949
  print(f"Ingredient tier counts: {stats}")
1950
+ denom = max(
1951
+ stats["tier1"]
1952
+ + stats["tier2"]
1953
+ + stats["tier3"]
1954
+ + stats["alias_text"]
1955
+ + stats["perfumer_tier"]
1956
+ + stats["missing"],
1957
+ 1,
1958
+ )
1959
  print(
1960
  "Tier fractions: "
1961
+ f"tier1={stats['tier1'] / denom:.3f}, "
1962
+ f"tier2={stats['tier2'] / denom:.3f}, "
1963
+ f"tier3={stats['tier3'] / denom:.3f}, "
1964
+ f"alias_text={stats['alias_text'] / denom:.3f}, "
1965
+ f"perfumer_tier={stats['perfumer_tier'] / denom:.3f}, "
1966
+ f"missing={stats['missing'] / denom:.3f}"
1967
  )
1968
 
1969
 
scripts/merge_perfumer_tiers.py CHANGED
@@ -5,6 +5,7 @@ Precedence:
5
  1. Poucher Vol II (ground truth)
6
  2. GoodScents prose classification
7
  3. GoodScents substantivity threshold (fallback)
 
8
  """
9
  import json
10
  from collections import Counter
@@ -22,6 +23,12 @@ with open(DATA / "goodscents_tier_from_prose.json") as f:
22
  with open(DATA / "goodscents_substantivity_tiers.json") as f:
23
  subst = json.load(f).get("cas_to_tier", {})
24
 
 
 
 
 
 
 
25
  # Build merged lookup with precedence
26
  merged = {}
27
  for cas, tier in poucher.items():
@@ -35,13 +42,22 @@ for cas, tier in subst.items():
35
  if cas not in merged:
36
  merged[cas] = {"tier": tier, "source": "goodscents_substantivity"}
37
 
 
 
 
 
 
 
 
 
 
38
  # Write flat lookup for downstream compatibility
39
  flat = {cas: info["tier"] for cas, info in merged.items()}
40
  with open(DATA / "perfumer_tier_lookup.json", "w") as f:
41
  json.dump({
42
  "unique_cas": len(flat),
43
  "tier_distribution": dict(Counter(flat.values())),
44
- "sources": {src: sum(1 for i in merged.values() if i["source"] == src) for src in ["poucher", "goodscents_prose", "goodscents_substantivity"]},
45
  "cas_to_tier": {k: v for k, v in sorted(flat.items())},
46
  }, f, indent=2)
47
 
@@ -68,10 +84,16 @@ print("Tier distribution in dataset:")
68
  for t, c in Counter(flat[c] for c in covered).most_common():
69
  print(f" {t}: {c} ({c/len(covered):.1%})")
70
 
71
- # Validate vs Poucher
72
- from sklearn.metrics import cohen_kappa_score
 
 
 
 
73
  poucher_overlap = set(poucher.keys()) & covered
74
- if poucher_overlap:
75
  y_true = [poucher[c] for c in poucher_overlap]
76
  y_pred = [flat[c] for c in poucher_overlap]
77
  print(f"\nPoucher vs merged lookup (n={len(poucher_overlap)}): κ = {cohen_kappa_score(y_true, y_pred):.3f}")
 
 
 
5
  1. Poucher Vol II (ground truth)
6
  2. GoodScents prose classification
7
  3. GoodScents substantivity threshold (fallback)
8
+ 4. PubChem-resolved dataset key aliases to already-labeled CAS
9
  """
10
  import json
11
  from collections import Counter
 
23
  with open(DATA / "goodscents_substantivity_tiers.json") as f:
24
  subst = json.load(f).get("cas_to_tier", {})
25
 
26
+ alias_file = DATA / "perfumer_tier_aliases.json"
27
+ aliases = {}
28
+ if alias_file.exists():
29
+ with open(alias_file) as f:
30
+ aliases = json.load(f).get("aliases", {})
31
+
32
  # Build merged lookup with precedence
33
  merged = {}
34
  for cas, tier in poucher.items():
 
42
  if cas not in merged:
43
  merged[cas] = {"tier": tier, "source": "goodscents_substantivity"}
44
 
45
+ for alias_key, info in aliases.items():
46
+ source_key = info["source_cas"]
47
+ if alias_key not in merged and source_key in merged:
48
+ merged[alias_key] = {
49
+ "tier": merged[source_key]["tier"],
50
+ "source": "pubchem_cas_alias",
51
+ "source_cas": source_key,
52
+ }
53
+
54
  # Write flat lookup for downstream compatibility
55
  flat = {cas: info["tier"] for cas, info in merged.items()}
56
  with open(DATA / "perfumer_tier_lookup.json", "w") as f:
57
  json.dump({
58
  "unique_cas": len(flat),
59
  "tier_distribution": dict(Counter(flat.values())),
60
+ "sources": {src: sum(1 for i in merged.values() if i["source"] == src) for src in ["poucher", "goodscents_prose", "goodscents_substantivity", "pubchem_cas_alias"]},
61
  "cas_to_tier": {k: v for k, v in sorted(flat.items())},
62
  }, f, indent=2)
63
 
 
84
  for t, c in Counter(flat[c] for c in covered).most_common():
85
  print(f" {t}: {c} ({c/len(covered):.1%})")
86
 
87
+ # Validate vs Poucher when sklearn is available.
88
+ try:
89
+ from sklearn.metrics import cohen_kappa_score
90
+ except ModuleNotFoundError:
91
+ cohen_kappa_score = None
92
+
93
  poucher_overlap = set(poucher.keys()) & covered
94
+ if poucher_overlap and cohen_kappa_score is not None:
95
  y_true = [poucher[c] for c in poucher_overlap]
96
  y_pred = [flat[c] for c in poucher_overlap]
97
  print(f"\nPoucher vs merged lookup (n={len(poucher_overlap)}): κ = {cohen_kappa_score(y_true, y_pred):.3f}")
98
+ elif poucher_overlap:
99
+ print(f"\nPoucher vs merged lookup: skipped κ; sklearn is not installed (n={len(poucher_overlap)})")
uv.lock ADDED
The diff for this file is too large to render. See raw diff