Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- shared/package-files/00/0007dc4d06135a1f341557fa9125fb2528931f9152a4b824d7d92ace16bf7b8b/report-agg1.json +107 -0
- shared/package-files/00/00942e27fa6419d7b9b8c05fc7eec739b767b7ebebdaab0f9ad53b0c9bea3c21/scorelab-v7-B45a-51k-full.log +4 -0
- shared/package-files/00/00aa1989c8b3c8cfe4d5ec88a45823abae9a43e76885a951804217804c10cf49/inv-strata-N5.log +22 -0
- shared/package-files/00/00abce79b919b8cc4c7a57b3a73b76add18ba8d7700752242c88f76708b0eb6c/eval-score-N5-recur-merged-10-max.log +41 -0
- shared/package-files/02/02b499f2665372b2e76385beb8a177ea43a1e98d92972af11db2f74fba6f472e/train3.manifest.json +22 -0
- shared/package-files/02/02cd6da9cce20fbcc88e057aae69f214f441203f35af263bb3a39276b8f65bc1/README.md +794 -0
- shared/package-files/02/02e22165c14c18c26dc4e667df6b72ae05e25e8e6d03c40a6d57bd494cdcf7be/eval-B20k-full.log +46 -0
- shared/package-files/05/050a2c53b05a8dee5389304040637bfd0815ff592a19e11f4a34387feade887a/fwd_union.py +86 -0
- shared/package-files/05/054826ce4b15b2f623c7931654585b23a76b80659fa048be489141959a39d0f5/big-pools-B45a.log +23 -0
- shared/package-files/05/0559700ae3f45d2fe8f3939bf6cdea2e50d015c80c0d704eea6e263bf7b6232e/library_hybrid.py +113 -0
- shared/package-files/05/05ace3abf7b82dc643e601ef503a21d47da830b9ee4c344f308ac6edd44a9caa/swap-I16-w1.0_0.075_0.75.log +8 -0
- shared/package-files/10/10b9bb13011b8797a2f52fc1c8493a1d3b2ebb5b32488b4494fdf419aa017e0f/check_contrast.py +37 -0
- shared/package-files/10/10cedb5835d44c186a5e796f82087acb62bcfacfd2dbe67a761783ef82cba0e1/genstruct-x1-build.log +3 -0
- shared/package-files/10/10f5c955b4d85e710ebfc7ce8c0795dea9f50553a2ac0b293a47cdc47f638c89/replay-5Ms-N5u48-L-ion-net2-edge2.log +15 -0
- shared/package-files/11/11255895994cbd8d3d04ffdc163c6f8129fa67f150f0963c8d7447a7e75b83a0/netprop-released-sub-0_5-1.log +4 -0
- shared/package-files/11/11a153784e791a7d4efd6835e8e3c4963933d273502212259d71e6337e22ba85/replay-5Ms-I9b-L-edge.log +13 -0
- shared/package-files/11/11a2827f83849a0f01821e301ead5baa041c8c381d923948f2d062f242f1fffd/swap-N5-recur-hyb-s10-f5-p48-clip20-w1.0_0.5_0.5.log +12 -0
- shared/package-files/11/11f5e5e240b312c8bbea345aad8ff6903a5f2e017cd914ad48de8b6b08f8221c/recipe.json +160 -0
- shared/package-files/12/121122cc9f8338004770cf375b124e18081626a3ad4bf0001da96cb3869619ea/netprop-eval-m10t02.log +8 -0
- shared/package-files/12/121e7b127cf51cc7dfac79468d0c6a1f22b96ac5232abff278367a56fdd12317/swap-N5-recur-hyb-s10-f5-p48-w0.75_0.1_0.5.log +8 -0
- shared/package-files/12/1256343b32e8b9e5465ff9a2445a6ce93aaf9c45b37eb78f630f9ca13995fcc3/inv_swap.py +120 -0
- shared/package-files/12/126114bcdaa4ba1980c7d82acf8060756a3db8ec5920747dc10356d746ad6bf8/edge-released.log +9 -0
- shared/package-files/12/12640a7a4c6499714e0ada64ed2cd459e63edbcd16298b18ac3ea05a3df37b08/missed_pools.py +56 -0
- shared/package-files/12/1299c76e62961e85b48e0021dcd9c84b591c9bc1912a50dfc0ada8f9361e8314/scorelab-v5.log +10 -0
- shared/package-files/12/129b950b98313c716efaee637a2d14998af1522f8f2d5bfc98a83347b5db27a4/netprop-neigh-inv-s0.7.log +10 -0
- shared/package-files/12/12b1c336c44796225178db90fec124f43e30d78b4b4d20f8e14747ddd87e3176/consensus-equivalence-5Ms-N5-L-ion-net.log +7 -0
- shared/package-files/12/12b1c336c44796225178db90fec124f43e30d78b4b4d20f8e14747ddd87e3176/consensus-equivalence-5Ms-N5-L-ion-net2.log +7 -0
- shared/package-files/12/12e6bb59a622cb1cea003a7f8bf56ca2cd037babdfce3d4999afe730ea6aa5f1/inspect2.py +56 -0
- shared/package-files/14/140c50e98165381502317d74efc7136025bf0595f2339eee93b3d1c2ea39c4b3/fusion_rule.py +100 -0
- shared/package-files/14/1430eeac7ff4da529e00b39c3a058abe74a4f5dbf69ffe9707ae447b9524d7df/validation.jsonl +10 -0
- shared/package-files/14/143891692e5ef02133824bcde29064d730aeac6542f790fe77f7cab759576ea7/release_pools.py +117 -0
- shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net-val-sub.report.json +119 -0
- shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net-val-sub.score.log +119 -0
- shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net2-val-sub.report.json +119 -0
- shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net2-val-sub.score.log +119 -0
- shared/package-files/1c/1c06df17bd17c3cd374ae9966cd2693cbe07985405904fa5b7cc79379346a442/train-decoys-audit.log +16 -0
- shared/package-files/1c/1c3ab6fda7483fa65758b5b0ef134e17eacce3f108cd0b2f9e526d2b89366eb3/train-C1.log +6 -0
- shared/package-files/1c/1c62fd3fc145992a5442c8e61d5c4838eeb967bb18dfb4db155e63e9a2d50887/replay-B20k+B30k-I1-50k-val-sub.report.json +107 -0
- shared/package-files/1c/1c779b0269e213cd4430fb1a2449b8eee4f9af5d3326082b46c4ff1c595bf0da/e74-unexplained-train-orbi-noenergy.log +10 -0
- shared/package-files/1c/1cdaec009d6b592fc243d2f279ae1865f98c39a20541157547082c5708efce0a/prepare_inv.py +301 -0
- shared/package-files/22/2229e517381cf87046e431cae8abff14fb5e32484fa8a6b03c500faef0c05fb4/metrics.jsonl +0 -0
- shared/package-files/22/2247cadad1b57623c51a598fcfda8f22afa41d0669fdea95f3f36210effc3d2a/fuse.py +73 -0
- shared/package-files/22/22482fc489c97e37de1c2177cf654374cc958c1f72a788269591849d757134a0/validation.jsonl +10 -0
- shared/package-files/22/226b69a1f981df4100272d5626afef8cc961c8ad0f6ef2d4353d4b170744e58e/recur-weighted-10.log +2 -0
- shared/package-files/22/227d6102bbb5328f8d88440470e4b3b83d5ab292a603bcb12d20481a517f0349/build-5Ms-I1+I3x2g07-L.log +290 -0
- shared/package-files/28/2804e7b9760bb69c26eeee10e497c40277d8399398fe6288cc2dec108433c325/netprop-neigh-inv-s0.8.log +10 -0
- shared/package-files/28/282255e7b2da7a61b86b091c34fd2e5bbeea2a5b789e571e9d3f9a8b17cae659/recur-ms10-p48.log +3 -0
- shared/package-files/28/284950469ffa8b8a1c7f89264927cb6c0b03707c5bf13af087abd2cba78ada90/replays-5Ms-I9b+I13-L-ion-net.sh +9 -0
- shared/package-files/28/2868f987d0f0f48e55f3687a9a8133074a57ebb7e24c03175925940a1c29bb38/anchor_fused.py +67 -0
- shared/package-files/28/2877620d291592f08b06d878f89de2e7fee81bc252b17e82776f01632ac9a4f7/swap-quick-N5-recur-ms10-p48.log +4 -0
shared/package-files/00/0007dc4d06135a1f341557fa9125fb2528931f9152a4b824d7d92ace16bf7b8b/report-agg1.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.5957149510945505,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.2243187351174611,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.5957149510945505,
|
| 25 |
+
"hit_rate_at_20": 0.7671169073125291,
|
| 26 |
+
"hit_rate_at_5": 0.7303213786679087
|
| 27 |
+
},
|
| 28 |
+
"queries": 2147,
|
| 29 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 30 |
+
"strata": {
|
| 31 |
+
"adduct": {
|
| 32 |
+
"[M+H]+": {
|
| 33 |
+
"hit_rate_at_1": 0.6942098914354644,
|
| 34 |
+
"queries": 1658
|
| 35 |
+
},
|
| 36 |
+
"[M+Na]+": {
|
| 37 |
+
"hit_rate_at_1": 0.261758691206544,
|
| 38 |
+
"queries": 489
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"candidate_pool_size": {
|
| 42 |
+
"129-256": {
|
| 43 |
+
"hit_rate_at_1": 0.5957149510945505,
|
| 44 |
+
"queries": 2147
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
"collision_energy": {
|
| 48 |
+
"20-39.999": {
|
| 49 |
+
"hit_rate_at_1": 0.837890625,
|
| 50 |
+
"queries": 512
|
| 51 |
+
},
|
| 52 |
+
"40-59.999": {
|
| 53 |
+
"hit_rate_at_1": 0.807909604519774,
|
| 54 |
+
"queries": 177
|
| 55 |
+
},
|
| 56 |
+
"<20": {
|
| 57 |
+
"hit_rate_at_1": 0.609271523178808,
|
| 58 |
+
"queries": 151
|
| 59 |
+
},
|
| 60 |
+
">=60": {
|
| 61 |
+
"hit_rate_at_1": 0.8563218390804598,
|
| 62 |
+
"queries": 348
|
| 63 |
+
},
|
| 64 |
+
"missing": {
|
| 65 |
+
"hit_rate_at_1": 0.3305526590198123,
|
| 66 |
+
"queries": 959
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"instrument_type": {
|
| 70 |
+
"": {
|
| 71 |
+
"hit_rate_at_1": 0.6857142857142857,
|
| 72 |
+
"queries": 35
|
| 73 |
+
},
|
| 74 |
+
"Orbitrap": {
|
| 75 |
+
"hit_rate_at_1": 0.6010695187165775,
|
| 76 |
+
"queries": 1870
|
| 77 |
+
},
|
| 78 |
+
"QTOF": {
|
| 79 |
+
"hit_rate_at_1": 0.5413223140495868,
|
| 80 |
+
"queries": 242
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"routing_domain": {
|
| 84 |
+
"fallback": {
|
| 85 |
+
"hit_rate_at_1": 0.3329969727547931,
|
| 86 |
+
"queries": 991
|
| 87 |
+
},
|
| 88 |
+
"glacier_released": {
|
| 89 |
+
"hit_rate_at_1": 0.8209342560553633,
|
| 90 |
+
"queries": 1156
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
},
|
| 94 |
+
"uncertainty": {
|
| 95 |
+
"confidence": 0.95,
|
| 96 |
+
"estimate": 0.5957149510945505,
|
| 97 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 98 |
+
"lower": 0.4980890813298613,
|
| 99 |
+
"molecule_groups": 413,
|
| 100 |
+
"queries": 2147,
|
| 101 |
+
"resamples": 2000,
|
| 102 |
+
"seed": 0,
|
| 103 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 104 |
+
"upper": 0.7066121519810412
|
| 105 |
+
},
|
| 106 |
+
"valid_rankings": 2147
|
| 107 |
+
}
|
shared/package-files/00/00942e27fa6419d7b9b8c05fc7eec739b767b7ebebdaab0f9ad53b0c9bea3c21/scorelab-v7-B45a-51k-full.log
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "canonicalized", "unique_candidates": 828117, "unsupported": 7007, "seconds": 87.32361314199807}
|
| 2 |
+
{"event": "planned", "queries": 19429, "groups": 10176, "molecules": 944948, "simulations": 2540748, "seconds": 91.96512267900107}
|
| 3 |
+
ind noprec_pp0.75 all=0.4768 dom=0.7174 non=0.2353 h5=0.6300 h20=0.7103 | diff=+0.0000 [+0.0000,+0.0000]
|
| 4 |
+
agg noprec_pp0.75 all=0.6117 dom=0.8023 non=0.4203 h5=0.8144 h20=0.8791 | diff=+0.0000 [+0.0000,+0.0000]
|
shared/package-files/00/00aa1989c8b3c8cfe4d5ec88a45823abae9a43e76885a951804217804c10cf49/inv-strata-N5.log
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
stratum | queries | I9b+I13 | I16 | I18 | N5
|
| 2 |
+
[M+H]+ Orbitrap energy | 8211 | 0.8465 | 0.8592 | 0.8646 | 0.8658
|
| 3 |
+
m/z [0, 500) | 6474 | 0.8513 | 0.8655 | 0.8676 | 0.8746
|
| 4 |
+
m/z [500, 850) | 1583 | 0.8591 | 0.8604 | 0.8831 | 0.8629
|
| 5 |
+
m/z [850, 5000) | 154 | 0.5195 | 0.5844 | 0.5455 | 0.5260
|
| 6 |
+
[M+Na]+ Orbitrap none | 4082 | 0.2562 | 0.2829 | 0.3861 | 0.2859
|
| 7 |
+
m/z [0, 500) | 526 | 0.3365 | 0.4163 | 0.4259 | 0.4259
|
| 8 |
+
m/z [500, 850) | 1705 | 0.2850 | 0.2956 | 0.2927 | 0.3114
|
| 9 |
+
m/z [850, 5000) | 1851 | 0.2069 | 0.2334 | 0.4608 | 0.2226
|
| 10 |
+
[M+H]+ Orbitrap none | 3987 | 0.3725 | 0.3995 | 0.4146 | 0.3915
|
| 11 |
+
m/z [0, 500) | 1036 | 0.4884 | 0.5685 | 0.5714 | 0.5560
|
| 12 |
+
m/z [500, 850) | 1790 | 0.3480 | 0.3419 | 0.3190 | 0.3503
|
| 13 |
+
m/z [850, 5000) | 1161 | 0.3066 | 0.3376 | 0.4220 | 0.3084
|
| 14 |
+
[M+H]+ QTOF energy | 1523 | 0.7498 | 0.7708 | 0.7754 | 0.7840
|
| 15 |
+
[M+H]+ QTOF none | 672 | 0.6622 | 0.6682 | 0.6830 | 0.6890
|
| 16 |
+
[M+H]+ none | 299 | 0.5418 | 0.5585 | 0.5819 | 0.5619
|
| 17 |
+
[M+Na]+ QTOF none | 227 | 0.4185 | 0.5066 | 0.4934 | 0.4846
|
| 18 |
+
[M+Na]+ none | 187 | 0.3850 | 0.4866 | 0.4439 | 0.4439
|
| 19 |
+
[M+Na]+ Orbitrap energy | 159 | 0.5849 | 0.5912 | 0.6478 | 0.6101
|
| 20 |
+
m/z [0, 500) | 41 | 0.4878 | 0.6098 | 0.6341 | 0.6341
|
| 21 |
+
m/z [500, 850) | 100 | 0.7000 | 0.6600 | 0.7400 | 0.6800
|
| 22 |
+
m/z [850, 5000) | 18 | 0.1667 | 0.1667 | 0.1667 | 0.1667
|
shared/package-files/00/00abce79b919b8cc4c7a57b3a73b76add18ba8d7700752242c88f76708b0eb6c/eval-score-N5-recur-merged-10-max.log
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
19429 queries, 5 members, 108.7 s
|
| 2 |
+
cos pool rule all=0.6197 dom=0.8321 non=0.4065 h5=0.7435 macro=0.7307
|
| 3 |
+
cen pool rule all=0.6088 dom=0.8045 non=0.4124 h5=0.7442 macro=0.7047
|
| 4 |
+
cos_pm pool rule all=0.6306 dom=0.8380 non=0.4223 h5=0.7491 macro=0.7315
|
| 5 |
+
dot pool rule all=0.6447 dom=0.8140 non=0.4748 h5=0.7704 macro=0.7230
|
| 6 |
+
geo pool rule all=0.6172 dom=0.8257 non=0.4078 h5=0.7442 macro=0.7203
|
| 7 |
+
idf05 pool rule all=0.6344 dom=0.8393 non=0.4286 h5=0.7552 macro=0.7307
|
| 8 |
+
idf1 pool rule all=0.6399 dom=0.8384 non=0.4406 h5=0.7612 macro=0.7324
|
| 9 |
+
lin pool rule all=0.5995 dom=0.7942 non=0.4039 h5=0.7119 macro=0.6967
|
| 10 |
+
log01 pool rule all=0.6518 dom=0.8513 non=0.4514 h5=0.7840 macro=0.7312
|
| 11 |
+
log05 pool rule all=0.6327 dom=0.8531 non=0.4114 h5=0.7514 macro=0.7386
|
| 12 |
+
log20 pool rule all=0.6428 dom=0.8514 non=0.4332 h5=0.7536 macro=0.7392
|
| 13 |
+
nll02 pool rule all=0.5004 dom=0.7329 non=0.2669 h5=0.6377 macro=0.6072
|
| 14 |
+
nll10 pool rule all=0.4467 dom=0.6827 non=0.2097 h5=0.6048 macro=0.5538
|
| 15 |
+
poolcen pool rule all=0.6109 dom=0.8033 non=0.4178 h5=0.7500 macro=0.7056
|
| 16 |
+
pow020 pool rule all=0.6031 dom=0.8235 non=0.3818 h5=0.7788 macro=0.7109
|
| 17 |
+
pow030 pool rule all=0.6158 dom=0.8413 non=0.3895 h5=0.7790 macro=0.7185
|
| 18 |
+
pow040 pool rule all=0.6216 dom=0.8459 non=0.3964 h5=0.7527 macro=0.7289
|
| 19 |
+
pow05 pool rule all=0.6397 dom=0.8510 non=0.4275 h5=0.7650 macro=0.7354
|
| 20 |
+
pow05idf025 pool rule all=0.6419 dom=0.8518 non=0.4313 h5=0.7678 macro=0.7377
|
| 21 |
+
pow05idf05 pool rule all=0.6337 dom=0.8518 non=0.4149 h5=0.7633 macro=0.7383
|
| 22 |
+
pow05m pool rule all=0.6351 dom=0.8498 non=0.4195 h5=0.7673 macro=0.7333
|
| 23 |
+
pow05s pool rule all=0.6387 dom=0.8497 non=0.4268 h5=0.7634 macro=0.7339
|
| 24 |
+
pow060 pool rule all=0.6378 dom=0.8492 non=0.4255 h5=0.7595 macro=0.7389
|
| 25 |
+
pow060idf025 pool rule all=0.6426 dom=0.8489 non=0.4355 h5=0.7621 macro=0.7372
|
| 26 |
+
pow060idf050 pool rule all=0.6457 dom=0.8502 non=0.4403 h5=0.7644 macro=0.7395
|
| 27 |
+
pow060m pool rule all=0.6301 dom=0.8491 non=0.4102 h5=0.7611 macro=0.7360
|
| 28 |
+
pow065 pool rule all=0.6382 dom=0.8490 non=0.4265 h5=0.7603 macro=0.7386
|
| 29 |
+
pow070 pool rule all=0.6402 dom=0.8487 non=0.4309 h5=0.7549 macro=0.7392
|
| 30 |
+
pow070idf025 pool rule all=0.6419 dom=0.8488 non=0.4342 h5=0.7596 macro=0.7392
|
| 31 |
+
pow070idf050 pool rule all=0.6412 dom=0.8491 non=0.4324 h5=0.7627 macro=0.7383
|
| 32 |
+
pow070m pool rule all=0.6316 dom=0.8457 non=0.4166 h5=0.7549 macro=0.7354
|
| 33 |
+
pow075 pool rule all=0.6393 dom=0.8457 non=0.4321 h5=0.7537 macro=0.7369
|
| 34 |
+
pow080 pool rule all=0.6350 dom=0.8442 non=0.4251 h5=0.7526 macro=0.7345
|
| 35 |
+
pow080m pool rule all=0.6296 dom=0.8439 non=0.4144 h5=0.7503 macro=0.7351
|
| 36 |
+
pow085 pool rule all=0.6349 dom=0.8404 non=0.4286 h5=0.7513 macro=0.7342
|
| 37 |
+
pow085idf025 pool rule all=0.6367 dom=0.8435 non=0.4290 h5=0.7544 macro=0.7354
|
| 38 |
+
pow085idf050 pool rule all=0.6368 dom=0.8438 non=0.4289 h5=0.7580 macro=0.7345
|
| 39 |
+
pow090 pool rule all=0.6325 dom=0.8378 non=0.4264 h5=0.7498 macro=0.7336
|
| 40 |
+
pow2 pool rule all=0.5858 dom=0.7927 non=0.3780 h5=0.7277 macro=0.7020
|
| 41 |
+
tani pool rule all=0.6011 dom=0.8184 non=0.3830 h5=0.7446 macro=0.7174
|
shared/package-files/02/02b499f2665372b2e76385beb8a177ea43a1e98d92972af11db2f74fba6f472e/train3.manifest.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "train3",
|
| 3 |
+
"source": "synth",
|
| 4 |
+
"conditions": "from-train 3 window 2000 seed 0 hash-range 0,1 (301 conditions)",
|
| 5 |
+
"bundle": "builds/5Ms-I1+I3x2-L",
|
| 6 |
+
"members": "1,3",
|
| 7 |
+
"structures": 435076,
|
| 8 |
+
"tasks": 1163260,
|
| 9 |
+
"failed": 0,
|
| 10 |
+
"rows": 1163260,
|
| 11 |
+
"seconds": 1262.926542488858,
|
| 12 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 13 |
+
"floor": 0.02,
|
| 14 |
+
"spectra": 1163218,
|
| 15 |
+
"without_peak": 42,
|
| 16 |
+
"mean_annotated_peaks": 17.868643710809152,
|
| 17 |
+
"mean_candidates": 25.376552103570997,
|
| 18 |
+
"ppm": 20.0,
|
| 19 |
+
"floor_da": 0.004,
|
| 20 |
+
"max_peaks": 24,
|
| 21 |
+
"annotate_seconds": 43.40271363919601
|
| 22 |
+
}
|
shared/package-files/02/02cd6da9cce20fbcc88e057aae69f214f441203f35af263bb3a39276b8f65bc1/README.md
ADDED
|
@@ -0,0 +1,794 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MassSpecGym v1.5 retrieval package: five scratch-trained GLACIER simulators (tolerance-matched distance of their mean prediction) + formula-transformer inverse branch (two networks) + train-fold library-neighbour branch + measured intact-ion term + cross-pool consensus term + pool aggregation
|
| 2 |
+
|
| 3 |
+
Interim release (the research loop continues; see `EXPERIMENTS.md` at the package root).
|
| 4 |
+
|
| 5 |
+
## What it does
|
| 6 |
+
|
| 7 |
+
`bash infer.sh INPUT_ROOT OUTPUT_ROOT` reads `queries.jsonl` and `candidate_pools.jsonl` and
|
| 8 |
+
writes `OUTPUT_ROOT/rankings.jsonl` with one complete ranking per query. Four
|
| 9 |
+
components score every candidate from the query spectrum, their distances are added, and a
|
| 10 |
+
fifth transfers evidence between related pools of the input.
|
| 11 |
+
|
| 12 |
+
**The rankings of one input are computed jointly.** Two steps use the other queries of the
|
| 13 |
+
same input: the pool mean (item 7; queries naming the same candidate pool) and the
|
| 14 |
+
cross-pool consensus term (item 6; spectra of *other* pools that resemble the query
|
| 15 |
+
spectrum). The ranking of a query therefore depends on which other queries the input
|
| 16 |
+
holds, and a subset of an input is ranked differently from the whole input (Validation:
|
| 17 |
+
"It depends on the input set"; Limits). No label, no stored answer and no fitted
|
| 18 |
+
per-query parameter is involved in either step.
|
| 19 |
+
|
| 20 |
+
1. **Forward branch (spectrum simulation).** Every supported candidate SMILES is simulated
|
| 21 |
+
with a GLACIER forward model (ms-pred commit `ed8311f2`, vendored under `vendor/ms_pred`)
|
| 22 |
+
under the query's adduct, instrument and rounded collision energy (missing energy -> the
|
| 23 |
+
model's "no energy" embedding; missing instrument -> `Unknown`). Simulations are
|
| 24 |
+
deduplicated across queries. Each observed spectrum (top-50 peaks, square-root
|
| 25 |
+
intensities) is compared with each simulated candidate spectrum (top-100 predicted
|
| 26 |
+
fragments) by a Jensen-Shannon distance, with three global, label-free choices selected
|
| 27 |
+
on validation (`views` in `model_config.json`):
|
| 28 |
+
- **fragment-only view**: observed and predicted peaks at or above `precursor_mz - 0.5`
|
| 29 |
+
are left out before normalization; a spectrum with no fragment peak falls back to the
|
| 30 |
+
binned full-spectrum distance;
|
| 31 |
+
- predicted intensities are raised to the power 0.75 before normalization;
|
| 32 |
+
- **tolerance-matched comparison** instead of fixed 0.01 Da bins:
|
| 33 |
+
every predicted peak is assigned to the nearest observed peak if it lies within
|
| 34 |
+
`max(ppm x m/z, floor)` of it; the divergence is taken over the observed peaks and the
|
| 35 |
+
predicted intensity that matches no observed peak counts as its own outcome. The
|
| 36 |
+
tolerance depends only on the query's `instrument_type`: max(10 ppm, 1 mDa) for
|
| 37 |
+
`Orbitrap`, max(20 ppm, 4 mDa) for every other or missing instrument
|
| 38 |
+
(`match_ppm`, `match_floor_mda`, `match_by_instrument`).
|
| 39 |
+
Unsupported candidates get distance 1. The package holds **five** simulators (see
|
| 40 |
+
Model). For every candidate the five members' matched
|
| 41 |
+
predictions (the predicted probability assigned to each observed peak and, with it, the
|
| 42 |
+
unmatched remainder) are averaged and compared once with the observed spectrum
|
| 43 |
+
(`"ensemble": "prediction"`).
|
| 44 |
+
2. **Inverse branch (fingerprint prediction;** `inverse.py`, `invrun.py`**).** For every pool and every *distinct molecular formula among its
|
| 45 |
+
candidates* (computed from the candidate SMILES), each spectrum of the pool is annotated
|
| 46 |
+
under that formula: the 50 strongest peaks are matched to heavy-atom sub-compositions of
|
| 47 |
+
the candidate formula (adduct-shifted, tolerance `max(20 ppm, 0.004 Da)`, RDBE >= 0) and
|
| 48 |
+
the 24 strongest explained peaks are kept. A 25.0 M-parameter transformer
|
| 49 |
+
(`FormulaFormer`: root-formula token with adduct / instrument / collision-energy context,
|
| 50 |
+
peak tokens with sub-formula, neutral loss and intensity, pairwise formula-difference
|
| 51 |
+
attention biases) predicts a 4096-bit Morgan fingerprint (radius 2). The predicted bit
|
| 52 |
+
probabilities are averaged over all spectra of the pool (`"pooled": true`), and the
|
| 53 |
+
inverse distance of a candidate is the cosine distance between that mean probability
|
| 54 |
+
vector **under the candidate's own formula**, raised element-wise to the power 0.7, and
|
| 55 |
+
the candidate's fingerprint (`"score": {"members": "probability", "power": 0.7}`). The
|
| 56 |
+
power lifts bits the network predicts with a low but non-zero probability; it is one
|
| 57 |
+
global constant selected on validation. The branch holds **two networks** of one recipe
|
| 58 |
+
trained from different random seeds; their pooled
|
| 59 |
+
probability vectors are averaged before the power is applied. Their training data
|
| 60 |
+
include spectra that this project's own forward models simulated for the structures
|
| 61 |
+
of the supplied corpus (see Model). The hypothesized formula is always
|
| 62 |
+
the formula of the candidate being scored; no label, no true formula and no
|
| 63 |
+
precursor-m/z error enters the branch (the precursor m/z is not an input of the network
|
| 64 |
+
or of the annotation). Candidates with elements outside the supported list or with more
|
| 65 |
+
than 4 M heavy-atom sub-compositions get inverse distance 1.
|
| 66 |
+
3. **Library-neighbour branch (**`library.py`**).** A memory-based
|
| 67 |
+
component: `model.pt` holds a library of the **train fold** (194,119 spectra as binned
|
| 68 |
+
fragment and neutral-loss vectors, and the 4096-bit Morgan fingerprints of their 25,046
|
| 69 |
+
structures). A query spectrum is compared with every library spectrum,
|
| 70 |
+
`similarity = 0.5 x (fragment cosine + neutral-loss cosine)` (0.01 Da bins, square-root
|
| 71 |
+
intensities, peaks at or above `precursor_mz - 0.5` dropped, query peaks spread to the
|
| 72 |
+
two adjacent bins; the neutral-loss view bins `precursor_mz - m/z`); the similarity of a
|
| 73 |
+
library molecule is the maximum over its spectra. The 20 most similar library molecules
|
| 74 |
+
(plus every molecule tied with the 20th among the 32 most similar, so that the vote does
|
| 75 |
+
not depend on the library order) vote for the candidates that resemble them:
|
| 76 |
+
`score(c) = sum_j s_j^6 x Tanimoto(c, m_j) / sum_j s_j^6 - prior(c)`; the library
|
| 77 |
+
distance is `-score(c)`. `prior(c)` is the mean Tanimoto similarity of the candidate to a
|
| 78 |
+
fixed sample of 1,024 library molecules: it removes the part of the score that does not
|
| 79 |
+
depend on the query spectrum (how much a candidate resembles train-fold molecules in
|
| 80 |
+
general), so the branch carries spectrum-specific evidence only. Train-fold molecules
|
| 81 |
+
are not candidates' answers: the benchmark split keeps train, validation and test
|
| 82 |
+
molecules apart, the neighbours act as structural analogues (median Tanimoto of the best
|
| 83 |
+
neighbour to the validation label 0.16), and with neighbours taken from a *different*
|
| 84 |
+
query the branch gives nothing (control below). No query, pool, label or fold other than
|
| 85 |
+
train is in the library, and nothing is fitted at inference.
|
| 86 |
+
4. **Measured intact-ion term (**`ionterm.py`**).** An MS/MS spectrum
|
| 87 |
+
often still contains the unfragmented ion (53 % of the train-fold spectra have a peak
|
| 88 |
+
within 20 mDa of it). For every candidate the term asks whether the spectrum has a peak
|
| 89 |
+
at *that candidate's own* ion mass - the monoisotopic mass of the candidate's formula
|
| 90 |
+
(from its SMILES) plus the adduct shift - and how far the nearest observed peak is from
|
| 91 |
+
it. The signed distance `e` is scored with an error model fitted on the train fold (see
|
| 92 |
+
Model): per acquisition class - (`[M+H]+` with energy, `[M+H]+` without, `[M+Na]+`) x
|
| 93 |
+
(`Orbitrap`, `QTOF`, other) - a Gaussian core with a relative width and offset plus a
|
| 94 |
+
uniform background over the window `W` = 20 mDa,
|
| 95 |
+
`term = -log((1 - b) exp(-z^2 / 2) + b sqrt(2 pi) sigma / (2 W))`,
|
| 96 |
+
`z = (e - offset_ppm x m) / sigma`, `sigma = sigma_ppm x m`. A candidate with a peak at
|
| 97 |
+
its ion mass gets a term near 0, one without gets the "no peak" value (3.4 - 7.4 on
|
| 98 |
+
validation, depending on class and mass). The term depends on the candidate only through
|
| 99 |
+
its formula: it separates candidates of *different formulae* and gives isomers the same
|
| 100 |
+
value. On validation 40 % of the queries have at least one candidate with such a peak.
|
| 101 |
+
Only measured peaks are read: **the reported `precursor_mz` field is not an input of
|
| 102 |
+
this term** (see Limits). Queries with an adduct other than `[M+H]+` / `[M+Na]+` or
|
| 103 |
+
without peaks get no term; a candidate whose formula the candidate store cannot
|
| 104 |
+
represent gets the "no peak" value.
|
| 105 |
+
5. **Fusion of the four components.** `fused = forward + w x inverse + u x library + v x ion` with fixed rules on
|
| 106 |
+
acquisition metadata and pool structure (`inverse`, `library` and `ion` in `model_config.json`):
|
| 107 |
+
`w = 0.75` for `[M+H]+` spectra with a recorded collision energy, otherwise
|
| 108 |
+
`w = max(0.05, 0.5 / n)`, where `n` is the number of query spectra that name the same
|
| 109 |
+
`candidate_pool_id`; `u = 0` for `[M+H]+` spectra with a recorded collision energy,
|
| 110 |
+
otherwise `u = 0.4`; `v = 0.05` for `[M+H]+` spectra with a recorded collision energy,
|
| 111 |
+
otherwise `v = 0.01`. Global constants selected on validation; nothing is fitted per
|
| 112 |
+
query.
|
| 113 |
+
6. **Cross-pool consensus term (**`consensus.py`**; new in this release).** Spectra of
|
| 114 |
+
related molecules resemble each other, and an input usually holds many related unknowns.
|
| 115 |
+
The term transfers structure evidence between the pools of one input - the idea of
|
| 116 |
+
annotation propagation in molecular networks, with the package's own current first
|
| 117 |
+
candidates in place of known identities. It reads the input spectra, the candidate
|
| 118 |
+
pools and the fused distances of item 5, nothing else:
|
| 119 |
+
- every spectrum is compared with the spectra of all **other** pools of the input by the
|
| 120 |
+
similarity of the library branch (item 3: `0.5 x (fragment cosine + neutral-loss
|
| 121 |
+
cosine)`, 0.01 Da bins); the similarity `s_B` of a pool `B` is the maximum over its
|
| 122 |
+
spectra;
|
| 123 |
+
- every pool `B` has *current answers*: its first 10 candidates `b` under the pool mean
|
| 124 |
+
`D_B` of the fused distance, weighted
|
| 125 |
+
`P_B(b) = softmax(-(D_B(b) - min D_B) / 0.02)` (ties by candidate id);
|
| 126 |
+
- a candidate `c` of the query's pool receives from pool `B` the evidence
|
| 127 |
+
`e_B(c) = sum_b P_B(b) x Tanimoto(c, b) - prior(c)` (4096-bit Morgan fingerprints);
|
| 128 |
+
`prior(c)` is the mean of the first sum over **all** pools of the input - what `c`
|
| 129 |
+
gets from resembling the input's current answers in general. Subtracting it leaves
|
| 130 |
+
the evidence that depends on the query spectrum;
|
| 131 |
+
- the 10 most similar pools vote (plus every pool tied with the 10th among the 32
|
| 132 |
+
retrieved, so that the vote does not depend on the order of the input):
|
| 133 |
+
`vote(c) = sum_B s_B^3 x e_B(c) / (sum_B s_B^3 + 0.5^3)`, and
|
| 134 |
+
`distance = fused - vote` for every query (`consensus` in `model_config.json`:
|
| 135 |
+
`answers`, `temperature`, `k`, `top`, `power`, `absorb`, weights 1 / 1).
|
| 136 |
+
The constant `0.5^3` acts as a neighbour of similarity 0.5 that carries no evidence: a
|
| 137 |
+
spectrum that resembles nothing else in the input gets a vanishing term, and on an
|
| 138 |
+
input of one pool the term is absent. Nothing is fitted or stored; no label, candidate
|
| 139 |
+
position or table of molecules is read; the "answers" are the fixed model's own
|
| 140 |
+
predictions for the same input, right or wrong. One round only: the answers come from
|
| 141 |
+
the fused distance of item 5, not from the output of this step.
|
| 142 |
+
7. **Pool aggregation (multi-spectrum evidence).** Queries that name the same
|
| 143 |
+
`candidate_pool_id` are spectra of the same unknown, so the final distance of a candidate
|
| 144 |
+
is the mean of its distances (`fused - vote`) over all scored spectra of that pool
|
| 145 |
+
(`pool_aggregation: 1.0`). This uses only the supplied inputs: no labels, no formulae, no
|
| 146 |
+
candidate positions. With weight 1 all spectra of a pool receive the same ranking.
|
| 147 |
+
8. Candidates are sorted by distance, ties by candidate id.
|
| 148 |
+
|
| 149 |
+
## Model
|
| 150 |
+
|
| 151 |
+
- **Forward members**: five GLACIER networks (15.1 M parameters each), all descending from
|
| 152 |
+
**random initialization**, trained under all acquisition conditions (194,119 train
|
| 153 |
+
spectra), batch 32, stock cosine intensity loss; EMA weights. Source checkpoint sha256:
|
| 154 |
+
- run B, seed 1 (`research/runs/B-all-b32`), train fold only: step 20,000
|
| 155 |
+
`80ec4715663e505007412e3d89dbe6020cd145713840c15affaf82604fc5765c`, step 30,000
|
| 156 |
+
`0228e4fa0589333f02db8223e49d6ecd23cd100d1a6182ad268d9db4f8468798`;
|
| 157 |
+
- run B2, seed 2 (`research/runs/B2-all-b32-seed2`), train fold only: step 20,000
|
| 158 |
+
`ac3c85cdabfb5f68ca3ca506732f1f8e79fa6e9f3d5bf5fa574b6e1f3249312c`, step 30,000
|
| 159 |
+
`f11667b8ee56a15c82d26ab9052816ecc63f2081eaa6fd4ea82d38d1e2a36ce1`;
|
| 160 |
+
- **fork S2** (`research/runs/S2-B20k-synth`): run B's own training state at step
|
| 161 |
+
20,000 continued to step 30,000 with an additional auxiliary intensity loss on 32
|
| 162 |
+
spectra per step of the task-supplied `synthetic_augmentation` corpus; step 30,000
|
| 163 |
+
`44742fa31f337e59b543d903018780560569c2e8e50a008ba008859c8440e3a2` (E47).
|
| 164 |
+
- **Inverse members**: two `FormulaFormer` networks (dim 512, 6 layers, 8 heads,
|
| 165 |
+
24,997,832 parameters each), **randomly initialized**, binary cross-entropy on Morgan
|
| 166 |
+
bits, batch 512, 50,000 steps, EMA weights; same recipe and training data, different
|
| 167 |
+
seeds: run I9b, seed 1 (`research/runs/I9b-ff512x6-real08-corpus2+train3`), step 50,000
|
| 168 |
+
(sha256 `f2741a9676a4743fa586d3effe8753d6eade9356fb2ceac8055ff50baf34195f`), and run
|
| 169 |
+
I13, seed 2 (`research/runs/I13-ff512x6-real08-corpus2+train3-seed2`; E63), step 50,000 (sha256
|
| 170 |
+
`bd0f9c965cf7e0101877c780d9f3592e6fc07b4b20cdfc35adb9f60e3aa295a7`). Their training
|
| 171 |
+
data have three sources:
|
| 172 |
+
- the MassSpecGym v1.5 train fold (194,119 spectra annotated under their label formula,
|
| 173 |
+
sampled with weight `spectra_of_molecule ** -0.5`): 8 % of every batch;
|
| 174 |
+
- the task-supplied `synthetic_augmentation` corpus (2,333,477 ICEBERG-simulated spectra of
|
| 175 |
+
435,076 structures): 46 % of every batch. The task documents describe this corpus as
|
| 176 |
+
held-out-clean optional training data available to every method; our check found 0
|
| 177 |
+
structures (2D InChIKey block) shared with validation labels;
|
| 178 |
+
- **self-simulated spectra (E60)**: 46 % of every batch. The
|
| 179 |
+
structures are those of the same supplied corpus and no others. They were simulated
|
| 180 |
+
with this package's own simulation code by two of its forward members - run B step
|
| 181 |
+
30,000 and run B2 step 30,000, both trained on the train fold only; the fork member S2
|
| 182 |
+
is left out because its auxiliary loss saw corpus rows - under (adduct, instrument,
|
| 183 |
+
collision energy) conditions copied (a) from two of the structure's own corpus rows
|
| 184 |
+
(868,083 spectra) and (b) from three train-fold rows of similar precursor mass
|
| 185 |
+
(1,163,218 spectra), which brings in `[M+Na]+` and spectra without a recorded energy,
|
| 186 |
+
conditions the corpus does not contain. A simulated spectrum (mean of the two members'
|
| 187 |
+
predictions; peaks at or above 2 % of the base peak, at most 24, annotated under the
|
| 188 |
+
structure's formula) is a training row like any other. 2,031,301 rows of 434,950
|
| 189 |
+
structures; store manifests `research/inv/selfsim/*.manifest.json`, source
|
| 190 |
+
`training/inv/selfsim.py`. This is data generated from supplied structures by networks
|
| 191 |
+
that were themselves fitted to the train fold only: no validation or test spectrum,
|
| 192 |
+
label, structure or candidate pool was simulated or otherwise read for training.
|
| 193 |
+
- **Train-fold library** (`research/library/manifest.json`, asset sha256
|
| 194 |
+
`22d1ddb216eef78d5040209ff6526371e5fcd8aac88e68a36823b6d5e73b3712`): built by
|
| 195 |
+
`training/build_library.py` from `train.jsonl` only (source sha256
|
| 196 |
+
`de7f46e91f7b67eb5ca67468381abbdb20a8f739a0ae4b27070276798ecad0fc`): 194,119 spectra,
|
| 197 |
+
25,046 molecules, 6.77 M fragment and 6.76 M neutral-loss entries, 1,024 prior-sample rows
|
| 198 |
+
(`numpy.random.default_rng(0)`). It is fitted data of the model in the same sense as
|
| 199 |
+
network weights - a nearest-neighbour model over the training fold - and is declared
|
| 200 |
+
here because it is not a gradient-trained tensor. It contains no validation or test
|
| 201 |
+
record. `model_config.json` -> `library_asset` repeats the manifest.
|
| 202 |
+
- **Intact-ion error model** (`research/inv/ion_error_table.json`, sha256
|
| 203 |
+
`39aca3a714fd25a20cbaba4d46942764b52d730828a4b8205bf46ac5fc2a6225`; repeated in
|
| 204 |
+
`model_config.json` -> `ion_asset` and stored in `model.pt`): fitted by
|
| 205 |
+
`training/analysis/ion_fit.py` on the **train fold only**. For each of the 194,119 train
|
| 206 |
+
spectra: the signed distance between the ion mass of the spectrum's label formula and the
|
| 207 |
+
nearest observed peak, kept if within 20 mDa; per acquisition class a two-component
|
| 208 |
+
mixture (Gaussian core with relative width and offset + uniform background) by 200 EM
|
| 209 |
+
iterations. 27 fitted numbers:
|
| 210 |
+
|
| 211 |
+
| class | train spectra | peak within 20 mDa | offset (ppm) | sigma (ppm) | background share |
|
| 212 |
+
|---|---|---|---|---|---|
|
| 213 |
+
| `[M+H]+` with energy, Orbitrap | 64,738 | 0.507 | +0.36 | 1.51 | 0.020 |
|
| 214 |
+
| `[M+H]+` with energy, QTOF | 34,603 | 0.511 | +0.03 | 4.35 | 0.087 |
|
| 215 |
+
| `[M+H]+` with energy, other instrument | 36 | - | (row of QTOF) | | |
|
| 216 |
+
| `[M+H]+` without energy, Orbitrap | 51,704 | 0.548 | -0.94 | 2.94 | 0.120 |
|
| 217 |
+
| `[M+H]+` without energy, QTOF | 11,931 | 0.626 | +0.67 | 4.58 | 0.080 |
|
| 218 |
+
| `[M+H]+` without energy, other instrument | 3,467 | 0.670 | +0.85 | 4.27 | 0.102 |
|
| 219 |
+
| `[M+Na]+`, Orbitrap | 24,454 | 0.495 | -0.87 | 2.94 | 0.183 |
|
| 220 |
+
| `[M+Na]+`, QTOF | 2,361 | 0.860 | +1.12 | 4.10 | 0.080 |
|
| 221 |
+
| `[M+Na]+`, other instrument | 825 | 0.931 | +3.00 | 2.97 | 0.032 |
|
| 222 |
+
|
| 223 |
+
Like the library it is fitted data of the model, declared here because it is not a
|
| 224 |
+
gradient-trained tensor. No validation or test record entered the fit; validation chose
|
| 225 |
+
only the two weights `v`.
|
| 226 |
+
**Provenance note:** `model_manifest.json` keeps the contract's literal
|
| 227 |
+
`training_provenance.data` value ("MassSpecGym v1.5 train fold") because the contract fixes
|
| 228 |
+
the manifest fields; the additional supplied synthetic training corpus (inverse members,
|
| 229 |
+
forward member S2) and the self-simulated spectra of its structures (inverse members) are
|
| 230 |
+
declared here and in `model_config.json` (`members[].training_data`,
|
| 231 |
+
`inverse_members[].training_data`, `inverse_members[].self_simulated_store`), the
|
| 232 |
+
train-fold library and the train-fold intact-ion table in `library_asset` and
|
| 233 |
+
`ion_asset`. All of these are training *data* or statistics of it - supplied with the
|
| 234 |
+
task, or generated from supplied structures by networks of this project that were trained
|
| 235 |
+
from random initialization on the train fold - and not pretrained assets: no pretrained
|
| 236 |
+
weights, no published GLACIER / MIST / ICEBERG weights and no external model are used at
|
| 237 |
+
any point.
|
| 238 |
+
- Validation never contributed a gradient or a library entry. Validation labels selected:
|
| 239 |
+
the checkpoint steps and the member combinations, the matching tolerance per instrument
|
| 240 |
+
class, the ensemble rule, pooled scoring, the three inverse fusion constants (unchanged
|
| 241 |
+
since release `1yfse16j`), the inverse score (mean probability, power 0.7; about forty
|
| 242 |
+
scoring functions were compared on the full fold, E59), the training recipe of the inverse
|
| 243 |
+
members (which simulated rows enter; seven runs and their pairs compared, E60 / E61 / E63), the two weights
|
| 244 |
+
of the intact-ion term (twelve weight pairs, after about 230 scored variants of the term's form and weights
|
| 245 |
+
showed one plateau, E64), the settings of the cross-pool consensus term (10 answers,
|
| 246 |
+
temperature 0.02, 10 neighbours, power 3, absorbing constant 0.5, weight 1, prior on,
|
| 247 |
+
one round; about eighty settings were scored on the full fold, E65), and for the
|
| 248 |
+
library branch its similarity (fragment +
|
| 249 |
+
neutral-loss sum; fragment-only and loss-only were tried), `k = 20`, the power 6, the
|
| 250 |
+
prior correction and the two weights (`u = 0 / 0.4`) - more than a hundred fused settings
|
| 251 |
+
were scored on the full validation fold (E48), so the reported gain carries selection
|
| 252 |
+
noise.
|
| 253 |
+
- `model.pt` (627 MB, sha256
|
| 254 |
+
`7d474babce9102814c0f5d4064f9936e8754fecf6f5bc10abc7910c5ce5f1c09`) is a single PyTorch
|
| 255 |
+
file holding the forward member list, the inverse member list, the library tensors and
|
| 256 |
+
the intact-ion table. It is **byte-identical to the file of the previous release
|
| 257 |
+
`qo3ligq0`**: this release adds no trained weight and no fitted number. Inference code:
|
| 258 |
+
`consensus.py` is new and `infer.py` gained the term (four arrays of the candidate store
|
| 259 |
+
are kept, one call, one log line, one fusion step); `infer.sh`, `fastfeat.py`,
|
| 260 |
+
`inverse.py`, `invrun.py`, `library.py`, `ionterm.py` and `vendor/` are byte-identical to
|
| 261 |
+
`qo3ligq0`. With `consensus` removed from `model_config.json` the package computes the
|
| 262 |
+
rankings of `qo3ligq0`.
|
| 263 |
+
|
| 264 |
+
## Validation (selection evidence; not comparable to the test reference)
|
| 265 |
+
|
| 266 |
+
Full validation fold, 19,429 queries / 3,386 pools, query-set sha256
|
| 267 |
+
`7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. Official scorer
|
| 268 |
+
(`/workspace/evaluation/score.py`), report `research/logs/fullfold-5Ms-I9b+I13-L-ion-net.report.json`.
|
| 269 |
+
|
| 270 |
+
| ranking | Hit@1 | Hit@5 | Hit@20 | 95 % CI Hit@1 (molecule-group bootstrap) |
|
| 271 |
+
|---|---|---|---|---|
|
| 272 |
+
| **released** (`qo3ligq0` + cross-pool consensus term; the whole fold as one input) | **0.8022** | 0.8719 | 0.9164 | 0.7445 - 0.8469 |
|
| 273 |
+
| previous release `qo3ligq0` (five forward members, two inverse networks, library branch, intact-ion term) | 0.7713 | 0.8797 | 0.9377 | 0.7153 - 0.8193 |
|
| 274 |
+
| release `2neva96r` (one inverse network trained with self-simulated spectra; no intact-ion term) | 0.7591 | 0.8761 | 0.9364 | 0.7022 - 0.8064 |
|
| 275 |
+
| release `hun9z36i` (three inverse networks; inverse score = power 0.7 of the mean probability) | 0.7525 | 0.8728 | 0.9292 | 0.6961 - 0.8005 |
|
| 276 |
+
| release `z3hoccsj` (five forward members + inverse + library branch) | 0.7481 | 0.8744 | 0.9313 | 0.6932 - 0.7960 |
|
| 277 |
+
| release `q4j2rs0g` (four forward members + inverse) | 0.7327 | 0.8565 | 0.9156 | 0.6762 - 0.7808 |
|
| 278 |
+
| release `ue3i0ea7` (same four members, mean of member distances) | 0.7316 | 0.8563 | 0.9152 | 0.6760 - 0.7796 |
|
| 279 |
+
| release `meqq___h` (forward pair of run B, 0.01 Da bins) | 0.7384 | 0.8418 | 0.9104 | 0.7015 - 0.7736 |
|
| 280 |
+
| release `1yfse16j` (same forward pair, inverse I1 50k only) | 0.7265 | 0.8372 | 0.9033 | 0.6895 - 0.7628 |
|
| 281 |
+
| release `xjj2vs5c` (forward pair only) | 0.6539 | 0.8177 | 0.8925 | 0.6164 - 0.6942 |
|
| 282 |
+
|
| 283 |
+
Paired difference to `qo3ligq0` by the official scorer (molecule groups resampled):
|
| 284 |
+
**+0.0308 [+0.0095, +0.0561]** - the interval excludes zero. **Hit@5 and Hit@20 are lower**
|
| 285 |
+
than in `qo3ligq0` (-0.0078 and -0.0213): one pool of 542 spectra (2.8 % of the fold) moved
|
| 286 |
+
from rank 5 to rank 28; counted per pool both rise (below). Strata of the official report:
|
| 287 |
+
`[M+H]+` 0.863, `[M+Na]+` 0.612; recorded collision energy 0.840-0.952, missing energy
|
| 288 |
+
0.665; Orbitrap 0.797, QTOF 0.844, no instrument 0.774; stock GLACIER domain (`[M+H]+` with
|
| 289 |
+
energy) 0.936, other 0.667 (`qo3ligq0`: 0.931 / 0.611). These numbers hold for the fold
|
| 290 |
+
given to the package as **one input** of 19,429 queries; see "It depends on the input set".
|
| 291 |
+
|
| 292 |
+
### The change against `qo3ligq0` (E65): the cross-pool consensus term
|
| 293 |
+
|
| 294 |
+
Every weight, table and constant of `qo3ligq0` is unchanged; one step was added between the
|
| 295 |
+
fusion and the pool mean. Why a new source of evidence: `qo3ligq0` misses 477 of the 3,386
|
| 296 |
+
validation pools, mostly among isomers of the right formula, and a diagnostic re-ranker
|
| 297 |
+
fitted on the four existing branch outputs (cross-validated over pools, analysis only,
|
| 298 |
+
never packaged) reached pool-macro +0.0044 [-0.0009, +0.0097] - the branches hold no unused
|
| 299 |
+
evidence. The input set does: the spectrally most similar *other* pool of a validation
|
| 300 |
+
spectrum has a target with a mean Tanimoto similarity of 0.339 to the query's target
|
| 301 |
+
(a random pool: 0.100; 0.817 where the spectral similarity is at least 0.8). The identities
|
| 302 |
+
of those pools are unknown at inference, but the package's first candidates for them are
|
| 303 |
+
right or structurally close most of the time, which is enough for a vote.
|
| 304 |
+
|
| 305 |
+
Evidence on the full validation fold (analysis code `training/analysis/netprop.py`, which
|
| 306 |
+
the packaged `consensus.py` reproduces to 4e-16, see the end of this section; paired
|
| 307 |
+
bootstrap over pools against `qo3ligq0`; `research/logs/netprop-released.log`):
|
| 308 |
+
|
| 309 |
+
| measure | `qo3ligq0` | **this release** |
|
| 310 |
+
|---|---|---|
|
| 311 |
+
| official Hit@1 | 0.7713 | **0.8022, +0.0308 [+0.0095, +0.0561]** (official scorer) |
|
| 312 |
+
| pool-macro Hit@1 (every pool counts once) | 0.8591 | **0.8739, +0.0148 [+0.0089, +0.0213]** |
|
| 313 |
+
| pools gained / lost | - | 83 / 33 |
|
| 314 |
+
| query-weighted Hit@1 without the 20 largest pools | - | +0.0245 |
|
| 315 |
+
| Hit@1 with pool weight min(n, 30) | - | +0.0244 [+0.0102, +0.0396] |
|
| 316 |
+
| fused Hit@1 per spectrum (no pool mean) | 0.6184 | 0.6807 |
|
| 317 |
+
| Hit@5 / Hit@20 (official) | 0.8797 / 0.9377 | 0.8719 / 0.9164 |
|
| 318 |
+
| pool-macro Hit@5 / Hit@20 | 0.9306 / 0.9666 | 0.9383 / 0.9687 |
|
| 319 |
+
| domain / other Hit@1 | 0.9314 / 0.6106 | 0.9364 / 0.6674 |
|
| 320 |
+
| the term alone, after the pool mean (official weighting / pool-macro) | - | 0.4493 / 0.3804 |
|
| 321 |
+
|
| 322 |
+
**Controls that must not gain** (same settings; `research/logs/netprop-released-shuffle.log`,
|
| 323 |
+
`-shuffle2.log`, `-randcand.log`):
|
| 324 |
+
- *neighbours of a randomly chosen other spectrum* (two seeds): official -0.0005
|
| 325 |
+
[-0.0074, +0.0055] and -0.0007 [-0.0122, +0.0104], pool-macro -0.0018 [-0.0053, +0.0015]
|
| 326 |
+
and -0.0006 [-0.0038, +0.0027], pools 14 gained / 20 lost and 14 / 16. The gain needs the
|
| 327 |
+
spectral match; a vote of arbitrary pools of the fold does nothing.
|
| 328 |
+
- *a random candidate of each neighbouring pool in place of its current answers*: official
|
| 329 |
+
-0.0096 [-0.0340, +0.0095], pool-macro -0.0035 [-0.0086, +0.0015], pools 36 / 48. The
|
| 330 |
+
gain needs the model's answers; it does not come from similar spectra having similar
|
| 331 |
+
candidate lists.
|
| 332 |
+
|
| 333 |
+
**It depends on the input set.** The term can only use related pools that are in the same
|
| 334 |
+
input. The same package on random shares of the validation pools (each share is a complete
|
| 335 |
+
input of its own; base = `qo3ligq0` on the same share; `research/logs/netprop-released-sub-*.log`;
|
| 336 |
+
the `val-sub` and `val-tiny` rows are end-to-end replays of the package):
|
| 337 |
+
|
| 338 |
+
| share of the pools (seed) | pools | base Hit@1 / pool-macro | Hit@1 change | pool-macro change | pools gained / lost |
|
| 339 |
+
|---|---|---|---|---|---|
|
| 340 |
+
| 100 % | 3,386 | 0.7713 / 0.8591 | +0.0308 [+0.0100, +0.0559] | +0.0148 [+0.0089, +0.0213] | 83 / 33 |
|
| 341 |
+
| 50 % (1) | 1,693 | 0.7629 / 0.8529 | +0.0333 [+0.0085, +0.0604] | +0.0106 [+0.0030, +0.0189] | 33 / 15 |
|
| 342 |
+
| 25 % (1) | 846 | 0.7410 / 0.8416 | +0.0362 [+0.0004, +0.0816] | +0.0071 [-0.0035, +0.0178] | 13 / 7 |
|
| 343 |
+
| 25 % (2) | 846 | 0.7629 / 0.8404 | +0.0132 [-0.0112, +0.0371] | +0.0130 [+0.0012, +0.0236] | 18 / 7 |
|
| 344 |
+
| 12 % (`val-sub`) | 413 | 0.7718 / 0.8862 | **-0.0126 [-0.0379, +0.0028]** (official scorer) | 0.0000 | 4 / 4 |
|
| 345 |
+
| 10 % (1) | 339 | 0.7684 / 0.8319 | +0.0000 [-0.0247, +0.0222] | +0.0029 [-0.0059, +0.0118] | 2 / 1 |
|
| 346 |
+
| 10 % (2) | 339 | 0.7644 / 0.8437 | +0.0048 [-0.0071, +0.0218] | +0.0059 [-0.0059, +0.0177] | 3 / 1 |
|
| 347 |
+
| 3 % (1) | 102 | 0.7995 / 0.8725 | +0.0360 [+0.0000, +0.1160] | +0.0098 [+0.0000, +0.0294] | 1 / 0 |
|
| 348 |
+
| 3 % (2) | 102 | 0.8165 / 0.8431 | 0 | 0 | 0 / 0 |
|
| 349 |
+
| 1 % (`val-tiny`) | 40 | 0.8833 / 0.8750 | 0 | 0 | 0 / 0 |
|
| 350 |
+
|
| 351 |
+
The number of pools the term corrects falls with the size of the input, faster than the
|
| 352 |
+
input itself (83 - 33 = 50 net pools at 100 %, 18 at 50 %, 6 and 11 at 25 %, 0 to 2 at
|
| 353 |
+
10 - 12 %). On no share is the pool-macro measure lower; the per-query value follows the
|
| 354 |
+
size of the pools that flip, and on `val-sub` it is **lower** than without the term because
|
| 355 |
+
one pool of 22 spectra moves from rank 1 to rank 14 (4 pools gained, 4 lost). A verifier
|
| 356 |
+
that scores the test fold in several shards will therefore see a smaller gain than one
|
| 357 |
+
that scores it in one call, and on a small input the term is noise of either sign.
|
| 358 |
+
|
| 359 |
+
**Where the gain is** (full fold; pools gained / lost). By number of spectra in the pool:
|
| 360 |
+
1: 14 / 7 (431 pools); 2 - 4: 37 / 13 (2,303); 5 - 19: 18 / 8 (452); 20 - 49: 10 / 4
|
| 361 |
+
(161); 50 - 99: 3 / 1 (35); 100 and more: 1 / 0 (4) - every class gains about twice what
|
| 362 |
+
it loses, and two thirds of the per-query gain come from the 200 pools with at least 20
|
| 363 |
+
spectra. By condition: pools of `[M+H]+` spectra with an energy 13 / 6 (2,153 pools), mixed
|
| 364 |
+
12 / 6 (254), pools without such spectra 58 / 21 (979) - the gain sits where the models are
|
| 365 |
+
weak. Of the gained pools 31 had the label at rank 2, 25 at ranks 3 - 5, 13 at ranks
|
| 366 |
+
6 - 10, 14 further down. 354 pools have a target whose 2D structure (first InChIKey block)
|
| 367 |
+
is also the target of another pool - stereoisomers and the like, which the benchmark
|
| 368 |
+
counts as different molecules: 32 gained / 7 lost there, 51 / 26 in the other 3,032 pools.
|
| 369 |
+
|
| 370 |
+
**What gets worse.** 33 pools that were right are now wrong (17 of them with the label at
|
| 371 |
+
rank 2, 27 inside the top five). Per query, Hit@5 and Hit@20 fall: the largest pool of the
|
| 372 |
+
fold (542 spectra, label at rank 5 before) drops to rank 28, which alone costs 2.8 points
|
| 373 |
+
of Hit@5 and Hit@20; without that pool Hit@1 / Hit@5 / Hit@20 go from 0.7935 / 0.8762 /
|
| 374 |
+
0.9359 to 0.8252 / 0.8969 / 0.9427, and per pool 50 pools enter the top five while 24 leave
|
| 375 |
+
it (top twenty: 23 / 16). The term mostly reorders pools whose first candidates were nearly
|
| 376 |
+
tied: the margin between the first and the second candidate is 0.005 (median) in the
|
| 377 |
+
pools it changes and 0.34 in the pools that stay right. Neither that margin nor the
|
| 378 |
+
similarity of the neighbours separates the gained from the lost pools (gains outnumber
|
| 379 |
+
losses about two to one or better in every class of neighbour similarity and under every
|
| 380 |
+
margin gate tried, `research/logs/netprop-margin.log`), so no confidence gate is used.
|
| 381 |
+
|
| 382 |
+
**Selection and plateau.** About eighty settings were scored on this fold. Pool-macro
|
| 383 |
+
change / pools gained and lost / official Hit@1 around the released point (10 answers,
|
| 384 |
+
temperature 0.02, `k` 10, power 3, absorbing constant 0.5, weight 1): answers 1 -> +0.0100,
|
| 385 |
+
72 / 38, 0.7747; 3 -> +0.0127, 75 / 32, 0.7854; 5 -> +0.0145, 83 / 34, 0.7878; **10 ->
|
| 386 |
+
+0.0148, 83 / 33, 0.8022**; 20 -> +0.0145, 82 / 33, 0.7976; 40 -> +0.0139, 81 / 34, 0.7951;
|
| 387 |
+
temperature 0.05 -> +0.0136; and with 5 answers: `k` 5 / 20 -> +0.0130 / +0.0142; power
|
| 388 |
+
2 / 6 -> +0.0139 / +0.0121; absorbing constant 0.3 / 0.7 -> +0.0139 / +0.0121; weight
|
| 389 |
+
0.5 / 1.5 -> +0.0109 / +0.0136. The pool-macro measure is a plateau (+0.012 to +0.015)
|
| 390 |
+
for 5 to 40 answers; **the official value moves between 0.788 and 0.802 on that plateau**
|
| 391 |
+
because a handful of very large pools flip, so the released 0.8022 is its upper end and
|
| 392 |
+
+0.031 is an optimistic reading - the plateau supports +0.017 to +0.031. Variants
|
| 393 |
+
that were not better and are not in the package: no prior (+0.0127, 87 / 44), a second and
|
| 394 |
+
a third round with the answers of the previous round (+0.0118, +0.0109), weighting each
|
| 395 |
+
neighbour by the confidence of its answers (+0.0127 to +0.0145), a cap of 0.8 on the
|
| 396 |
+
similarity (no gain in an early one-answer form), and plain normalization without the
|
| 397 |
+
absorbing constant (+0.0139 with 90 / 43 on the full fold - equal within noise - but it
|
| 398 |
+
flips more pools on small inputs: 6 / 5 against 2 / 1 on a 10 % share).
|
| 399 |
+
|
| 400 |
+
**What is and is not shown.** Every pool-level interval and the official scorer's
|
| 401 |
+
molecule-group interval exclude zero on the full fold, the two controls behave as they
|
| 402 |
+
should, and the gain is present in every pool-size class. Not shown: that an input has to
|
| 403 |
+
be as large and as inter-related as the validation fold for the gain to appear is a
|
| 404 |
+
property of the method, and how many related molecules the test fold holds, and whether
|
| 405 |
+
the verifier scores it as one input, cannot be known here. The term adds no new knowledge
|
| 406 |
+
about fragmentation - it makes the package's answers for related spectra agree with each
|
| 407 |
+
other, and where the models are wrong about a whole family in the same way it will
|
| 408 |
+
reinforce the error.
|
| 409 |
+
|
| 410 |
+
### The two changes of `qo3ligq0` against `2neva96r` (E63, E64; kept in this release): a second inverse network and the measured intact-ion term
|
| 411 |
+
|
| 412 |
+
This section describes release `qo3ligq0`. Its forward members, library, inverse score and the inverse / library fusion constants were
|
| 413 |
+
those of `2neva96r`. Evidence on the full validation fold, every variant inside the release
|
| 414 |
+
rule, paired bootstrap over pools against `2neva96r` (`research/logs/fused-I13-vs-I9b.log`,
|
| 415 |
+
`research/logs/ion-term-package-I9b.log`, `research/logs/ion-term-package-I9b+I13.log`; the
|
| 416 |
+
last two use the packaged `ionterm.py` itself):
|
| 417 |
+
|
| 418 |
+
| measure | `2neva96r` | + second inverse network | + intact-ion term (one network) | `qo3ligq0` (both) |
|
| 419 |
+
|---|---|---|---|---|
|
| 420 |
+
| official Hit@1 | 0.7591 | 0.7638, +0.0047 [-0.0025, +0.0121] | 0.7659, +0.0068 [+0.0021, +0.0143] | **0.7713, +0.0122 [+0.0057, +0.0206]** |
|
| 421 |
+
| pool-macro Hit@1 (every pool counts once) | 0.8535 | 0.8544, +0.0009 [-0.0024, +0.0038] | 0.8571, +0.0035 [+0.0012, +0.0062] | **0.8591, +0.0056 [+0.0018, +0.0095]** |
|
| 422 |
+
| pools gained / lost | - | 15 / 12 | 16 / 4 | 31 / 12 |
|
| 423 |
+
| query-weighted Hit@1 without the 20 largest pools | - | +0.0053 [-0.0031, +0.0135] | +0.0077 [+0.0023, +0.0156] | +0.0138 [+0.0062, +0.0229] |
|
| 424 |
+
| Hit@1 with pool weight min(n, 30) | - | +0.0060 [-0.0015, +0.0138] | +0.0071 [+0.0023, +0.0137] | +0.0134 [+0.0062, +0.0219] |
|
| 425 |
+
| fused Hit@1 per spectrum (no pool mean) | 0.6158 | 0.6172, +0.0013 [-0.0005, +0.0033] | 0.6168, +0.0009 [-0.0002, +0.0021] | 0.6184, +0.0025 [+0.0005, +0.0049] |
|
| 426 |
+
| Hit@5 / Hit@20 (official) | 0.8761 / 0.9364 | 0.8788 / 0.9377 | 0.8766 / 0.9361 | 0.8797 / 0.9377 |
|
| 427 |
+
| domain / other Hit@1 | 0.9227 / 0.5947 | 0.9274 / 0.5995 | 0.9268 / 0.6044 | 0.9314 / 0.6106 |
|
| 428 |
+
|
| 429 |
+
**Second inverse network (E63).** Three further networks were trained from the recipe of
|
| 430 |
+
the released one, each with one factor changed: six instead of three train-like
|
| 431 |
+
self-simulated conditions per structure (I11), a larger self-simulated share (I12), and
|
| 432 |
+
seed 2 with nothing else changed (I13). None beats the released network; the seed twin
|
| 433 |
+
differs from it by -0.010 alone and by +0.002 official / -0.003 pool-macro in the fused
|
| 434 |
+
ranking with 30 pools gained and 41 lost. So a single retrained network moves the fused
|
| 435 |
+
Hit@1 by about +/- 0.003, and the differences between the recent recipes are inside that
|
| 436 |
+
spread. Averaging two networks is the only step with a consistent sign (pairs: +0.0035 and
|
| 437 |
+
+0.0047 official, 15 - 18 pools gained against 12 lost; a third member adds nothing). Alone
|
| 438 |
+
this step is **not** significant on any measure; it enters because it adds to the second
|
| 439 |
+
change (0.0047 + 0.0068 separately, 0.0122 together) and costs about a minute per 20,000
|
| 440 |
+
queries. The pair of the two seeds was preferred over the pair with I11 (equal within
|
| 441 |
+
noise) because it changes nothing but the seed.
|
| 442 |
+
|
| 443 |
+
**Measured intact-ion term (E64).** Candidates of a pool have a median of 55 distinct
|
| 444 |
+
formulae; when the unfragmented ion is still in the spectrum, its measured mass says which
|
| 445 |
+
of them are possible - evidence neither network branch is built to read at the ppm level
|
| 446 |
+
(the forward comparison drops the precursor region, the inverse annotation uses a 20 ppm
|
| 447 |
+
tolerance, the library bins are 0.01 Da). The shape of the term is fitted on the train
|
| 448 |
+
fold; validation chose two weights. Evidence beyond the table:
|
| 449 |
+
- **Form does not matter, weight plateau.** Hand-set kernels, kernels with the train-fold
|
| 450 |
+
widths (x 1 to x 3), normalized likelihoods and the released mixture give the same
|
| 451 |
+
result at the same weights: with one inverse network official +0.001 to +0.007 and
|
| 452 |
+
pool-macro +0.002 to +0.004, with two networks official 0.765 - 0.771 and pool-macro
|
| 453 |
+
0.857 - 0.859. Released mixture, two networks, `v` domain / other: 0.02 / 0.01 -> 0.7706,
|
| 454 |
+
pool-macro 0.8585; **0.05 / 0.01 -> 0.7713, 0.8591**; 0.05 / 0.02 -> 0.7714, 0.8594;
|
| 455 |
+
0.1 / 0.01 -> 0.7709, 0.8579; 0.05 / 0.05 -> 0.7679, 0.8582; 0.05 / 0 -> 0.7678, 0.8579.
|
| 456 |
+
At a domain weight of 0.5 with the kernel form the term overrides the models (11 pools
|
| 457 |
+
lost, pool-macro -0.005 to -0.011). The released pair is an interior point, with the
|
| 458 |
+
smaller non-domain weight chosen away from the downturn at 0.05.
|
| 459 |
+
- **Where the gain is** (`qo3ligq0` against `2neva96r`, points of the official metric):
|
| 460 |
+
`[M+H]+` with energy below 400 m/z +0.22, 700 - 850 m/z +0.13 (0.643 -> 0.732); without
|
| 461 |
+
energy, `[M+H]+` 400 - 500 m/z +0.18, 500 - 600 +0.10, `[M+Na]+` 400 - 500 +0.15,
|
| 462 |
+
500 - 600 +0.09; positive in 20 of 24 stratum x mass cells, largest loss -0.01.
|
| 463 |
+
- **Ceiling.** If every candidate with a formula other than the label's were removed (an
|
| 464 |
+
oracle, analysis only), `2neva96r` would reach 0.7854: formula errors are 2.6 of its 24.1
|
| 465 |
+
lost points, and the term recovers about a quarter of them. The remaining errors are
|
| 466 |
+
isomers of the correct formula, which this term cannot touch.
|
| 467 |
+
|
| 468 |
+
**What is and is not shown.** For the two changes together every pool-level interval
|
| 469 |
+
excludes zero, and so does the official scorer's molecule-group interval; it was the
|
| 470 |
+
first release since `z3hoccsj` for which that held. For the term alone the intervals
|
| 471 |
+
exclude zero with only 4 pools lost; for the second network alone nothing is significant.
|
| 472 |
+
The weights were picked among twelve pairs and the member set among four ensembles, on this fold,
|
| 473 |
+
so part of the difference is selection; the neighbouring settings lie within 0.001 - 0.004
|
| 474 |
+
of the released one. Whether test spectra contain the intact ion as often as validation
|
| 475 |
+
spectra do cannot be measured here; where it is absent the term is constant and changes
|
| 476 |
+
nothing.
|
| 477 |
+
|
| 478 |
+
### The change of `2neva96r` against `hun9z36i` (E60, E62; kept in this release): an inverse network trained with spectra simulated by the package's own forward models
|
| 479 |
+
|
| 480 |
+
This section describes release `2neva96r`, whose inverse branch was the single network
|
| 481 |
+
I9b. Forward members, library, inverse score and fusion constants were those of `hun9z36i`. Its
|
| 482 |
+
three inverse networks (trained on the train fold and the supplied ICEBERG corpus) are
|
| 483 |
+
replaced by one network of the same architecture and schedule; half of its simulated
|
| 484 |
+
training rows are spectra that our forward members simulated for the corpus structures
|
| 485 |
+
(see Model). Why it should help: E59 showed the inverse branch limited by its simulated
|
| 486 |
+
rows; the supplied rows come from a different simulator and cover only `[M+H]+` with an
|
| 487 |
+
energy, while our forward members were fitted to the train fold under all conditions, so
|
| 488 |
+
their output looks like the real rows the inverse network meets at inference and can be
|
| 489 |
+
produced under the conditions the corpus lacks. Controlled steps (E60; same recipe, seed
|
| 490 |
+
and schedule; member alone, Hit@1 per spectrum / after the pool mean, trainer metric):
|
| 491 |
+
corpus rows only 0.432 / 0.488; plus the corpus structures self-simulated under two of
|
| 492 |
+
their corpus conditions 0.489 / 0.537; plus three train-like conditions per structure
|
| 493 |
+
(network I9b) 0.511 / 0.551. A quarter of the corpus rows plus self-simulated
|
| 494 |
+
rows for the other three quarters of the structures (0.477 / 0.521) beats the full
|
| 495 |
+
corpus. Evidence on the full validation fold with the release rule
|
| 496 |
+
(`research/logs/eval-score-I9b.log`, `research/logs/fused-I9b-vs-hun9z36i.log`,
|
| 497 |
+
`research/logs/inv-strata-I9b.log`, `research/logs/fused-I9b-bins-vs-hun9z36i.log`; paired
|
| 498 |
+
bootstrap over pools):
|
| 499 |
+
|
| 500 |
+
| measure | `hun9z36i` | `2neva96r` |
|
| 501 |
+
|---|---|---|
|
| 502 |
+
| inverse branch alone, Hit@1 after pooling (official weighting / pool-macro) | 0.5272 / 0.6007 | 0.5887 / 0.7011 |
|
| 503 |
+
| official Hit@1 of the fused ranking | 0.7525 | **0.7591, +0.0066 [-0.0013, +0.0143]** |
|
| 504 |
+
| pool-macro Hit@1 (every pool counts once) | 0.8414 | 0.8535, +0.0121 [+0.0068, +0.0177] |
|
| 505 |
+
| pools gained / lost | - | 68 / 27 |
|
| 506 |
+
| query-weighted Hit@1 without the 20 largest pools | - | +0.0074 [-0.0016, +0.0169] |
|
| 507 |
+
| Hit@1 with pool weight min(n, 30) | - | +0.0076 [-0.0016, +0.0172] |
|
| 508 |
+
| fused Hit@1 per spectrum (no pool mean) | 0.6053 | 0.6158, +0.0105 [+0.0065, +0.0147] |
|
| 509 |
+
| Hit@5 / Hit@20 (official) | 0.8728 / 0.9292 | 0.8761 / 0.9364 |
|
| 510 |
+
| domain / other Hit@1 | 0.9136 / 0.5907 | 0.9227 / 0.5947 |
|
| 511 |
+
|
| 512 |
+
**What is and is not shown.** The branch alone improves by 0.06 on the official measure
|
| 513 |
+
and 0.10 pool-macro, one network against an ensemble of three. About a tenth of that
|
| 514 |
+
arrives in the fused ranking, because the forward branch already ranks most of the pools
|
| 515 |
+
the inverse branch gains. The pool-macro and the per-spectrum interval exclude zero; the
|
| 516 |
+
official interval and the two query-weighted measures that single pools cannot decide
|
| 517 |
+
include it narrowly. Every Hit@k is higher. Where the gain is (inverse branch alone,
|
| 518 |
+
`hun9z36i` -> `2neva96r`): precursor m/z below 300: 0.613 -> 0.763, 300-450: 0.690 ->
|
| 519 |
+
0.792, 450-700: 0.553 -> 0.652, **700-850: 0.350 -> 0.305, above 850: 0.276 -> 0.257** -
|
| 520 |
+
all of it lies below 700 m/z; for the 31 % of validation queries above 700 m/z the new
|
| 521 |
+
network is slightly worse alone (only 4 % of the corpus rows are that heavy), and the
|
| 522 |
+
fused ranking barely moves there (0.510 -> 0.509; below 700 m/z 0.860 -> 0.870). By condition (alone): `[M+H]+` with energy 0.729 ->
|
| 523 |
+
0.824, `[M+H]+` without 0.382 -> 0.418, `[M+Na]+` with 0.349 -> 0.519 (241 queries),
|
| 524 |
+
`[M+Na]+` without 0.260 -> 0.271. Selection on this fold: four training recipes were
|
| 525 |
+
compared (two smaller self-simulation stores, this one, and one with generated
|
| 526 |
+
structures, which was worse, E61); the fusion constants were re-scanned with the new
|
| 527 |
+
network and stay where they were. A caveat on independence: the self-simulated rows carry
|
| 528 |
+
the forward models' view of fragmentation (out of sample a simulated spectrum shares
|
| 529 |
+
22-32 % of the real peaks of its structure, E60), so the two branches may err together
|
| 530 |
+
more often than before; the fused gain is positive in both condition classes, but this
|
| 531 |
+
was not measured directly.
|
| 532 |
+
|
| 533 |
+
### The change of `hun9z36i` against `z3hoccsj` (E59 c; score kept in this release): how the inverse prediction is compared with a candidate
|
| 534 |
+
|
| 535 |
+
This section describes release `hun9z36i`, which still had three inverse networks; the
|
| 536 |
+
score it introduced is kept. Its networks and library were those of `z3hoccsj`. Only the comparison between the
|
| 537 |
+
predicted fingerprint and a candidate fingerprint changed: one cosine distance of the three
|
| 538 |
+
networks' mean bit probability raised to the power 0.7, instead of the mean of three plain
|
| 539 |
+
cosine distances. Why it should help: the networks are trained with a bit-wise
|
| 540 |
+
cross-entropy and spread probability mass over many bits at low values when a spectrum is
|
| 541 |
+
uninformative; the plain cosine is dominated by the few confident bits and nearly ignores
|
| 542 |
+
that low-probability evidence, a concave transform restores it. Evidence on the full
|
| 543 |
+
validation fold (`research/logs/fused-score.log`, `research/logs/fused-score-gamma.log`,
|
| 544 |
+
`research/logs/score-scan.log`, `research/logs/score-scan-idf.log`; paired bootstrap over
|
| 545 |
+
pools):
|
| 546 |
+
|
| 547 |
+
| measure | `z3hoccsj` | `hun9z36i` |
|
| 548 |
+
|---|---|---|
|
| 549 |
+
| inverse branch alone, Hit@1 after pooling (official weighting / pool-macro) | 0.5139 / 0.5898 | 0.5272 / 0.6007 |
|
| 550 |
+
| official Hit@1 of the fused ranking | 0.7481 | **0.7525, +0.0044 [-0.0020, +0.0114]** |
|
| 551 |
+
| pool-macro Hit@1 (every pool counts once) | 0.8379 | 0.8414, +0.0035 [+0.0003, +0.0071] |
|
| 552 |
+
| pools gained / lost | - | 23 / 11 |
|
| 553 |
+
| query-weighted Hit@1 without the 20 largest pools | - | +0.0049 [-0.0018, +0.0127] |
|
| 554 |
+
| Hit@1 with pool weight min(n, 30) | - | +0.0046 [-0.0020, +0.0121] |
|
| 555 |
+
| fused Hit@1 per spectrum (no pool mean) | 0.6012 | 0.6053, +0.0041 [+0.0025, +0.0058] |
|
| 556 |
+
| Hit@5 / Hit@20 (official) | 0.8744 / 0.9313 | 0.8728 / 0.9292 |
|
| 557 |
+
| domain / other Hit@1 | 0.9089 / 0.5867 | 0.9136 / 0.5907 |
|
| 558 |
+
|
| 559 |
+
The power is on a plateau: fused official difference +0.0019 / +0.0019 / +0.0015 / +0.0039 /
|
| 560 |
+
**+0.0044** / +0.0040 / +0.0038 for powers 0.9 / 0.85 / 0.8 / 0.75 / **0.7** / 0.65 / 0.6
|
| 561 |
+
(pool-macro +0.0015 ... +0.0035, pools gained > lost for every one), -0.0013 at 0.5; the
|
| 562 |
+
mean probability without a power gives +0.0008. The fusion constants were re-scanned with
|
| 563 |
+
the new score and stay where they were. **What is and is not shown:** the gain is small.
|
| 564 |
+
The pool-macro and the per-spectrum interval exclude zero, the official one does not, and
|
| 565 |
+
Hit@5 / Hit@20 are 0.002 lower. The variant was picked among about forty scoring functions
|
| 566 |
+
(powers, logarithms, bit-frequency weights, centred cosines, Tanimoto, likelihoods) of
|
| 567 |
+
which the concave ones cluster at +0.001 to +0.005 official, so part of +0.0044 is
|
| 568 |
+
selection. It was released because every Hit@1 measure agrees in sign, the branch alone
|
| 569 |
+
improved clearly, and the change costs nothing at inference.
|
| 570 |
+
|
| 571 |
+
### The two changes of `z3hoccsj` against `q4j2rs0g` (E47, E48; unchanged in this release)
|
| 572 |
+
|
| 573 |
+
The official Hit@1 is query-weighted and all spectra of a pool receive one ranking, so a
|
| 574 |
+
few very large pools can decide it (one validation pool is 2.8 % of the fold). Every change
|
| 575 |
+
is therefore also read on measures that single pools cannot decide. Paired bootstrap over
|
| 576 |
+
pools against `q4j2rs0g` (`research/logs/knn-evaluate-inclusive.log`,
|
| 577 |
+
`research/logs/knn-evaluate-inclusive-5Ms.log`, `research/logs/big-pools-S2-compositions.log`):
|
| 578 |
+
|
| 579 |
+
| measure | `q4j2rs0g` | + fifth member (S2 30k) | + library branch (four members) | `z3hoccsj` (both) |
|
| 580 |
+
|---|---|---|---|---|
|
| 581 |
+
| official Hit@1 | 0.7327 | 0.7371, +0.0044 [+0.0003, +0.0089] | 0.7465, +0.0137 [+0.0027, +0.0256] | **0.7481, +0.0154 [+0.0032, +0.0282]** |
|
| 582 |
+
| pool-macro Hit@1 (every pool counts once) | 0.8317 | 0.8349, +0.0032 [+0.0000, +0.0065] | 0.8361, +0.0044 [+0.0018, +0.0071] | **0.8379, +0.0062 [+0.0021, +0.0103]** |
|
| 583 |
+
| pools gained / lost | - | 23 / 12 | 19 / 4 | 37 / 16 |
|
| 584 |
+
| query-weighted Hit@1 without the 20 largest pools | 0.7681 | +0.0050 [+0.0002, +0.0102] | +0.0115 [+0.0010, +0.0225] | +0.0133 [+0.0014, +0.0250] |
|
| 585 |
+
| Hit@1 with pool weight min(n, 30) | - | +0.0051 [+0.0002, +0.0104] | +0.0115 [+0.0020, +0.0206] | +0.0133 [+0.0024, +0.0243] |
|
| 586 |
+
| fused Hit@1 per spectrum (no pool mean) | 0.5908 | 0.5939, +0.0031 [+0.0007, +0.0053] | 0.5990, +0.0082 [+0.0035, +0.0132] | 0.6012, +0.0104 [+0.0056, +0.0156] |
|
| 587 |
+
| Hit@5 / Hit@20 (official) | 0.8565 / 0.9156 | 0.8575 / 0.9158 | 0.8711 / 0.9260 | 0.8744 / 0.9313 |
|
| 588 |
+
| domain / other Hit@1 | 0.9072 / 0.5575 | 0.9072 / 0.5664 | - | 0.9089 / 0.5867 |
|
| 589 |
+
|
| 590 |
+
**Fifth forward member (E47).** The simulator's weakness on unseen molecules is its
|
| 591 |
+
intensity model; the auxiliary loss on the synthetic corpus shows that model seventeen
|
| 592 |
+
times more structures. The fork member is the best single simulator so far (per spectrum
|
| 593 |
+
0.4910 against 0.4862 for its twin without the term, +0.0048 [-0.0044, +0.0142]; the gain
|
| 594 |
+
sits in `[M+H]+` with energy, where the corpus has data), and adding it is a small step
|
| 595 |
+
whose pool-level intervals all sit at or above zero. It costs 25 % more simulation time.
|
| 596 |
+
|
| 597 |
+
**Library-neighbour branch (E48).** Alone it is a weak ranker (Hit@1 0.168 per spectrum,
|
| 598 |
+
0.254 after the pool mean), but it is independent of both models
|
| 599 |
+
and helps exactly where they are weakest: spectra without a recorded collision energy and
|
| 600 |
+
`[M+Na]+` spectra (other-conditions Hit@1 0.558 -> 0.587). For `[M+H]+` spectra with an
|
| 601 |
+
energy the forward model is strong and any library weight was neutral or negative, so its
|
| 602 |
+
weight there is 0. Evidence that the gain is spectrum-specific and not a "resembles the
|
| 603 |
+
train fold" prior (which the split construction could reward, and which this project
|
| 604 |
+
excludes on principle, E21):
|
| 605 |
+
- with the neighbours of a *randomly chosen other query* the branch alone scores 0.010 per
|
| 606 |
+
spectrum (0.020 after the pool mean), and fused at `u` = 0.25 / 0.5 it changes the
|
| 607 |
+
per-spectrum Hit@1 by -0.0013 / -0.0051, pool-macro by +0.0006 [-0.0006, +0.0018] /
|
| 608 |
+
+0.0000 [-0.0021, +0.0021] with 3 / 7 pools gained and 1 / 7 lost, and the official Hit@1
|
| 609 |
+
by +0.0017 [-0.0001, +0.0044] / +0.0027 [-0.0071, +0.0130]
|
| 610 |
+
(`research/logs/knn-evaluate-shuffled-debias.log`); the real neighbours give +0.0081 per
|
| 611 |
+
spectrum and 12 pools gained / 4 lost at 0.25;
|
| 612 |
+
- the prior term removes the spectrum-free "resembles the library" component of the vote.
|
| 613 |
+
It also makes the branch better (alone, k = 10, power 3: 0.153 -> 0.171 per spectrum,
|
| 614 |
+
0.204 -> 0.253 after the pool mean) and the control tighter (without it: official +0.0037
|
| 615 |
+
[-0.0031, +0.0115] at 0.25 and -0.0116 [-0.0338, +0.0041] at 0.5).
|
| 616 |
+
|
| 617 |
+
Weight plateau (four released members + library, `u` for other conditions): 0.25 -> 0.7416,
|
| 618 |
+
0.35 -> 0.7442, **0.4 -> 0.7465**, 0.45 -> 0.7466, 0.5 -> 0.7483, 0.6 -> 0.7435, 0.65 ->
|
| 619 |
+
0.7345, 0.8 -> 0.7302; pool-macro +0.0024 / +0.0038 / +0.0044 / +0.0038 / +0.0044 / +0.0032
|
| 620 |
+
for 0.25 ... 0.6. With five members the official value falls from 0.7486 at 0.45 to 0.7445
|
| 621 |
+
at 0.5 because two more pools (about 80 spectra net) become misses, while pool-macro stays
|
| 622 |
+
flat (0.8385 / 0.8382). 0.4 was chosen as an interior point of the plateau, not as its
|
| 623 |
+
maximum.
|
| 624 |
+
|
| 625 |
+
**What is and is not shown.** Pool-macro, the trimmed and the capped measure and the
|
| 626 |
+
per-spectrum score all move in the same direction with intervals above zero, for each
|
| 627 |
+
change and for both together; the official difference (+0.0154) rests partly on large
|
| 628 |
+
pools and its interval nearly reaches zero. The library settings were chosen among more
|
| 629 |
+
than a hundred on this fold; the neighbouring settings (k 10-32, power 3-10, weight
|
| 630 |
+
0.25-0.5) give +0.007 to +0.016 on the official measure and +0.002 to +0.005 pool-macro,
|
| 631 |
+
so we expect a real but smaller gain on unseen data. Test molecules may have fewer close analogues in the
|
| 632 |
+
train fold than validation molecules do, or more; this was not and cannot be measured
|
| 633 |
+
here.
|
| 634 |
+
|
| 635 |
+
How the numbers of this release were produced: the packaged `infer.py` of this exact build
|
| 636 |
+
ran the complete inverse branch (both networks), the library branch (neighbour search over
|
| 637 |
+
the packaged library included), the intact-ion term, the matched scoring of all five
|
| 638 |
+
members, the fusion and the consensus term on the full fold as one input, taking the
|
| 639 |
+
forward simulations of the five members from their saved full-fold prediction files
|
| 640 |
+
(`--load-predictions`; 275 s; `research/logs/fullfold-5Ms-I9b+I13-L-ion-net-saved-simulations.log`),
|
| 641 |
+
and the official scorer produced the released row and the paired difference against the
|
| 642 |
+
rankings of the same run of the previous build. Agreement with the analysis code on the
|
| 643 |
+
full fold (`research/logs/consensus-equivalence-5Ms-I9b+I13-L-ion-net.log`): forward,
|
| 644 |
+
inverse, library and intact-ion outputs of this run equal to those of the previous build's
|
| 645 |
+
run (difference 0); consensus term - 19,428 queries covered on both sides (one spectrum
|
| 646 |
+
has similarity 0 to every other pool), largest absolute difference 4.4e-16; rank of
|
| 647 |
+
the label in the package's rankings equal to the analysis value for 19,429 / 19,429
|
| 648 |
+
queries (hence 0.8022 / 0.8719 / 0.9164 on both sides).
|
| 649 |
+
End-to-end replays of this build (forward simulation included) from a read-only copy
|
| 650 |
+
outside the workspace with an `env -i` environment and a free GPU, each with exit status 0,
|
| 651 |
+
0 unscored queries, unchanged file hashes of the copy (283 files) and no process left
|
| 652 |
+
behind. (Six analysis and check scripts under `training/` were added or updated after these
|
| 653 |
+
replays; no file that inference reads changed, and the published copy was replayed again,
|
| 654 |
+
see `EXPERIMENTS.md` E65.) Because the term depends on the input, a replay on a subset is compared with the
|
| 655 |
+
analysis code run on **the same subset** (`research/logs/consensus-subset-5Ms-I9b+I13-L-ion-net.log`),
|
| 656 |
+
not with the full-fold run:
|
| 657 |
+
- `val-tiny` (180 queries, 40 complete pools;
|
| 658 |
+
`research/logs/replay-5Ms-I9b+I13-L-ion-net-val-tiny.log`): 180 / 180 rankings, 83 s wall,
|
| 659 |
+
2.55 GiB peak resident memory; the term scored 168 queries; label rank equal to the
|
| 660 |
+
analysis value for 180 / 180; top candidate equal to the previous build's replay for
|
| 661 |
+
180 / 180, top five for 154 (Hit@1 / 5 / 20 unchanged: 0.8833 / 0.9111 / 0.9889).
|
| 662 |
+
- edge-case input (24 hand-built queries: single candidate, 256 candidates, duplicate,
|
| 663 |
+
unparsable, charged and unsupported candidates, missing metadata, adducts outside the
|
| 664 |
+
supported two, empty and one-peak spectra, added to 180 validation queries;
|
| 665 |
+
`research/logs/replay-5Ms-I9b+I13-L-ion-net-edge.log`): 204 / 204 complete rankings, 91 s
|
| 666 |
+
wall, 2.58 GiB peak resident memory; the term scored 186 queries in 44 pools and left
|
| 667 |
+
the rest (spectra without a fragment peak shared with another pool, unscorable queries)
|
| 668 |
+
as they were; top candidate equal to the previous build's replay for 202 / 204.
|
| 669 |
+
- `val-sub` (2,147 queries, 413 complete pools, 295,422 simulations x 5 members;
|
| 670 |
+
`research/logs/replay-5Ms-I9b+I13-L-ion-net-val-sub.log`): 2,147 / 2,147 rankings, 693 s
|
| 671 |
+
wall, 3.45 GiB peak resident memory; label rank equal to the analysis value on the same
|
| 672 |
+
subset for 2,147 / 2,147; official scorer on the subset: Hit@1 0.7592 (0.6585 - 0.8557),
|
| 673 |
+
Hit@5 0.8398, Hit@20 0.8961 (`research/logs/replay-5Ms-I9b+I13-L-ion-net-val-sub.report.json`;
|
| 674 |
+
previous release on the same subset: 0.7718 / 0.8407 / 0.8840, paired difference
|
| 675 |
+
**-0.0126 [-0.0379, +0.0028]**; pool-macro 0.8862 on both sides, 4 pools gained and 4
|
| 676 |
+
lost - see "It depends on the input set").
|
| 677 |
+
|
| 678 |
+
**Not run:** an end-to-end replay on the full fold with all simulations recomputed (about
|
| 679 |
+
1.3 h of the single GPU; the simulation code and the forward weights are those of the
|
| 680 |
+
previous releases, whose four-member path was replayed in E45).
|
| 681 |
+
|
| 682 |
+
## Limits
|
| 683 |
+
|
| 684 |
+
- Non-domain conditions (`[M+Na]+`, missing collision energy; half of the validation queries)
|
| 685 |
+
remain much weaker than the stock GLACIER domain (0.667 vs 0.936). The largest single
|
| 686 |
+
class of misses is still Orbitrap pools of many `[M+H]+` / `[M+Na]+` spectra without a
|
| 687 |
+
recorded energy and with few peaks per spectrum (E33). On unseen molecules the simulator's
|
| 688 |
+
intensity model is the weak part (E42 d).
|
| 689 |
+
- The validation estimate depends on a few very large pools (47 % of validation queries sit
|
| 690 |
+
in pools with >= 16 spectra and are hit or missed as a whole; one pool is 2.8 % of the
|
| 691 |
+
fold); the molecule-group interval is wide (0.745 - 0.847), and member sets, the ensemble
|
| 692 |
+
rule, the fusion constants, the inverse score, the inverse training recipe, the
|
| 693 |
+
intact-ion weights, the consensus settings and the library settings were chosen inside
|
| 694 |
+
that noise.
|
| 695 |
+
- **The rankings of an input are computed jointly, and the gain of this release needs a
|
| 696 |
+
large input.** The consensus term uses the spectra and current answers of the other
|
| 697 |
+
pools of the same input. A query is ranked differently when the input is split,
|
| 698 |
+
reduced or extended; the validation estimate applies to an input like the validation
|
| 699 |
+
fold given in one call. On shares of the fold the pool-macro gain shrinks from +0.015
|
| 700 |
+
to +0.011 (50 %), +0.007 / +0.013 (25 %) and +0.003 / +0.006 (10 %), and on the 12 %
|
| 701 |
+
subset `val-sub` the official Hit@1 is 0.013 **lower** than without the term (one pool
|
| 702 |
+
of 22 spectra). How many related molecules the test fold holds per input is unknown.
|
| 703 |
+
- The consensus term propagates the package's own guesses. It makes the answers for
|
| 704 |
+
related spectra agree with each other; where the models are wrong about related pools
|
| 705 |
+
in the same way it reinforces the error, and it turned 33 validation pools that were
|
| 706 |
+
right into misses (83 the other way). It reorders pools whose first candidates are
|
| 707 |
+
nearly tied, and no measured quantity (own margin, neighbour similarity, neighbour
|
| 708 |
+
confidence) tells its gains from its losses, so it has no confidence gate. Hit@5 and
|
| 709 |
+
Hit@20 per query are lower than in the previous release because of one very large
|
| 710 |
+
pool. Its official gain varies by +/- 0.015 between equivalent settings. Pools whose
|
| 711 |
+
targets share a 2D structure with another pool's target (354 of 3,386 on validation)
|
| 712 |
+
gain at about five times the rate of the others (32 of 354 against 51 of 3,032); a
|
| 713 |
+
fold without such pools would gain less.
|
| 714 |
+
The search among the input spectra is quadratic in their number (8.5 s for 19,429).
|
| 715 |
+
- The library branch depends on the train fold containing structural analogues of the
|
| 716 |
+
query molecule with similar spectra. Where it has none, its vote is diffuse and, after
|
| 717 |
+
the prior correction, close to uninformative; it cannot identify a molecule by itself. Its
|
| 718 |
+
weight is a constant; a confidence-dependent weight was not explored.
|
| 719 |
+
- The inverse networks are trained mostly on simulated spectra, half of them simulated by
|
| 720 |
+
this package's own forward members. They therefore inherit what those simulators get
|
| 721 |
+
wrong, and the two branches are less independent than their architectures suggest. Their
|
| 722 |
+
gain over the earlier networks lies entirely below 700 m/z; heavy molecules (31 % of
|
| 723 |
+
the validation queries, 4 % of the corpus rows) did not improve, and adding generated
|
| 724 |
+
heavy structures to the training data made it worse (E61). The two networks differ only
|
| 725 |
+
in their seed, and one retrained network moves the fused Hit@1 by about +/- 0.003
|
| 726 |
+
(E63). Three of the five forward members share run B's first 20,000 steps.
|
| 727 |
+
- The intact-ion term can only tell formulae apart. It is silent when the spectrum does
|
| 728 |
+
not contain the unfragmented ion (60 % of the validation queries have no candidate
|
| 729 |
+
with a peak at its ion mass) and it never separates isomers, which are the bulk of the
|
| 730 |
+
remaining errors: with perfect formula knowledge release `2neva96r` would gain 2.6
|
| 731 |
+
points, the term gains about 0.7 (E64). A fragment or noise peak that happens to lie at
|
| 732 |
+
a wrong candidate's ion mass counts for that candidate; the small weights bound the
|
| 733 |
+
damage. Its error model has one row per coarse acquisition class; instruments or
|
| 734 |
+
calibrations unlike the train fold's would be scored with the wrong width.
|
| 735 |
+
- Candidates that RDKit cannot parse, contain unsupported elements or have more than 100
|
| 736 |
+
heavy atoms get forward distance 1; elements outside
|
| 737 |
+
`C N P O S Si I H Cl F Br B Se Fe Co As Na K` get inverse distance 1. A candidate without
|
| 738 |
+
a fingerprint has library distance 0 (no vote, no prior); queries with an adduct other
|
| 739 |
+
than `[M+H]+` / `[M+Na]+` get no inverse, no library and no intact-ion term (they do get
|
| 740 |
+
the consensus term when their spectrum resembles another pool's).
|
| 741 |
+
- The reported `precursor_mz` field is used by the forward scoring view and by the library vectors to
|
| 742 |
+
separate fragment peaks from the precursor region, and by the library's neutral-loss view
|
| 743 |
+
(`precursor_mz - m/z` of the *query's own* peaks, compared with library spectra; it is
|
| 744 |
+
never compared with a candidate's mass); the consensus term compares the same two
|
| 745 |
+
vectors between spectra of the input. A mass-error term on that field was evaluated
|
| 746 |
+
(E21) and deliberately **not** enabled: for a large part of the benchmark the field is
|
| 747 |
+
not a measurement but a value computed from the reference formula (in the train fold it
|
| 748 |
+
equals the label's theoretical ion mass within 0.05 mDa for 96 % of the Orbitrap
|
| 749 |
+
`[M+H]+` spectra with an energy). The inverse branch and the intact-ion term do not
|
| 750 |
+
read the field. The intact-ion term compares candidate masses with *peaks of the
|
| 751 |
+
spectrum*, whose errors in the same class are Gaussian with a width of 0.7 - 1.5 ppm,
|
| 752 |
+
as measured values are; one small class (365 train spectra, `[M+Na]+` Orbitrap with
|
| 753 |
+
four-decimal peak lists) looks recalibrated (0.1 ppm) and is not treated differently.
|
| 754 |
+
- The same fixed weights and library handle every query; acquisition metadata (adduct,
|
| 755 |
+
presence of a collision energy) and the number of spectra per pool select the fusion
|
| 756 |
+
weights; the other queries of the input enter through the pool mean and the consensus
|
| 757 |
+
term; candidate order, labels and popularity are never read.
|
| 758 |
+
|
| 759 |
+
## Runtime
|
| 760 |
+
|
| 761 |
+
`/opt/glacier/bin/python` (override with `MASSSPECGYM_GLACIER_PYTHON`), one GPU, <= 14 CPU
|
| 762 |
+
workers, no network, no writes inside the package. Forward branch: every candidate is
|
| 763 |
+
featurized once and simulated by all five members; the simulation is GPU-bound and linear
|
| 764 |
+
in the number of members (about 2,850 simulations / s per member on an H100, E45).
|
| 765 |
+
Everything else on the full validation fold with the five members' simulations loaded from
|
| 766 |
+
disk, 13 workers, free GPU and cores: 275 s for this build (canonicalization and planning
|
| 767 |
+
82 s, candidate store with fingerprints 60 s, intact-ion term 0.7 s, library branch 88 s
|
| 768 |
+
of which the neighbour search on the CPU 84 s, inverse branch with two networks 23 s,
|
| 769 |
+
scoring 40 s of which the consensus term 17 s - the search among the 19,429 input
|
| 770 |
+
spectra 8.5 s on the CPU, quadratic in their number, the rest on the GPU). End to end
|
| 771 |
+
with 13 workers on a free GPU: `val-tiny` (180 queries, 29,258 simulations x 5 members)
|
| 772 |
+
83 s; `val-sub` (2,147 queries, 295,422 simulations x 5 members) 693 s, the simulation
|
| 773 |
+
at about 570 - 610 candidates / s for the five members.
|
| 774 |
+
**Expected total for a fold of
|
| 775 |
+
the size of validation or test on a free H100: about 4,200 - 4,500 s of simulation (2.54 M
|
| 776 |
+
candidates x 5 members) plus about 300 s; about 8,500 s if every pool had 256 candidates;
|
| 777 |
+
inside the 18,000 s limit; not measured end to end on a full fold.** Host memory, measured
|
| 778 |
+
on the full validation fold: 11.3 GiB peak resident in the largest process (the neighbour
|
| 779 |
+
search holds a dense 400 x 194,119 similarity block per chunk); the annotation workers are
|
| 780 |
+
forks of about 1.7 GiB each (mostly shared pages).
|
| 781 |
+
|
| 782 |
+
## Files
|
| 783 |
+
|
| 784 |
+
`infer.sh`, `infer.py`, `fastfeat.py` (compact featurization, tensor-equal to the stock one),
|
| 785 |
+
`inverse.py` (formula annotation, `FormulaFormer`), `invrun.py` (inference-side candidate
|
| 786 |
+
store, pooled scoring and the ensemble score), `library.py` (library-neighbour branch),
|
| 787 |
+
`ionterm.py` (measured intact-ion term), `consensus.py` (cross-pool consensus term), `model.pt`,
|
| 788 |
+
`model_config.json`, `model_manifest.json`, `vendor/ms_pred` (+ `LICENSE.ms-pred`),
|
| 789 |
+
`training/` (training, preparation, publication and analysis source used for this release;
|
| 790 |
+
`training/inv/` holds the inverse-branch preparation and training code,
|
| 791 |
+
`training/build_library.py` builds the library, `training/analysis/ion_fit.py` fits the
|
| 792 |
+
intact-ion table, `training/analysis/netprop.py` is the analysis twin of `consensus.py`,
|
| 793 |
+
`training/checks/consensus_equivalence.py` and `training/checks/consensus_subset.py` compare the two). Experiment records: `EXPERIMENTS.md` and
|
| 794 |
+
`research/` at the package root.
|
shared/package-files/02/02e22165c14c18c26dc4e667df6b72ae05e25e8e6d03c40a6d57bd494cdcf7be/eval-B20k-full.log
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "loaded", "queries": 19429, "pools": 3386, "members": 1, "workers": 10}
|
| 2 |
+
{"event": "canonicalized", "unique_candidates": 828117, "unsupported": 7007, "seconds": 48.231754455016926}
|
| 3 |
+
{"event": "planned", "queries": 19429, "groups": 10176, "molecules": 944948, "simulations": 2540748, "seconds": 51.98929439694621}
|
| 4 |
+
/opt/glacier/lib/python3.11/site-packages/torch/nn/modules/transformer.py:508: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. We recommend specifying layout=torch.jagged when constructing a nested tensor, as this layout receives active development, has better operator coverage, and works with torch.compile. (Triggered internally at /pytorch/aten/src/ATen/NestedTensorImpl.cpp:178.)
|
| 5 |
+
output = torch._nested_tensor_from_mask(
|
| 6 |
+
{"event": "simulating", "finished": 64000, "total": 2540748, "seconds": 24.158835588023067, "per_second": 2649.1342998223186}
|
| 7 |
+
{"event": "simulating", "finished": 128000, "total": 2540748, "seconds": 48.751134573016316, "per_second": 2625.5799197511974}
|
| 8 |
+
{"event": "simulating", "finished": 192000, "total": 2540748, "seconds": 73.58149613102432, "per_second": 2609.351672574195}
|
| 9 |
+
{"event": "simulating", "finished": 256000, "total": 2540748, "seconds": 99.0789154060185, "per_second": 2583.7989742916525}
|
| 10 |
+
{"event": "simulating", "finished": 320000, "total": 2540748, "seconds": 124.20486578694545, "per_second": 2576.3885977616314}
|
| 11 |
+
{"event": "simulating", "finished": 384000, "total": 2540748, "seconds": 150.48657677404117, "per_second": 2551.722606971014}
|
| 12 |
+
{"event": "simulating", "finished": 448000, "total": 2540748, "seconds": 176.97835340397432, "per_second": 2531.3830272642795}
|
| 13 |
+
{"event": "simulating", "finished": 512000, "total": 2540748, "seconds": 203.64012294402346, "per_second": 2514.2392992010637}
|
| 14 |
+
{"event": "simulating", "finished": 576000, "total": 2540748, "seconds": 230.37769684498198, "per_second": 2500.2420281490295}
|
| 15 |
+
{"event": "simulating", "finished": 640000, "total": 2540748, "seconds": 258.02300963702146, "per_second": 2480.398941553048}
|
| 16 |
+
{"event": "simulating", "finished": 704000, "total": 2540748, "seconds": 285.7100758929737, "per_second": 2464.0363060339414}
|
| 17 |
+
{"event": "simulating", "finished": 768000, "total": 2540748, "seconds": 313.4523886559764, "per_second": 2450.1328680028137}
|
| 18 |
+
{"event": "simulating", "finished": 832000, "total": 2540748, "seconds": 344.3926244720351, "per_second": 2415.847323314437}
|
| 19 |
+
{"event": "simulating", "finished": 896000, "total": 2540748, "seconds": 376.2079226929927, "per_second": 2381.6616981008865}
|
| 20 |
+
{"event": "simulating", "finished": 960000, "total": 2540748, "seconds": 409.0585126889637, "per_second": 2346.852516744851}
|
| 21 |
+
{"event": "simulating", "finished": 1024000, "total": 2540748, "seconds": 442.13302081800066, "per_second": 2316.0450628760404}
|
| 22 |
+
{"event": "simulating", "finished": 1088000, "total": 2540748, "seconds": 483.54239341197535, "per_second": 2250.0612455566647}
|
| 23 |
+
{"event": "simulating", "finished": 1152000, "total": 2540748, "seconds": 516.9897756719729, "per_second": 2228.283912390054}
|
| 24 |
+
{"event": "simulating", "finished": 1216000, "total": 2540748, "seconds": 551.7442788479384, "per_second": 2203.9195450092407}
|
| 25 |
+
{"event": "simulating", "finished": 1280000, "total": 2540748, "seconds": 586.4333885329543, "per_second": 2182.6860902345625}
|
| 26 |
+
{"event": "simulating", "finished": 1344000, "total": 2540748, "seconds": 621.3682895880193, "per_second": 2162.9684400069746}
|
| 27 |
+
{"event": "simulating", "finished": 1408000, "total": 2540748, "seconds": 656.7500967340311, "per_second": 2143.890053464595}
|
| 28 |
+
{"event": "simulating", "finished": 1472000, "total": 2540748, "seconds": 700.5790453079389, "per_second": 2101.1190812208542}
|
| 29 |
+
{"event": "simulating", "finished": 1536000, "total": 2540748, "seconds": 745.8193566090195, "per_second": 2059.4799349049567}
|
| 30 |
+
{"event": "simulating", "finished": 1600000, "total": 2540748, "seconds": 790.7821758339414, "per_second": 2023.3131814240442}
|
| 31 |
+
{"event": "simulating", "finished": 1664000, "total": 2540748, "seconds": 835.409213457955, "per_second": 1991.8382191552723}
|
| 32 |
+
{"event": "simulating", "finished": 1728000, "total": 2540748, "seconds": 879.566202841932, "per_second": 1964.6048181668723}
|
| 33 |
+
{"event": "simulating", "finished": 1792000, "total": 2540748, "seconds": 925.4029563890072, "per_second": 1936.4537228112179}
|
| 34 |
+
{"event": "simulating", "finished": 1856000, "total": 2540748, "seconds": 972.9094944569515, "per_second": 1907.680016049142}
|
| 35 |
+
{"event": "simulating", "finished": 1920000, "total": 2540748, "seconds": 1013.1857419300359, "per_second": 1895.0128496109285}
|
| 36 |
+
{"event": "simulating", "finished": 1984000, "total": 2540748, "seconds": 1050.8312781680143, "per_second": 1888.0290691944786}
|
| 37 |
+
{"event": "simulating", "finished": 2048000, "total": 2540748, "seconds": 1090.3098243100103, "per_second": 1878.365171382412}
|
| 38 |
+
{"event": "simulating", "finished": 2112000, "total": 2540748, "seconds": 1133.004313374986, "per_second": 1864.070573313872}
|
| 39 |
+
{"event": "simulating", "finished": 2176000, "total": 2540748, "seconds": 1177.1751603509765, "per_second": 1848.4929628919645}
|
| 40 |
+
{"event": "simulating", "finished": 2240000, "total": 2540748, "seconds": 1223.5975633299677, "per_second": 1830.6672611409401}
|
| 41 |
+
{"event": "simulating", "finished": 2304000, "total": 2540748, "seconds": 1274.7570431040367, "per_second": 1807.403232218866}
|
| 42 |
+
{"event": "simulating", "finished": 2368000, "total": 2540748, "seconds": 1332.9381146249361, "per_second": 1776.5265874074814}
|
| 43 |
+
{"event": "simulating", "finished": 2432000, "total": 2540748, "seconds": 1399.4259619029472, "per_second": 1737.8554251580076}
|
| 44 |
+
{"event": "simulating", "finished": 2496000, "total": 2540748, "seconds": 1474.3166161800036, "per_second": 1692.9877697961563}
|
| 45 |
+
{"event": "simulated", "finished": 2540748, "total": 2540748, "failed": 0, "seconds": 1534.2023890169803}
|
| 46 |
+
{"event": "finished", "queries": 19429, "unscored": 0, "directly_scored": 19429, "scoring_seconds": 20.097601677989587, "total_seconds": 1620.591543680057}
|
shared/package-files/05/050a2c53b05a8dee5389304040637bfd0815ff592a19e11f4a34387feade887a/fwd_union.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Forward branch scored against union spectra (lab, E74; labels evaluate only)
|
| 2 |
+
|
| 3 |
+
fwd_union.py --variants NAME=DOMAIN/OTHER/MAXPEAKS[,NAME=...] [--sims evals/stack/5M-S2-30k]
|
| 4 |
+
[--base-pred evals/fullfold/5Ms-N5u48-L-ion-net2/pred] [--min-group 3]
|
| 5 |
+
|
| 6 |
+
E72 gave the inverse branch the union of the spectra of a pool that share an adduct and a condition
|
| 7 |
+
class. Here the same union replaces the *observed* spectrum of the forward comparison: every query of
|
| 8 |
+
a merged group is scored against the simulation of its own condition, but the observed side is the
|
| 9 |
+
union spectrum of the group (``invrun.merged_queries``; DOMAIN / OTHER = ``none`` or ``agg:tol_mda``
|
| 10 |
+
with agg in mean | sqrt | freq). MAXPEAKS = observed peaks kept (released: 50).
|
| 11 |
+
|
| 12 |
+
Writes ``evals/fullfold/swap-fwd-NAME/pred`` (new ``distances.pkl``; inverse / library / ion linked
|
| 13 |
+
from ``--base-pred``) for the full-rule comparison (``netprop.py evaluate``, ``inv_swap.py compare``)
|
| 14 |
+
and prints the forward branch alone (pool mean) against the released forward distances.
|
| 15 |
+
Nothing is fitted; no label is read except by the evaluator.
|
| 16 |
+
"""
|
| 17 |
+
import argparse
|
| 18 |
+
import json
|
| 19 |
+
import os
|
| 20 |
+
import pickle
|
| 21 |
+
import sys
|
| 22 |
+
import time
|
| 23 |
+
from pathlib import Path
|
| 24 |
+
|
| 25 |
+
import numpy as np
|
| 26 |
+
import torch
|
| 27 |
+
|
| 28 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 29 |
+
import scorelab
|
| 30 |
+
import infer
|
| 31 |
+
import invrun
|
| 32 |
+
|
| 33 |
+
ROOT = Path('/workspace/research')
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def spec(text):
|
| 37 |
+
if text == 'none':
|
| 38 |
+
return None
|
| 39 |
+
agg, tol = text.split(':')
|
| 40 |
+
return {'agg': agg, 'tol_mda': float(tol)}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def main():
|
| 44 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 45 |
+
p.add_argument('--variants', required=True)
|
| 46 |
+
p.add_argument('--sims', default='evals/stack/5M-S2-30k')
|
| 47 |
+
p.add_argument('--base-pred', default='evals/fullfold/5Ms-N5u48-L-ion-net2/pred')
|
| 48 |
+
p.add_argument('--config', default='builds/5Ms-N5u48-L-ion-net2/model_config.json')
|
| 49 |
+
p.add_argument('--min-group', type=int, default=3)
|
| 50 |
+
args = p.parse_args()
|
| 51 |
+
config = json.load(open(ROOT / args.config))
|
| 52 |
+
queries, pools, plan, masses, intens, done = scorelab.load(ROOT / 'validation-input', [ROOT / args.sims])
|
| 53 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 54 |
+
device = torch.device('cuda')
|
| 55 |
+
base = pickle.load(open(ROOT / args.base_pred / 'distances.pkl', 'rb'))
|
| 56 |
+
base_rank = ev.ranks([base[q['query_id']] for q in queries], 1.0)
|
| 57 |
+
first = np.array([m[0] for m in ev.by_pool.values()])
|
| 58 |
+
print(ev.line('released forward distances', base_rank), f'macro={np.mean(base_rank[first] == 0):.4f}', flush=True)
|
| 59 |
+
for item in args.variants.split(','):
|
| 60 |
+
name, body = item.split('=')
|
| 61 |
+
dom, oth, peaks = body.split('/')
|
| 62 |
+
options = {'min_group': args.min_group, 'domain': spec(dom), 'other': spec(oth)}
|
| 63 |
+
tick = time.monotonic()
|
| 64 |
+
merged, count = invrun.merged_queries(queries, options) if (options['domain'] or options['other']) else (queries, 0)
|
| 65 |
+
plan.queries = merged
|
| 66 |
+
c = dict(config, max_observed_peaks=int(peaks))
|
| 67 |
+
dist = infer.score_queries(plan, masses, intens, done, c, device)
|
| 68 |
+
plan.queries = queries
|
| 69 |
+
rank = ev.ranks(dist, 1.0)
|
| 70 |
+
d = (rank[first] == 0).astype(float) - (base_rank[first] == 0).astype(float)
|
| 71 |
+
macro = d[ev.boot].mean(axis=1)
|
| 72 |
+
print(ev.line(name, rank, base_rank), f'macro={np.mean(rank[first] == 0):.4f} ({d.mean():+.4f} [{np.percentile(macro, 2.5):+.4f}, {np.percentile(macro, 97.5):+.4f}]) '
|
| 73 |
+
f'pools +{int((d > 0).sum())} -{int((d < 0).sum())} merged={count} seconds={time.monotonic() - tick:.0f}', flush=True)
|
| 74 |
+
target = ROOT / 'evals' / 'fullfold' / f'swap-fwd-{name}' / 'pred'
|
| 75 |
+
target.mkdir(parents=True, exist_ok=True)
|
| 76 |
+
for other in ('inverse', 'library', 'ion'):
|
| 77 |
+
link = target / f'{other}.pkl'
|
| 78 |
+
if not link.exists():
|
| 79 |
+
os.symlink((ROOT / args.base_pred / f'{other}.pkl').resolve(), link)
|
| 80 |
+
tmp = target / 'distances.pkl.tmp'
|
| 81 |
+
pickle.dump({q['query_id']: x for q, x in zip(queries, dist)}, open(tmp, 'wb'))
|
| 82 |
+
os.replace(tmp, target / 'distances.pkl')
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
if __name__ == '__main__':
|
| 86 |
+
main()
|
shared/package-files/05/054826ce4b15b2f623c7931654585b23a76b80659fa048be489141959a39d0f5/big-pools-B45a.log
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cumulative share of queries in the largest pools: top1=0.028 top2=0.037 top5=0.058 top10=0.077 top20=0.112 top50=0.190 top100=0.287
|
| 2 |
+
size share dom orbi Na | released rel-fwd inv 4M 4M-fwd 4M+B45a 4M+B45a-fwd B45a-for-B3 B45a-for-B3 B20k+B45a B20k+B45a-f relM relM-fwd
|
| 3 |
+
542 0.028 0.00 1.00 0.79 | 0 0 88 4 4 3 4 4 4 0 0 0 0
|
| 4 |
+
179 0.009 0.00 1.00 1.00 | 6 3 43 0 4 0 4 3 10 3 5 2 2
|
| 5 |
+
157 0.008 0.01 0.99 0.57 | 14 15 3 15 15 15 17 14 15 9 11 14 17
|
| 6 |
+
query-weighted Hit@1 without the 5 largest pools: released=0.7408 rel-fwd=0.6511 inv=0.5321 4M=0.7534 4M-fwd=0.6722 4M+B45a=0.7526 4M+B45a-fwd=0.6737 B45a-for-B30k=0.7535 B45a-for-B30k-fwd=0.6706 B20k+B45a=0.7493 B20k+B45a-fwd=0.6654 relM=0.7446 relM-fwd=0.6683
|
| 7 |
+
query-weighted Hit@1 without the 10 largest pools: released=0.7439 rel-fwd=0.6566 inv=0.5352 4M=0.7568 4M-fwd=0.6782 4M+B45a=0.7559 4M+B45a-fwd=0.6797 B45a-for-B30k=0.7569 B45a-for-B30k-fwd=0.6765 B20k+B45a=0.7526 B20k+B45a-fwd=0.6712 relM=0.7478 relM-fwd=0.6742
|
| 8 |
+
query-weighted Hit@1 without the 20 largest pools: released=0.7535 rel-fwd=0.6706 inv=0.5367 4M=0.7669 4M-fwd=0.6930 4M+B45a=0.7660 4M+B45a-fwd=0.6946 B45a-for-B30k=0.7670 B45a-for-B30k-fwd=0.6913 B20k+B45a=0.7626 B20k+B45a-fwd=0.6858 relM=0.7575 relM-fwd=0.6889
|
| 9 |
+
query-weighted Hit@1 without the 50 largest pools: released=0.7659 rel-fwd=0.6842 inv=0.5472 4M=0.7806 4M-fwd=0.7056 4M+B45a=0.7796 4M+B45a-fwd=0.7074 B45a-for-B30k=0.7808 B45a-for-B30k-fwd=0.7037 B20k+B45a=0.7759 B20k+B45a-fwd=0.6977 relM=0.7735 relM-fwd=0.7011
|
| 10 |
+
query-weighted Hit@1 (all pools): released=0.7384 rel-fwd=0.6539 inv=0.5139 4M=0.7316 4M-fwd=0.6459 4M+B45a=0.7308 4M+B45a-fwd=0.6473 B45a-for-B30k=0.7225 B45a-for-B30k-fwd=0.6444 B20k+B45a=0.7465 B20k+B45a-fwd=0.6674 relM=0.7420 relM-fwd=0.6701
|
| 11 |
+
pool-macro Hit@1: released=0.8210 rel-fwd=0.7519 inv=0.5898 4M=0.8290 4M-fwd=0.7688 4M+B45a=0.8320 4M+B45a-fwd=0.7738 B45a-for-B30k=0.8308 B45a-for-B30k-fwd=0.7723 B20k+B45a=0.8284 B20k+B45a-fwd=0.7652 relM=0.8234 relM-fwd=0.7628
|
| 12 |
+
released vs 4M: pools +53 -80 | macro -0.0080 [-0.0148,-0.0012] | without top 20 -0.0134 [-0.0301,+0.0024] | pool weight min(n,30) -0.0134 [-0.0295,+0.0013] | query-weighted +0.0068 [-0.0407,+0.0683]
|
| 13 |
+
rel-fwd vs 4M: pools +75 -336 | macro -0.0771 [-0.0883,-0.0647] | without top 20 -0.0962 [-0.1180,-0.0740] | pool weight min(n,30) -0.0979 [-0.1192,-0.0760] | query-weighted -0.0777 [-0.1302,-0.0093]
|
| 14 |
+
inv vs 4M: pools +63 -873 | macro -0.2392 [-0.2552,-0.2236] | without top 20 -0.2301 [-0.2604,-0.1996] | pool weight min(n,30) -0.2265 [-0.2530,-0.2005] | query-weighted -0.2177 [-0.2528,-0.1843]
|
| 15 |
+
4M-fwd vs 4M: pools +65 -269 | macro -0.0602 [-0.0706,-0.0496] | without top 20 -0.0739 [-0.0927,-0.0558] | pool weight min(n,30) -0.0779 [-0.0963,-0.0601] | query-weighted -0.0857 [-0.1122,-0.0619]
|
| 16 |
+
4M+B45a vs 4M: pools +25 -15 | macro +0.0030 [-0.0006,+0.0065] | without top 20 -0.0009 [-0.0068,+0.0052] | pool weight min(n,30) -0.0009 [-0.0069,+0.0053] | query-weighted -0.0008 [-0.0060,+0.0046]
|
| 17 |
+
4M+B45a-fwd vs 4M: pools +69 -256 | macro -0.0552 [-0.0662,-0.0452] | without top 20 -0.0722 [-0.0922,-0.0539] | pool weight min(n,30) -0.0769 [-0.0953,-0.0598] | query-weighted -0.0843 [-0.1115,-0.0612]
|
| 18 |
+
B45a-for-B30k vs 4M: pools +34 -28 | macro +0.0018 [-0.0030,+0.0062] | without top 20 +0.0002 [-0.0075,+0.0076] | pool weight min(n,30) -0.0014 [-0.0100,+0.0067] | query-weighted -0.0091 [-0.0308,+0.0054]
|
| 19 |
+
B45a-for-B30k-fwd vs 4M: pools +72 -264 | macro -0.0567 [-0.0670,-0.0464] | without top 20 -0.0756 [-0.0951,-0.0564] | pool weight min(n,30) -0.0800 [-0.0989,-0.0615] | query-weighted -0.0872 [-0.1145,-0.0637]
|
| 20 |
+
B20k+B45a vs 4M: pools +54 -56 | macro -0.0006 [-0.0068,+0.0056] | without top 20 -0.0043 [-0.0161,+0.0083] | pool weight min(n,30) -0.0041 [-0.0170,+0.0090] | query-weighted +0.0149 [-0.0308,+0.0757]
|
| 21 |
+
B20k+B45a-fwd vs 4M: pools +77 -293 | macro -0.0638 [-0.0747,-0.0529] | without top 20 -0.0811 [-0.1016,-0.0621] | pool weight min(n,30) -0.0839 [-0.1037,-0.0658] | query-weighted -0.0642 [-0.1158,+0.0021]
|
| 22 |
+
relM vs 4M: pools +41 -60 | macro -0.0056 [-0.0115,+0.0003] | without top 20 -0.0093 [-0.0214,+0.0025] | pool weight min(n,30) -0.0081 [-0.0204,+0.0040] | query-weighted +0.0104 [-0.0354,+0.0711]
|
| 23 |
+
relM-fwd vs 4M: pools +81 -305 | macro -0.0662 [-0.0771,-0.0546] | without top 20 -0.0780 [-0.0977,-0.0586] | pool weight min(n,30) -0.0804 [-0.0994,-0.0611] | query-weighted -0.0615 [-0.1122,+0.0045]
|
shared/package-files/05/0559700ae3f45d2fe8f3939bf6cdea2e50d015c80c0d704eea6e263bf7b6232e/library_hybrid.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Library neighbours chosen by spectrum AND by the inverse prediction (lab, E71; labels evaluate only)
|
| 2 |
+
|
| 3 |
+
library_hybrid.py [--powers 0,1,2,4] [--k 20]
|
| 4 |
+
|
| 5 |
+
The released library branch lets the 20 train molecules with the most similar spectra vote
|
| 6 |
+
(``s^6``). ``library_oracle.py``: their structures are nearly unrelated to the label. Here a
|
| 7 |
+
library molecule's weight is ``s(q, m)^6 * a(q, m)^r`` with ``a`` = cosine between the pool's
|
| 8 |
+
inverse prediction (``evals/netprop/inv-vectors.npz``: pool mean of the released E64 inverse pair) and
|
| 9 |
+
the molecule's fingerprint; the k heaviest molecules vote as in ``pkg/library.py`` (debiased).
|
| 10 |
+
r = 0 is the released branch. Reported: label Tanimoto of the voters (diagnostic), the branch alone, and
|
| 11 |
+
the released rule (no consensus term) with the new term in place of the library term.
|
| 12 |
+
"""
|
| 13 |
+
import argparse
|
| 14 |
+
import json
|
| 15 |
+
import pickle
|
| 16 |
+
import sys
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
import numpy as np
|
| 20 |
+
import torch
|
| 21 |
+
|
| 22 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 23 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'pkg'))
|
| 24 |
+
import netprop
|
| 25 |
+
import scorelab
|
| 26 |
+
|
| 27 |
+
ROOT = netprop.ROOT
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def main():
|
| 31 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 32 |
+
p.add_argument('--powers', default='0,1,2,4')
|
| 33 |
+
p.add_argument('--k', type=int, default=20)
|
| 34 |
+
p.add_argument('--spower', type=float, default=6.0)
|
| 35 |
+
p.add_argument('--pred', default='evals/fullfold/5Ms-N5-L-ion-net2/pred')
|
| 36 |
+
p.add_argument('--config', default='builds/5Ms-N5-L-ion-net2/model_config.json')
|
| 37 |
+
p.add_argument('--weights', default='0/0.4,0/0.8,0.2/0.4')
|
| 38 |
+
p.add_argument('--threads', type=int, default=8)
|
| 39 |
+
args = p.parse_args()
|
| 40 |
+
torch.set_num_threads(args.threads)
|
| 41 |
+
queries, pools = netprop.load(None)
|
| 42 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 43 |
+
lib = torch.load(ROOT / 'library/train-library.pt', weights_only=False)
|
| 44 |
+
packed_lib = lib['fingerprints'].numpy()
|
| 45 |
+
fps = torch.from_numpy(np.unpackbits(packed_lib, axis=1).astype(np.float32))
|
| 46 |
+
fsum = fps.sum(1)
|
| 47 |
+
sample = fps[lib['prior_sample'].numpy()]
|
| 48 |
+
sim = np.load(ROOT / 'evals/library/sim-full.npy')
|
| 49 |
+
vec = np.load(ROOT / 'evals/netprop/inv-vectors.npz', allow_pickle=True)
|
| 50 |
+
vslot = {pid: n for n, pid in enumerate(vec['pool_id'])}
|
| 51 |
+
vectors, have = vec['vectors'].astype(np.float32), vec['have']
|
| 52 |
+
store = np.load(ROOT / 'inv/pools-validation-input.npz')
|
| 53 |
+
sslot = {pid: n for n, pid in enumerate(store['pool_id'])}
|
| 54 |
+
starts, packed = store['pool_cand_start'], store['cand_fps']
|
| 55 |
+
members = {}
|
| 56 |
+
for i, q in enumerate(queries):
|
| 57 |
+
members.setdefault(q['candidate_pool_id'], []).append(i)
|
| 58 |
+
powers = [float(x) for x in args.powers.split(',')]
|
| 59 |
+
terms = {r: {} for r in powers}
|
| 60 |
+
stat = {r: np.zeros((len(queries), 2)) for r in powers}
|
| 61 |
+
|
| 62 |
+
def tanimoto(a, b, bsum):
|
| 63 |
+
inter = a @ b.T
|
| 64 |
+
return inter / (a.sum(1)[:, None] + bsum[None, :] - inter).clamp_min(1.0)
|
| 65 |
+
|
| 66 |
+
for pid, rows in members.items():
|
| 67 |
+
s = sslot[pid]
|
| 68 |
+
cand = torch.from_numpy(np.unpackbits(packed[starts[s]:starts[s + 1]], axis=1).astype(np.float32))
|
| 69 |
+
v = torch.from_numpy(vectors[vslot[pid]])
|
| 70 |
+
agree = (fps @ v) / (fsum.sqrt() * v.norm()).clamp_min(1e-6) if have[vslot[pid]] else torch.ones(len(fps))
|
| 71 |
+
base = torch.from_numpy(np.maximum(sim[rows], 0.0).astype(np.float64)) ** args.spower # [R, M]
|
| 72 |
+
prior = tanimoto(cand, sample, sample.sum(1)).double().mean(1)
|
| 73 |
+
label = cand[int(ev.target[rows[0]])][None, :]
|
| 74 |
+
for r in powers:
|
| 75 |
+
w = base * (agree.double() ** r)[None, :] if r > 0 else base
|
| 76 |
+
wv, wi = torch.topk(w, args.k, dim=1) # [R, k]
|
| 77 |
+
used, position = np.unique(wi.numpy(), return_inverse=True)
|
| 78 |
+
position = torch.from_numpy(position.reshape(len(rows), -1))
|
| 79 |
+
local = tanimoto(cand, fps[used], fsum[used]).double() # [C, used]
|
| 80 |
+
scale = wv / wv.sum(1, keepdim=True).clamp_min(1e-300)
|
| 81 |
+
score = torch.einsum('cqk,qk->qc', local[:, position], scale) - prior[None, :]
|
| 82 |
+
tl = tanimoto(label, fps[used], fsum[used]).double()[0][position] # [R, k] label Tanimoto of the voters
|
| 83 |
+
for n, i in enumerate(rows):
|
| 84 |
+
terms[r][queries[i]['query_id']] = -score[n].numpy()
|
| 85 |
+
stat[r][i] = (float(tl[n, 0]), float((scale[n] * tl[n]).sum()))
|
| 86 |
+
config = json.load(open(ROOT / args.config))
|
| 87 |
+
pred = {name: pickle.load(open(ROOT / args.pred / f'{name}.pkl', 'rb')) for name in ('distances', 'inverse', 'library', 'ion')}
|
| 88 |
+
dom = ev.domain
|
| 89 |
+
first = np.array([m[0] for m in ev.by_pool.values()])
|
| 90 |
+
sizes, boot = ev.sizes, ev.boot
|
| 91 |
+
hb = ev.ranks(netprop.released(queries, pools, pred, config), 1.0) == 0
|
| 92 |
+
print(f'released rule without consensus: Hit@1 {hb.mean():.4f} domain {hb[dom].mean():.4f} other {hb[~dom].mean():.4f} macro {hb[first].mean():.4f}')
|
| 93 |
+
for r in powers:
|
| 94 |
+
term = [terms[r][q['query_id']] for q in queries]
|
| 95 |
+
single, pooled = ev.ranks(term, 0.0) == 0, ev.ranks(term, 1.0) == 0
|
| 96 |
+
print(f'r {r:g}: label Tanimoto of the heaviest voter {stat[r][:, 0].mean():.3f} (domain {stat[r][dom, 0].mean():.3f} other {stat[r][~dom, 0].mean():.3f}), '
|
| 97 |
+
f'weighted {stat[r][:, 1].mean():.3f} | alone per spectrum {single.mean():.4f} pool mean {pooled.mean():.4f} ({pooled[dom].mean():.4f} / {pooled[~dom].mean():.4f}) '
|
| 98 |
+
f'macro {pooled[first].mean():.4f}', flush=True)
|
| 99 |
+
for w in args.weights.split(','):
|
| 100 |
+
wd, wo = (float(x) for x in w.split('/'))
|
| 101 |
+
c = json.loads(json.dumps(config))
|
| 102 |
+
c['library'].update(weight_domain=wd, weight_other=wo)
|
| 103 |
+
h = ev.ranks(netprop.released(queries, pools, dict(pred, library=terms[r]), c), 1.0) == 0
|
| 104 |
+
d = h[first].astype(float) - hb[first].astype(float)
|
| 105 |
+
per_query = np.sum(d[boot] * sizes[boot], axis=1) / np.sum(sizes[boot], axis=1)
|
| 106 |
+
macro = d[boot].mean(axis=1)
|
| 107 |
+
print(f' library weight {w}: Hit@1 {h.mean():.4f} ({h.mean() - hb.mean():+.4f} [{np.percentile(per_query, 2.5):+.4f}, {np.percentile(per_query, 97.5):+.4f}]) '
|
| 108 |
+
f'macro {h[first].mean():.4f} ({d.mean():+.4f} [{np.percentile(macro, 2.5):+.4f}, {np.percentile(macro, 97.5):+.4f}]) pools +{int((d > 0).sum())} -{int((d < 0).sum())} '
|
| 109 |
+
f'| domain {h[dom].mean():.4f} other {h[~dom].mean():.4f}', flush=True)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|
shared/package-files/05/05ace3abf7b82dc643e601ef503a21d47da830b9ee4c344f308ac6edd44a9caa/swap-I16-w1.0_0.075_0.75.log
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7736 pool-macro 0.8671 Hit@5 0.8776 Hit@20 0.9342 | twin pools 354 (macro 0.7797), others macro 0.8773
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain fps=morgan debias=fold control=none shuffle=None: alone Hit@1 0.4488 (domain 0.4198 / other 0.4779) macro 0.3810
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.8068 (+0.0332 [+0.0157, +0.0566]) macro +0.0112 [+0.0053, +0.0174] pools +76 -38 | no top 20 +0.0246 cap30 +0.0256 [+0.0131, +0.0391] | Hit@5 -0.0025 macro@5 +0.0071 cap30@5 +0.0156
|
| 5 |
+
without consensus term: Hit@1 0.7736 (ref 0.7713; +0.0023 [-0.0057, +0.0100]) macro 0.8671 (+0.0080 [+0.0027, +0.0133]) pools +60 -33 cap30 +0.0034 | Hit@5 0.8776 (-0.0021) Hit@20 0.9342 (-0.0034)
|
| 6 |
+
domain 0.9366 (+0.0052) other 0.6100 (-0.0006) | Orbitrap no energy 0.5718 (-0.0046) | above 850 0.4292 (+0.0147) below 850 0.8521 (-0.0005)
|
| 7 |
+
full rule : Hit@1 0.8068 (ref 0.8022; +0.0047 [-0.0091, +0.0179]) macro 0.8783 (+0.0044 [-0.0003, +0.0095]) pools +46 -31 cap30 +0.0045 | Hit@5 0.8751 (+0.0032) Hit@20 0.9102 (-0.0061)
|
| 8 |
+
domain 0.9412 (+0.0048) other 0.6719 (+0.0045) | Orbitrap no energy 0.6435 (+0.0032) | above 850 0.5169 (-0.0277) below 850 0.8729 (+0.0121)
|
shared/package-files/10/10b9bb13011b8797a2f52fc1c8493a1d3b2ebb5b32488b4494fdf419aa017e0f/check_contrast.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Pipeline check of the decoy term: library groups, decoy validity, loss / gradient scale on I3 100k."""
|
| 2 |
+
import sys, json
|
| 3 |
+
import numpy as np, torch, torch.nn.functional as F
|
| 4 |
+
sys.path.insert(0, '/workspace/research/allcond/pkg'); sys.path.insert(0, '/workspace/research/allcond/inv')
|
| 5 |
+
import inverse, invdata, train_inv
|
| 6 |
+
dev = torch.device('cuda')
|
| 7 |
+
real = invdata.load_padded('/workspace/research/inv/real-train.npz', dev)
|
| 8 |
+
synth = invdata.load_padded('/workspace/research/inv/synth.npz', dev)
|
| 9 |
+
lib = train_inv.isomer_library(real, synth)
|
| 10 |
+
fps, order, start, size = lib
|
| 11 |
+
print('library', fps.shape, 'groups ok:', bool((size >= 1).all()), 'max group', int(size.max()))
|
| 12 |
+
# group integrity: every member of a molecule's group has the same root
|
| 13 |
+
def roots(store):
|
| 14 |
+
mol = store['mol'].cpu().numpy(); first = np.full(store['fps'].shape[0], -1, dtype=np.int64)
|
| 15 |
+
first[mol[::-1]] = np.arange(len(mol))[::-1]; return store['root'].cpu().numpy()[first]
|
| 16 |
+
allroots = torch.from_numpy(np.concatenate([roots(real), roots(synth)])).to(dev)
|
| 17 |
+
m = torch.randint(0, fps.shape[0], (4096,), device=dev)
|
| 18 |
+
j = order[start[m] + (torch.rand(4096, device=dev) * size[m]).long().minimum(size[m] - 1)]
|
| 19 |
+
print('sampled decoys share the formula:', bool((allroots[j] == allroots[m]).all()), '| own index reachable:', bool((order[start[m]:start[m]+1] >= 0).all()) if False else '')
|
| 20 |
+
state = torch.load('/workspace/research/runs/I3-ff512x6-real08/step-0100000-ema.pt', map_location=dev, weights_only=True)
|
| 21 |
+
model = inverse.FormulaFormer(**state['config']).to(dev); model.load_state_dict(state['ema']); model.train()
|
| 22 |
+
gen = torch.Generator(device=dev); gen.manual_seed(5)
|
| 23 |
+
for name, store, off in (('real', real, 0), ('synth', synth, real['fps'].shape[0])):
|
| 24 |
+
index = torch.randint(0, store['root'].shape[0], (512,), device=dev, generator=gen)
|
| 25 |
+
inputs = invdata.batch_of(store, index, dict(peak_drop=0.3, truncate=0.3, min_keep=4, jitter=0.15), gen)
|
| 26 |
+
bits = inverse.unpack_bits(store['fps'][store['mol'][index]])
|
| 27 |
+
with torch.autocast('cuda', dtype=torch.bfloat16):
|
| 28 |
+
logits = model(*inputs)
|
| 29 |
+
bce = F.binary_cross_entropy_with_logits(logits.float(), bits, reduction='none').mean(1).mean()
|
| 30 |
+
for tau in (0.02, 0.05, 0.1):
|
| 31 |
+
nce, first, has = train_inv.contrast_term(logits, bits, store['mol'][index] + off, lib, 31, tau, gen)
|
| 32 |
+
g1 = torch.autograd.grad(bce, [p for p in model.parameters()], retain_graph=True, allow_unused=True)
|
| 33 |
+
g2 = torch.autograd.grad(nce.mean(), [p for p in model.parameters()], retain_graph=True, allow_unused=True)
|
| 34 |
+
n1 = torch.sqrt(sum((g ** 2).sum() for g in g1 if g is not None)).item()
|
| 35 |
+
n2 = torch.sqrt(sum((g ** 2).sum() for g in g2 if g is not None)).item()
|
| 36 |
+
print(f'{name} tau {tau}: bce {bce.item():.4f} grad {n1:.4f} | nce {nce[has].mean().item():.3f} (rows with decoys {has.float().mean().item():.3f}, '
|
| 37 |
+
f'target first {first[has].float().mean().item():.3f}) grad {n2:.4f}')
|
shared/package-files/10/10cedb5835d44c186a5e796f82087acb62bcfacfd2dbe67a761783ef82cba0e1/genstruct-x1-build.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"kept": 313651, "tried": 378580, "failed": 36170, "duplicate": 28759, "seconds": 75.76316340314224}
|
| 2 |
+
{"kept": 435000, "tried": 562347, "failed": 53815, "duplicate": 44886, "seconds": 112.7075513349846}
|
| 3 |
+
{"schema": "allcond-generated-structures/v1", "name": "gen-x1", "structures": 435000, "seed": 0, "heavy_share": 0.5, "heavy_range": "450,1000", "supplied_2d_keys": 456761, "tried": 562347, "failed": 53815, "duplicate": 44886, "mass_percentiles_1_10_50_90_99": [240.0698731385979, 329.113824155818, 512.25358891665, 815.1804832622499, 967.3784052391234], "seconds": 114.15901068598032}
|
shared/package-files/10/10f5c955b4d85e710ebfc7ce8c0795dea9f50553a2ac0b293a47cdc47f638c89/replay-5Ms-N5u48-L-ion-net2-edge2.log
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "loaded", "queries": 246, "pools": 54, "members": 5, "inverse_members": 5, "library": true, "ion": true, "workers": 13}
|
| 2 |
+
{"event": "canonicalized", "unique_candidates": 10259, "unsupported": 81, "seconds": 2.0642331360140815}
|
| 3 |
+
{"event": "planned", "queries": 246, "groups": 148, "molecules": 12710, "simulations": 34115, "seconds": 2.097684508014936}
|
| 4 |
+
{"event": "candidate_store", "pools": 53, "pairs": 10898, "merged_spectra": 215, "seconds": 1.7859268349711783}
|
| 5 |
+
{"event": "intact_ion", "scored": 233, "seconds": 0.009296510019339621}
|
| 6 |
+
{"event": "library", "scored": 228, "search_seconds": 1.3774798110243864, "seconds": 2.4032499460154213}
|
| 7 |
+
{"event": "inverse_annotated", "pools": 53, "pairs": 10898, "formulae": 2194, "unsupported_candidates": 89, "seconds": 5.733902798965573e-05}
|
| 8 |
+
{"event": "inverse", "scored": 239, "seconds": 5.373941712954547}
|
| 9 |
+
/opt/glacier/lib/python3.11/site-packages/torch/nn/modules/transformer.py:508: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. We recommend specifying layout=torch.jagged when constructing a nested tensor, as this layout receives active development, has better operator coverage, and works with torch.compile. (Triggered internally at /pytorch/aten/src/ATen/NestedTensorImpl.cpp:178.)
|
| 10 |
+
output = torch._nested_tensor_from_mask(
|
| 11 |
+
{"event": "simulated", "finished": 34115, "total": 34115, "failed": 0, "seconds": 378.610075783974}
|
| 12 |
+
{"event": "consensus", "scored": 218, "pools": 53, "answers": 490, "search_seconds": 0.029964572982862592, "seconds": 0.47675299702677876}
|
| 13 |
+
{"event": "finished", "queries": 246, "unscored": 0, "directly_scored": 246, "scoring_seconds": 2.1313637019484304, "total_seconds": 409.63333430403145}
|
| 14 |
+
{"event": "measured", "exit_code": 0, "wall_seconds": 411.7, "user_seconds": 519.9, "system_seconds": 11.0, "max_rss_gib": 2.78}
|
| 15 |
+
{"event": "replay_checked", "exit_code": 0, "package_files": 326, "package_unchanged": true, "processes_left": 0, "rankings": 246}
|
shared/package-files/11/11255895994cbd8d3d04ffdc163c6f8129fa67f150f0963c8d7447a7e75b83a0/netprop-released-sub-0_5-1.log
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7629 pool-macro 0.8529 Hit@5 0.8494 Hit@20 0.9284 | twin pools 179 (macro 0.7430), others macro 0.8659
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4032 (domain 0.3339 / other 0.4802) macro 0.2924
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.7962 (+0.0333 [+0.0085, +0.0604]) macro +0.0106 [+0.0030, +0.0189] pools +33 -15 | no top 20 +0.0269 cap30 +0.0261 [+0.0072, +0.0457] | Hit@5 +0.0290 macro@5 +0.0089 cap30@5 +0.0247
|
shared/package-files/11/11a153784e791a7d4efd6835e8e3c4963933d273502212259d71e6337e22ba85/replay-5Ms-I9b-L-edge.log
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "loaded", "queries": 204, "pools": 44, "members": 5, "inverse_members": 1, "library": true, "workers": 13}
|
| 2 |
+
{"event": "canonicalized", "unique_candidates": 10259, "unsupported": 81, "seconds": 1.4050824709702283}
|
| 3 |
+
{"event": "planned", "queries": 204, "groups": 131, "molecules": 12453, "simulations": 32328, "seconds": 1.4296544039971195}
|
| 4 |
+
{"event": "candidate_store", "pools": 44, "pairs": 10025, "seconds": 1.077902405988425}
|
| 5 |
+
{"event": "library", "scored": 197, "search_seconds": 0.9763356070034206, "seconds": 1.6705012149759568}
|
| 6 |
+
{"event": "inverse_annotated", "pools": 44, "pairs": 10025, "formulae": 2002, "unsupported_candidates": 81, "seconds": 5.723000504076481e-05}
|
| 7 |
+
{"event": "inverse", "scored": 201, "seconds": 0.7131240600137971}
|
| 8 |
+
/opt/glacier/lib/python3.11/site-packages/torch/nn/modules/transformer.py:508: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. We recommend specifying layout=torch.jagged when constructing a nested tensor, as this layout receives active development, has better operator coverage, and works with torch.compile. (Triggered internally at /pytorch/aten/src/ATen/NestedTensorImpl.cpp:178.)
|
| 9 |
+
output = torch._nested_tensor_from_mask(
|
| 10 |
+
{"event": "simulated", "finished": 32328, "total": 32328, "failed": 0, "seconds": 177.7333845719695}
|
| 11 |
+
{"event": "finished", "queries": 204, "unscored": 0, "directly_scored": 204, "scoring_seconds": 0.28621415700763464, "total_seconds": 195.41628485900583}
|
| 12 |
+
{"event": "measured", "exit_code": 0, "wall_seconds": 197.2, "user_seconds": 305.8, "system_seconds": 8.6, "max_rss_gib": 2.53}
|
| 13 |
+
{"event": "replay_checked", "exit_code": 0, "package_files": 268, "package_unchanged": true, "processes_left": 0, "rankings": 204}
|
shared/package-files/11/11a2827f83849a0f01821e301ead5baa041c8c381d923948f2d062f242f1fffd/swap-N5-recur-hyb-s10-f5-p48-clip20-w1.0_0.5_0.5.log
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7852 pool-macro 0.8733 Hit@5 0.8846 Hit@20 0.9415 | twin pools 354 (macro 0.7853), others macro 0.8836
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain fps=morgan debias=fold control=none shuffle=None: alone Hit@1 0.4548 (domain 0.4225 / other 0.4873) macro 0.3854
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.7982 (+0.0130 [-0.0020, +0.0277]) macro +0.0092 [+0.0032, +0.0148] pools +67 -36 | no top 20 +0.0155 cap30 +0.0159 [+0.0021, +0.0289] | Hit@5 -0.0194 macro@5 +0.0065 cap30@5 +0.0081
|
| 5 |
+
without consensus term: Hit@1 0.7852 (ref 0.7685; +0.0167 [-0.0017, +0.0391]) macro 0.8733 (+0.0083 [+0.0027, +0.0136]) pools +61 -33 cap30 +0.0096 | Hit@5 0.8846 (+0.0054) Hit@20 0.9415 (+0.0057)
|
| 6 |
+
macro Hit@5 0.9347 (-0.0003 [-0.0038, +0.0035]) pools +22 -23
|
| 7 |
+
macro Hit@20 0.9678 (-0.0009 [-0.0038, +0.0021]) pools +12 -15
|
| 8 |
+
domain 0.9370 (+0.0069) other 0.6327 (+0.0265) | Orbitrap no energy 0.5988 (+0.0291) | above 850 0.4925 (+0.0708) below 850 0.8518 (+0.0044)
|
| 9 |
+
full rule : Hit@1 0.7982 (ref 0.8063; -0.0081 [-0.0251, +0.0083]) macro 0.8825 (+0.0012 [-0.0032, +0.0056]) pools +36 -32 cap30 -0.0063 | Hit@5 0.8652 (-0.0107) Hit@20 0.9358 (+0.0189)
|
| 10 |
+
macro Hit@5 0.9412 (+0.0000 [-0.0035, +0.0038]) pools +21 -21
|
| 11 |
+
macro Hit@20 0.9684 (-0.0012 [-0.0038, +0.0015]) pools +9 -13
|
| 12 |
+
domain 0.9445 (+0.0036) other 0.6513 (-0.0198) | Orbitrap no energy 0.6172 (-0.0253) | above 850 0.5247 (-0.0191) below 850 0.8605 (-0.0056)
|
shared/package-files/11/11f5e5e240b312c8bbea345aad8ff6903a5f2e017cd914ad48de8b6b08f8221c/recipe.json
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"args": {
|
| 3 |
+
"store": "/workspace/research/inv",
|
| 4 |
+
"out": "runs/I17-ff512x6-real08-corpus2+train3-noise10",
|
| 5 |
+
"pools": "pools-validation-input.npz",
|
| 6 |
+
"input": "/workspace/research/validation-input",
|
| 7 |
+
"steps": 50000,
|
| 8 |
+
"batch": 512,
|
| 9 |
+
"real_frac": 0.08,
|
| 10 |
+
"real_balance": 0.5,
|
| 11 |
+
"no_synth": false,
|
| 12 |
+
"target": "",
|
| 13 |
+
"heavy_boost": 1.0,
|
| 14 |
+
"synth_structures": 1.0,
|
| 15 |
+
"extra_store": "inv/selfsim/corpus2+train3.npz",
|
| 16 |
+
"extra_frac": 0.5,
|
| 17 |
+
"heavy_lo": 450.0,
|
| 18 |
+
"heavy_hi": 850.0,
|
| 19 |
+
"lr": 0.0006,
|
| 20 |
+
"weight_decay": 0.0001,
|
| 21 |
+
"warmup": 2000,
|
| 22 |
+
"ema": 0.999,
|
| 23 |
+
"dim": 512,
|
| 24 |
+
"layers": 6,
|
| 25 |
+
"heads": 8,
|
| 26 |
+
"dropout": 0.1,
|
| 27 |
+
"peak_drop": 0.3,
|
| 28 |
+
"truncate": 0.3,
|
| 29 |
+
"min_keep": 4,
|
| 30 |
+
"jitter": 0.15,
|
| 31 |
+
"synth_energy_drop": 0.3,
|
| 32 |
+
"synth_instrument_drop": 0.3,
|
| 33 |
+
"validate_every": 5000,
|
| 34 |
+
"retrieve_every": 10000,
|
| 35 |
+
"retrieve_pools": 0,
|
| 36 |
+
"seed": 1,
|
| 37 |
+
"contrast_weight": 0.0,
|
| 38 |
+
"contrast_k": 31,
|
| 39 |
+
"contrast_tau": 0.05,
|
| 40 |
+
"noise_rate": 1.0,
|
| 41 |
+
"noise_max": 12,
|
| 42 |
+
"noise_scatter": 0.35,
|
| 43 |
+
"noise_shape": 3.0,
|
| 44 |
+
"init": null,
|
| 45 |
+
"max_steps_this_run": 0
|
| 46 |
+
},
|
| 47 |
+
"parameters": 24997832,
|
| 48 |
+
"model": {
|
| 49 |
+
"dim": 512,
|
| 50 |
+
"layers": 6,
|
| 51 |
+
"heads": 8,
|
| 52 |
+
"dropout": 0.1,
|
| 53 |
+
"pair_dim": 64,
|
| 54 |
+
"fp_bits": 4096,
|
| 55 |
+
"max_energy": 200.0
|
| 56 |
+
},
|
| 57 |
+
"real_rows": 194119,
|
| 58 |
+
"synth_rows": 2333477,
|
| 59 |
+
"stores": {
|
| 60 |
+
"gen-x1.manifest.json": null,
|
| 61 |
+
"pools-validation-input.manifest.json": "13490ff1249eca04dc3a23c94838008071da73002c497d5a614d236258301758",
|
| 62 |
+
"real-train.manifest.json": "59912f8d472101e1f789f5f673f8ef2bdcb521e7973fcd9f4db96bc46d8e46c6",
|
| 63 |
+
"real-validation.manifest.json": "ff9c1d5b46543ad3da990c1a3aeaa2e4f68939761224689af930a39671fdb597",
|
| 64 |
+
"synth.manifest.json": "28d43b29c6334a14a568b8f8f412b260ad87934f687903ad927ac57a0f8e20cc"
|
| 65 |
+
},
|
| 66 |
+
"gpu": "NVIDIA H100 80GB HBM3",
|
| 67 |
+
"load_seconds": 13.599964391905814,
|
| 68 |
+
"extra_store": {
|
| 69 |
+
"path": "inv/selfsim/corpus2+train3.npz",
|
| 70 |
+
"rows": 2031301,
|
| 71 |
+
"manifest": {
|
| 72 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 73 |
+
"merged": [
|
| 74 |
+
"inv/selfsim/corpus2.npz",
|
| 75 |
+
"inv/selfsim/train3.npz"
|
| 76 |
+
],
|
| 77 |
+
"parts": [
|
| 78 |
+
{
|
| 79 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 80 |
+
"merged": [
|
| 81 |
+
"inv/selfsim/sub75.npz",
|
| 82 |
+
"inv/selfsim/sub25.npz"
|
| 83 |
+
],
|
| 84 |
+
"parts": [
|
| 85 |
+
{
|
| 86 |
+
"name": "sub75",
|
| 87 |
+
"source": "synth",
|
| 88 |
+
"conditions": "from-rows 2 hash-range 0.25,1 (534 conditions)",
|
| 89 |
+
"bundle": "builds/5Ms-I1+I3x2-L",
|
| 90 |
+
"members": "1,3",
|
| 91 |
+
"structures": 435076,
|
| 92 |
+
"tasks": 651127,
|
| 93 |
+
"failed": 0,
|
| 94 |
+
"rows": 651127,
|
| 95 |
+
"seconds": 635.7592854518443,
|
| 96 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 97 |
+
"floor": 0.02,
|
| 98 |
+
"spectra": 651083,
|
| 99 |
+
"without_peak": 44,
|
| 100 |
+
"mean_annotated_peaks": 15.61580167198345,
|
| 101 |
+
"mean_candidates": 20.62178653319552,
|
| 102 |
+
"ppm": 20.0,
|
| 103 |
+
"floor_da": 0.004,
|
| 104 |
+
"max_peaks": 24,
|
| 105 |
+
"annotate_seconds": 25.62758301384747
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"name": "sub25",
|
| 109 |
+
"source": "synth",
|
| 110 |
+
"conditions": "from-rows 2 hash-range 0,0.25 (485 conditions)",
|
| 111 |
+
"bundle": "builds/5Ms-I1+I3x2-L",
|
| 112 |
+
"members": "1,3",
|
| 113 |
+
"structures": 435076,
|
| 114 |
+
"tasks": 217012,
|
| 115 |
+
"failed": 0,
|
| 116 |
+
"rows": 217012,
|
| 117 |
+
"seconds": 227.74617605702952,
|
| 118 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 119 |
+
"floor": 0.02,
|
| 120 |
+
"spectra": 217000,
|
| 121 |
+
"without_peak": 12,
|
| 122 |
+
"mean_annotated_peaks": 15.62026728110599,
|
| 123 |
+
"mean_candidates": 20.61567563084069,
|
| 124 |
+
"ppm": 20.0,
|
| 125 |
+
"floor_da": 0.004,
|
| 126 |
+
"max_peaks": 24,
|
| 127 |
+
"annotate_seconds": 10.8742212112993
|
| 128 |
+
}
|
| 129 |
+
],
|
| 130 |
+
"spectra": 868083,
|
| 131 |
+
"structures": 434944
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"name": "train3",
|
| 135 |
+
"source": "synth",
|
| 136 |
+
"conditions": "from-train 3 window 2000 seed 0 hash-range 0,1 (301 conditions)",
|
| 137 |
+
"bundle": "builds/5Ms-I1+I3x2-L",
|
| 138 |
+
"members": "1,3",
|
| 139 |
+
"structures": 435076,
|
| 140 |
+
"tasks": 1163260,
|
| 141 |
+
"failed": 0,
|
| 142 |
+
"rows": 1163260,
|
| 143 |
+
"seconds": 1262.926542488858,
|
| 144 |
+
"schema": "allcond-inverse-selfsim/v1",
|
| 145 |
+
"floor": 0.02,
|
| 146 |
+
"spectra": 1163218,
|
| 147 |
+
"without_peak": 42,
|
| 148 |
+
"mean_annotated_peaks": 17.868643710809152,
|
| 149 |
+
"mean_candidates": 25.376552103570997,
|
| 150 |
+
"ppm": 20.0,
|
| 151 |
+
"floor_da": 0.004,
|
| 152 |
+
"max_peaks": 24,
|
| 153 |
+
"annotate_seconds": 43.40271363919601
|
| 154 |
+
}
|
| 155 |
+
],
|
| 156 |
+
"spectra": 2031301,
|
| 157 |
+
"structures": 434950
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
shared/package-files/12/121122cc9f8338004770cf375b124e18081626a3ad4bf0001da96cb3869619ea/netprop-eval-m10t02.log
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7713 pool-macro 0.8591 Hit@5 0.8797 Hit@20 0.9377 | twin pools 354 (macro 0.7429), others macro 0.8727
|
| 2 |
+
|
| 3 |
+
k=10 p=6.0 norm | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4417 (domain 0.4098 / other 0.4737) macro 0.3686
|
| 4 |
+
lam 0.25/0.50: Hit@1 0.7841 (+0.0128 [-0.0155, +0.0410]) macro +0.0106 [+0.0050, +0.0162] pools +69 -33 | no top 20 +0.0192 cap30 +0.0154 [+0.0022, +0.0287] | Hit@5 -0.0121 macro@5 +0.0077 cap30@5 +0.0137 | twin +22 -7 other +47 -26 | dom +0.0006 oth +0.0250
|
| 5 |
+
lam 0.50/0.50: Hit@1 0.7853 (+0.0140 [-0.0138, +0.0416]) macro +0.0118 [+0.0059, +0.0177] pools +76 -36 | no top 20 +0.0206 cap30 +0.0168 [+0.0032, +0.0301] | Hit@5 -0.0138 macro@5 +0.0077 cap30@5 +0.0119 | twin +25 -8 other +51 -28 | dom +0.0032 oth +0.0249
|
| 6 |
+
lam 0.50/0.75: Hit@1 0.7931 (+0.0218 [-0.0074, +0.0528]) macro +0.0130 [+0.0068, +0.0192] pools +83 -39 | no top 20 +0.0210 cap30 +0.0208 [+0.0065, +0.0361] | Hit@5 -0.0118 macro@5 +0.0077 cap30@5 +0.0140 | twin +29 -8 other +54 -31 | dom +0.0029 oth +0.0407
|
| 7 |
+
lam 0.75/0.75: Hit@1 0.7927 (+0.0214 [-0.0081, +0.0523]) macro +0.0124 [+0.0062, +0.0183] pools +82 -40 | no top 20 +0.0205 cap30 +0.0203 [+0.0060, +0.0356] | Hit@5 -0.0124 macro@5 +0.0068 cap30@5 +0.0134 | twin +28 -8 other +54 -32 | dom +0.0026 oth +0.0402
|
| 8 |
+
lam 1.00/1.00: Hit@1 0.7931 (+0.0218 [-0.0089, +0.0533]) macro +0.0127 [+0.0059, +0.0198] pools +94 -51 | no top 20 +0.0174 cap30 +0.0203 [+0.0027, +0.0382] | Hit@5 -0.0078 macro@5 +0.0068 cap30@5 +0.0168 | twin +30 -9 other +64 -42 | dom +0.0034 oth +0.0402
|
shared/package-files/12/121e7b127cf51cc7dfac79468d0c6a1f22b96ac5232abff278367a56fdd12317/swap-N5-recur-hyb-s10-f5-p48-w0.75_0.1_0.5.log
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7772 pool-macro 0.8698 Hit@5 0.8832 Hit@20 0.9416 | twin pools 354 (macro 0.7514), others macro 0.8836
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain fps=morgan debias=fold control=none shuffle=None: alone Hit@1 0.4600 (domain 0.4190 / other 0.5011) macro 0.3842
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.8093 (+0.0320 [+0.0143, +0.0541]) macro +0.0145 [+0.0080, +0.0207] pools +88 -39 | no top 20 +0.0269 cap30 +0.0268 [+0.0128, +0.0411] | Hit@5 -0.0010 macro@5 +0.0059 cap30@5 +0.0146
|
| 5 |
+
without consensus term: Hit@1 0.7772 (ref 0.7685; +0.0087 [+0.0001, +0.0191]) macro 0.8698 (+0.0047 [+0.0015, +0.0083]) pools +27 -11 cap30 +0.0095 | Hit@5 0.8832 (+0.0039) Hit@20 0.9416 (+0.0058)
|
| 6 |
+
domain 0.9329 (+0.0028) other 0.6209 (+0.0147) | Orbitrap no energy 0.5867 (+0.0170) | above 850 0.4514 (+0.0297) below 850 0.8514 (+0.0040)
|
| 7 |
+
full rule : Hit@1 0.8093 (ref 0.8063; +0.0030 [-0.0084, +0.0129]) macro 0.8842 (+0.0030 [+0.0003, +0.0056]) pools +18 -8 cap30 +0.0046 | Hit@5 0.8821 (+0.0063) Hit@20 0.9086 (-0.0082)
|
| 8 |
+
domain 0.9442 (+0.0033) other 0.6737 (+0.0027) | Orbitrap no energy 0.6444 (+0.0020) | above 850 0.5286 (-0.0153) below 850 0.8732 (+0.0071)
|
shared/package-files/12/1256343b32e8b9e5465ff9a2445a6ce93aaf9c45b37eb78f630f9ca13995fcc3/inv_swap.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Swap the inverse branch of the release and compare inside the full rule (lab, E69; labels evaluate only)
|
| 2 |
+
|
| 3 |
+
inv_swap.py prepare --score evals/score/NAME.pkl:pow070 --out evals/fullfold/swap-NAME/pred
|
| 4 |
+
a prediction directory with the released forward / library / ion branch outputs (links) and the
|
| 5 |
+
inverse distances of another network or ensemble (``eval_score.py`` output, validation query order).
|
| 6 |
+
inv_swap.py compare --pred evals/fullfold/swap-NAME/pred --term evals/netprop/term-swap-NAME.pkl
|
| 7 |
+
released rule without and with the consensus term (``netprop.py evaluate --save``) for the swapped
|
| 8 |
+
branch against the release: Hit@1, pool-macro, paired pool bootstrap, pools gained / lost, strata.
|
| 9 |
+
"""
|
| 10 |
+
import argparse
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
import pickle
|
| 14 |
+
import sys
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
import numpy as np
|
| 18 |
+
|
| 19 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 20 |
+
import netprop
|
| 21 |
+
import scorelab
|
| 22 |
+
|
| 23 |
+
ROOT = netprop.ROOT
|
| 24 |
+
REF = 'evals/fullfold/5Ms-I9b+I13-L-ion/pred'
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def prepare(args):
|
| 28 |
+
queries, pools = netprop.load(None)
|
| 29 |
+
path, key = args.score.split(':')
|
| 30 |
+
rows = pickle.load(open(ROOT / path, 'rb'))[key]
|
| 31 |
+
assert len(rows) == len(queries)
|
| 32 |
+
ref = pickle.load(open(ROOT / REF / 'inverse.pkl', 'rb'))
|
| 33 |
+
out = {}
|
| 34 |
+
for q, row in zip(queries, rows):
|
| 35 |
+
if row is None:
|
| 36 |
+
continue
|
| 37 |
+
assert len(row) == len(pools[q['candidate_pool_id']])
|
| 38 |
+
out[q['query_id']] = np.asarray(row, dtype=np.float64)
|
| 39 |
+
assert set(out) == set(ref), (len(out), len(ref))
|
| 40 |
+
target = ROOT / args.out
|
| 41 |
+
target.mkdir(parents=True, exist_ok=True)
|
| 42 |
+
for name in ('distances', 'library', 'ion'):
|
| 43 |
+
link = target / f'{name}.pkl'
|
| 44 |
+
if not link.exists():
|
| 45 |
+
os.symlink((ROOT / REF / f'{name}.pkl').resolve(), link)
|
| 46 |
+
tmp = target / 'inverse.pkl.tmp'
|
| 47 |
+
pickle.dump(out, open(tmp, 'wb'))
|
| 48 |
+
os.replace(tmp, target / 'inverse.pkl')
|
| 49 |
+
print('wrote', target, len(out))
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def rule(queries, pools, pred_dir, term_path, config):
|
| 53 |
+
pred = {name: pickle.load(open(ROOT / pred_dir / f'{name}.pkl', 'rb')) for name in ('distances', 'inverse', 'library', 'ion')}
|
| 54 |
+
base = netprop.released(queries, pools, pred, config)
|
| 55 |
+
if term_path is None:
|
| 56 |
+
return base, None
|
| 57 |
+
term = pickle.load(open(ROOT / term_path, 'rb'))['term']
|
| 58 |
+
term = term[next(iter(term))]
|
| 59 |
+
return base, [b if (b is None or t is None) else b + t for b, t in zip(base, term)]
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def compare(args):
|
| 63 |
+
queries, pools = netprop.load(None)
|
| 64 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 65 |
+
config = json.load(open(ROOT / args.config))
|
| 66 |
+
if args.inverse_weights:
|
| 67 |
+
wd, wo, ws = (float(x) for x in args.inverse_weights.split('/'))
|
| 68 |
+
config = json.loads(json.dumps(config))
|
| 69 |
+
config['inverse'].update(weight_domain=wd, weight_other=wo, weight_other_single=ws)
|
| 70 |
+
ref_base, ref_net = rule(queries, pools, args.ref_pred, args.ref_term, json.load(open(ROOT / (args.ref_config or args.config))))
|
| 71 |
+
new_base, new_net = rule(queries, pools, args.pred, args.term, config)
|
| 72 |
+
first = np.array([m[0] for m in ev.by_pool.values()])
|
| 73 |
+
sizes, boot = ev.sizes, ev.boot
|
| 74 |
+
mz = np.array([float(q['precursor_mz']) for q in queries])
|
| 75 |
+
orbi_ne = np.array([(q.get('instrument_type') == 'Orbitrap') and q.get('collision_energy') is None for q in queries])
|
| 76 |
+
|
| 77 |
+
def report(name, new, ref):
|
| 78 |
+
rn, rr = ev.ranks(new, 1.0), ev.ranks(ref, 1.0)
|
| 79 |
+
hn, hr = rn == 0, rr == 0
|
| 80 |
+
d = hn[first].astype(float) - hr[first].astype(float)
|
| 81 |
+
per_query = np.sum(d[boot] * sizes[boot], axis=1) / np.sum(sizes[boot], axis=1)
|
| 82 |
+
macro = d[boot].mean(axis=1)
|
| 83 |
+
capped = np.minimum(sizes, 30.0)
|
| 84 |
+
print(f'{name}: Hit@1 {hn.mean():.4f} (ref {hr.mean():.4f}; {hn.mean() - hr.mean():+.4f} [{np.percentile(per_query, 2.5):+.4f}, {np.percentile(per_query, 97.5):+.4f}])'
|
| 85 |
+
f' macro {hn[first].mean():.4f} ({d.mean():+.4f} [{np.percentile(macro, 2.5):+.4f}, {np.percentile(macro, 97.5):+.4f}]) pools +{int((d > 0).sum())} -{int((d < 0).sum())}'
|
| 86 |
+
f' cap30 {np.sum(d * capped) / capped.sum():+.4f} | Hit@5 {np.mean(rn < 5):.4f} ({np.mean(rn < 5) - np.mean(rr < 5):+.4f}) Hit@20 {np.mean(rn < 20):.4f} ({np.mean(rn < 20) - np.mean(rr < 20):+.4f})')
|
| 87 |
+
for k in (5, 20):
|
| 88 |
+
dk = (rn < k)[first].astype(float) - (rr < k)[first].astype(float)
|
| 89 |
+
mk = dk[boot].mean(axis=1)
|
| 90 |
+
print(f' macro Hit@{k} {(rn < k)[first].mean():.4f} ({dk.mean():+.4f} [{np.percentile(mk, 2.5):+.4f}, {np.percentile(mk, 97.5):+.4f}]) pools +{int((dk > 0).sum())} -{int((dk < 0).sum())}')
|
| 91 |
+
dom = ev.domain
|
| 92 |
+
print(f' domain {hn[dom].mean():.4f} ({hn[dom].mean() - hr[dom].mean():+.4f}) other {hn[~dom].mean():.4f} ({hn[~dom].mean() - hr[~dom].mean():+.4f})'
|
| 93 |
+
f' | Orbitrap no energy {hn[orbi_ne].mean():.4f} ({hn[orbi_ne].mean() - hr[orbi_ne].mean():+.4f})'
|
| 94 |
+
f' | above 850 {hn[mz >= 850].mean():.4f} ({hn[mz >= 850].mean() - hr[mz >= 850].mean():+.4f}) below 850 {hn[mz < 850].mean():.4f} ({hn[mz < 850].mean() - hr[mz < 850].mean():+.4f})')
|
| 95 |
+
|
| 96 |
+
report('without consensus term', new_base, ref_base)
|
| 97 |
+
if new_net is not None:
|
| 98 |
+
report('full rule ', new_net, ref_net)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def main():
|
| 102 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 103 |
+
sub = p.add_subparsers(dest='cmd', required=True)
|
| 104 |
+
a = sub.add_parser('prepare')
|
| 105 |
+
a.add_argument('--score', required=True)
|
| 106 |
+
a.add_argument('--out', required=True)
|
| 107 |
+
b = sub.add_parser('compare')
|
| 108 |
+
b.add_argument('--pred', required=True)
|
| 109 |
+
b.add_argument('--term')
|
| 110 |
+
b.add_argument('--ref-pred', default=REF)
|
| 111 |
+
b.add_argument('--ref-term', default='evals/netprop/term-m10-half05-ties.pkl')
|
| 112 |
+
b.add_argument('--config', default='builds/5Ms-I9b+I13-L-ion/model_config.json')
|
| 113 |
+
b.add_argument('--inverse-weights', help='DOMAIN/OTHER/OTHER_SINGLE for the swapped branch (default: released)')
|
| 114 |
+
b.add_argument('--ref-config', help='model_config.json of the reference rule (default: --config)')
|
| 115 |
+
args = p.parse_args()
|
| 116 |
+
{'prepare': prepare, 'compare': compare}[args.cmd](args)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
if __name__ == '__main__':
|
| 120 |
+
main()
|
shared/package-files/12/126114bcdaa4ba1980c7d82acf8060756a3db8ec5920747dc10356d746ad6bf8/edge-released.log
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "loaded", "queries": 204, "pools": 44, "members": 2, "inverse_members": 3, "workers": 7}
|
| 2 |
+
{"event": "canonicalized", "unique_candidates": 10259, "unsupported": 81, "seconds": 1.619917642994551}
|
| 3 |
+
{"event": "planned", "queries": 204, "groups": 131, "molecules": 12453, "simulations": 32328, "seconds": 1.659770774000208}
|
| 4 |
+
{"event": "inverse_annotated", "pools": 44, "pairs": 10025, "formulae": 2002, "unsupported_candidates": 81, "seconds": 1.6138801370107103}
|
| 5 |
+
{"event": "inverse", "scored": 201, "seconds": 3.802516915005981}
|
| 6 |
+
/opt/glacier/lib/python3.11/site-packages/torch/nn/modules/transformer.py:508: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. We recommend specifying layout=torch.jagged when constructing a nested tensor, as this layout receives active development, has better operator coverage, and works with torch.compile. (Triggered internally at /pytorch/aten/src/ATen/NestedTensorImpl.cpp:178.)
|
| 7 |
+
output = torch._nested_tensor_from_mask(
|
| 8 |
+
{"event": "simulated", "finished": 32328, "total": 32328, "failed": 0, "seconds": 53.37848803000816}
|
| 9 |
+
{"event": "finished", "queries": 204, "unscored": 0, "directly_scored": 204, "scoring_seconds": 0.629630998999346, "total_seconds": 75.91329967800993}
|
shared/package-files/12/12640a7a4c6499714e0ada64ed2cd459e63edbcd16298b18ac3ea05a3df37b08/missed_pools.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Largest missed pools of a ranking file (lab; labels read for analysis)
|
| 2 |
+
|
| 3 |
+
missed_pools.py evals/fullfold/NAME/rankings.jsonl [--top 25]
|
| 4 |
+
"""
|
| 5 |
+
import argparse
|
| 6 |
+
import json
|
| 7 |
+
import sys
|
| 8 |
+
from collections import Counter
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
import numpy as np
|
| 12 |
+
|
| 13 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 14 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'pkg'))
|
| 15 |
+
import netprop
|
| 16 |
+
import scorelab
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
p = argparse.ArgumentParser()
|
| 21 |
+
p.add_argument('rankings')
|
| 22 |
+
p.add_argument('--top', type=int, default=25)
|
| 23 |
+
args = p.parse_args()
|
| 24 |
+
queries, pools = netprop.load(None)
|
| 25 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 26 |
+
rank = {}
|
| 27 |
+
with open(netprop.ROOT / args.rankings) as f:
|
| 28 |
+
for line in f:
|
| 29 |
+
r = json.loads(line)
|
| 30 |
+
rank[r['query_id']] = r['ranking']
|
| 31 |
+
rows = []
|
| 32 |
+
lost_total = 0
|
| 33 |
+
for pid, members in ev.by_pool.items():
|
| 34 |
+
q = queries[members[0]]
|
| 35 |
+
label = pools[pid][int(ev.target[members[0]])]['candidate_id']
|
| 36 |
+
position = rank[q['query_id']].index(label)
|
| 37 |
+
if position == 0:
|
| 38 |
+
continue
|
| 39 |
+
lost_total += len(members)
|
| 40 |
+
adducts = Counter(queries[i]['adduct'] for i in members).most_common(2)
|
| 41 |
+
inst = Counter(queries[i]['instrument_type'] for i in members).most_common(1)[0][0]
|
| 42 |
+
energy = np.mean([queries[i].get('collision_energy') is not None for i in members])
|
| 43 |
+
peaks = np.median([len(queries[i]['mzs']) for i in members])
|
| 44 |
+
rows.append((len(members), position, len(pools[pid]), float(q['precursor_mz']), adducts, inst, energy, peaks))
|
| 45 |
+
rows.sort(key=lambda r: -r[0])
|
| 46 |
+
print(f'missed pools {len(rows)} of {len(ev.by_pool)}; missed queries {lost_total} of {len(queries)} ({lost_total / len(queries):.4f})')
|
| 47 |
+
sizes = np.array([r[0] for r in rows])
|
| 48 |
+
for low, high in ((1, 1), (2, 5), (6, 20), (21, 100), (101, 10000)):
|
| 49 |
+
m = (sizes >= low) & (sizes <= high)
|
| 50 |
+
print(f' pools with {low}-{high} spectra: {int(m.sum())} missed pools, {int(sizes[m].sum())} queries ({sizes[m].sum() / len(queries):.4f}), label rank 2-5 in {np.mean([r[1] < 5 for r, k in zip(rows, m) if k]) if m.any() else 0:.2f}')
|
| 51 |
+
for r in rows[:args.top]:
|
| 52 |
+
print(f' {r[0]:4d} spectra | label rank {r[1] + 1:3d} of {r[2]:3d} | m/z {r[3]:7.2f} | {r[4]} | {r[5]} | energy recorded {r[6]:.2f} | median peaks {r[7]:.0f}')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
if __name__ == '__main__':
|
| 56 |
+
main()
|
shared/package-files/12/1299c76e62961e85b48e0021dcd9c84b591c9bc1912a50dfc0ada8f9361e8314/scorelab-v5.log
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ind base all=0.4574 dom=0.6851 non=0.1917 h5=0.5803 h20=0.6535 | diff=+0.0000 [+0.0000,+0.0000]
|
| 2 |
+
agg base all=0.6055 dom=0.8131 non=0.3633 h5=0.7327 h20=0.8673 | diff=+0.0000 [+0.0000,+0.0000]
|
| 3 |
+
ind noprec all=0.4825 dom=0.7232 non=0.2018 h5=0.6078 h20=0.6982 | diff=+0.0252 [+0.0129,+0.0370]
|
| 4 |
+
agg noprec all=0.6376 dom=0.8131 non=0.4329 h5=0.7927 h20=0.8747 | diff=+0.0321 [-0.0027,+0.0874]
|
| 5 |
+
ind noprec_pp0.75 all=0.4928 dom=0.7336 non=0.2119 h5=0.6083 h20=0.7000 | diff=+0.0354 [+0.0208,+0.0513]
|
| 6 |
+
agg noprec_pp0.75 all=0.6348 dom=0.8106 non=0.4299 h5=0.7885 h20=0.8756 | diff=+0.0293 [-0.0068,+0.0862]
|
| 7 |
+
ind noprec_pp0.5 all=0.4918 dom=0.7310 non=0.2129 h5=0.6167 h20=0.6865 | diff=+0.0345 [+0.0172,+0.0534]
|
| 8 |
+
agg noprec_pp0.5 all=0.6591 dom=0.8391 non=0.4490 h5=0.7848 h20=0.8752 | diff=+0.0536 [-0.0072,+0.1226]
|
| 9 |
+
ind noprec_pp1.5 all=0.4723 dom=0.7050 non=0.2008 h5=0.5948 h20=0.6945 | diff=+0.0149 [+0.0005,+0.0290]
|
| 10 |
+
agg noprec_pp1.5 all=0.5976 dom=0.7915 non=0.3713 h5=0.7876 h20=0.8836 | diff=-0.0079 [-0.0333,+0.0213]
|
shared/package-files/12/129b950b98313c716efaee637a2d14998af1522f8f2d5bfc98a83347b5db27a4/netprop-neigh-inv-s0.7.log
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7713 pool-macro 0.8591 Hit@5 0.8797 Hit@20 0.9377 | twin pools 354 (macro 0.7429), others macro 0.8727
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4651 (domain 0.4549 / other 0.4754) macro 0.4238
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.7685 (-0.0028 [-0.0356, +0.0288]) macro +0.0021 [-0.0050, +0.0086] pools +73 -66 | no top 20 -0.0023 cap30 -0.0036 [-0.0232, +0.0139] | Hit@5 -0.0408 macro@5 -0.0050 cap30@5 -0.0149
|
| 5 |
+
|
| 6 |
+
k=10 p=2.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4680 (domain 0.4628 / other 0.4732) macro 0.4315
|
| 7 |
+
lam 1.00/1.00: Hit@1 0.7689 (-0.0025 [-0.0352, +0.0289]) macro +0.0024 [-0.0044, +0.0089] pools +71 -63 | no top 20 -0.0020 cap30 -0.0032 [-0.0222, +0.0146] | Hit@5 -0.0392 macro@5 -0.0038 cap30@5 -0.0130
|
| 8 |
+
|
| 9 |
+
k=10 p=1.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4725 (domain 0.4713 / other 0.4736) macro 0.4400
|
| 10 |
+
lam 1.00/1.00: Hit@1 0.7724 (+0.0011 [-0.0324, +0.0328]) macro +0.0027 [-0.0038, +0.0089] pools +69 -60 | no top 20 +0.0020 cap30 +0.0008 [-0.0180, +0.0185] | Hit@5 -0.0378 macro@5 -0.0044 cap30@5 -0.0115
|
shared/package-files/12/12b1c336c44796225178db90fec124f43e30d78b4b4d20f8e14747ddd87e3176/consensus-equivalence-5Ms-N5-L-ion-net.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
distances: largest absolute difference package run - base run 0
|
| 2 |
+
inverse: largest absolute difference package run - base run 0.999
|
| 3 |
+
library: largest absolute difference package run - base run 0
|
| 4 |
+
ion: largest absolute difference package run - base run 0
|
| 5 |
+
consensus term: 19428 queries covered by both, coverage differs for 0, largest absolute difference 4.44e-16
|
| 6 |
+
label rank: package == lab for 19429 / 19429 queries; Hit@1 package 0.8063 lab 0.8063; Hit@5 0.8759 / 0.8759; Hit@20 0.9169 / 0.9169
|
| 7 |
+
per spectrum (no pool mean): base 0.6255 with the term 0.6869
|
shared/package-files/12/12b1c336c44796225178db90fec124f43e30d78b4b4d20f8e14747ddd87e3176/consensus-equivalence-5Ms-N5-L-ion-net2.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
distances: largest absolute difference package run - base run 0
|
| 2 |
+
inverse: largest absolute difference package run - base run 0.999
|
| 3 |
+
library: largest absolute difference package run - base run 0
|
| 4 |
+
ion: largest absolute difference package run - base run 0
|
| 5 |
+
consensus term: 19428 queries covered by both, coverage differs for 0, largest absolute difference 4.44e-16
|
| 6 |
+
label rank: package == lab for 19429 / 19429 queries; Hit@1 package 0.8063 lab 0.8063; Hit@5 0.8759 / 0.8759; Hit@20 0.9169 / 0.9169
|
| 7 |
+
per spectrum (no pool mean): base 0.6255 with the term 0.6869
|
shared/package-files/12/12e6bb59a622cb1cea003a7f8bf56ca2cd037babdfce3d4999afe730ea6aa5f1/inspect2.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Inspect zero-overlap failures with sub-formula explanations (dev only)."""
|
| 2 |
+
import json, sys, hashlib, pickle, re
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import numpy as np
|
| 5 |
+
sys.path.insert(0, '/workspace/research/allcond/pkg'); sys.path.insert(0, '/workspace/research/ms-pred/src')
|
| 6 |
+
import infer
|
| 7 |
+
from ms_pred import common
|
| 8 |
+
MASS = {'C': 12.0, 'H': 1.00782503223, 'N': 14.00307400443, 'O': 15.99491461957, 'S': 31.9720711744, 'P': 30.97376199842,
|
| 9 |
+
'F': 18.99840316273, 'Cl': 34.968852682, 'Br': 78.9183376, 'I': 126.9044719, 'Si': 27.97692653465, 'B': 11.00930536,
|
| 10 |
+
'Se': 79.9165218, 'As': 74.92159457}
|
| 11 |
+
E = 0.000548579909
|
| 12 |
+
def sub_masses(formula):
|
| 13 |
+
comp = {el: int(n or 1) for el, n in re.findall(r'([A-Z][a-z]?)(\d*)', formula)}
|
| 14 |
+
masses = np.zeros(1)
|
| 15 |
+
for el, n in comp.items():
|
| 16 |
+
masses = (masses[:, None] + MASS[el] * np.arange(n + 1)[None, :]).ravel()
|
| 17 |
+
return np.sort(masses)
|
| 18 |
+
root, pred = Path(sys.argv[1]), Path(sys.argv[2])
|
| 19 |
+
labels = {json.loads(l)['query_id']: json.loads(l) for l in open('/workspace/data/validation.jsonl')}
|
| 20 |
+
queries = list(infer.read_jsonl(root / 'queries.jsonl'))
|
| 21 |
+
pools = {r['candidate_pool_id']: r['candidates'] for r in infer.read_jsonl(root / 'candidate_pools.jsonl')}
|
| 22 |
+
inst = lambda name: common.instrument2onehot_pos.get(name or 'Unknown', common.instrument2onehot_pos['Unknown'])
|
| 23 |
+
plan = infer.Plan(queries, pools, 8, inst, set(common.ion2onehot_pos))
|
| 24 |
+
masses = np.load(pred / 'masses.npy', mmap_mode='r'); intens = np.load(pred / 'intens.npy', mmap_mode='r')
|
| 25 |
+
dist = pickle.load(open(pred / 'distances.pkl', 'rb'))
|
| 26 |
+
rng = np.random.default_rng(1)
|
| 27 |
+
seen = set(); shown = 0
|
| 28 |
+
cats = {'explained_frac': [], 'npk': [], 'prec_only': []}
|
| 29 |
+
for qi in rng.permutation(len(queries)):
|
| 30 |
+
q = queries[qi]
|
| 31 |
+
if q['collision_energy'] is not None or q['instrument_type'] != 'Orbitrap': continue
|
| 32 |
+
lab = labels[q['query_id']]
|
| 33 |
+
cands = pools[q['candidate_pool_id']]
|
| 34 |
+
tid = hashlib.sha256(lab['target_smiles'].encode()).hexdigest()
|
| 35 |
+
t = [i for i, c in enumerate(cands) if c['candidate_id'] == tid][0]
|
| 36 |
+
d = dist[q['query_id']]
|
| 37 |
+
if d[t] < 0.999: continue
|
| 38 |
+
task = plan.groups[plan.query_group[qi]]['tasks'][t]
|
| 39 |
+
mz = np.array(q['mzs']); it = np.array(q['intensities'])
|
| 40 |
+
sm = sub_masses(lab['target_formula'])
|
| 41 |
+
shift = (22.989769282 - E) if 'Na' in q['adduct'] else (MASS['H'] - E)
|
| 42 |
+
ions = np.sort(np.concatenate([sm + shift, sm + MASS['H'] - E]))
|
| 43 |
+
j = np.clip(np.searchsorted(ions, mz), 1, len(ions) - 1)
|
| 44 |
+
err = np.minimum(np.abs(mz - ions[j - 1]), np.abs(mz - ions[j]))
|
| 45 |
+
cats['explained_frac'].append(float((it[err < 0.003]).sum() / it.sum())); cats['npk'].append(len(mz))
|
| 46 |
+
cats['prec_only'].append(float(np.all(np.abs(mz - q['precursor_mz']) < 0.5)))
|
| 47 |
+
if q['candidate_pool_id'] in seen or shown >= 8: continue
|
| 48 |
+
seen.add(q['candidate_pool_id']); shown += 1
|
| 49 |
+
pm = np.array(masses[0, task]); pi = np.array(intens[0, task]).astype(float)
|
| 50 |
+
o = np.argsort(-it)[:10]
|
| 51 |
+
print('=' * 60); print(q['adduct'], 'prec', q['precursor_mz'], lab['target_formula'], lab['target_smiles'][:70])
|
| 52 |
+
print(' observed (mz, inten, subformula err mDa):', [(round(float(mz[i]), 4), round(float(it[i]), 2), round(float(err[i]) * 1000, 1)) for i in sorted(o)])
|
| 53 |
+
o = np.argsort(-pi)[:10]
|
| 54 |
+
print(' predicted:', [(round(float(pm[i]), 4), round(float(pi[i]), 2)) for i in sorted(o)])
|
| 55 |
+
for k, v in cats.items(): print(k, 'mean', np.mean(v), 'median', np.median(v), 'n', len(v))
|
| 56 |
+
a = np.array(cats['explained_frac']); print('zero-overlap queries with >50% intensity explained (3 mDa):', (a > 0.5).mean(), ' <10% explained:', (a < 0.1).mean())
|
shared/package-files/14/140c50e98165381502317d74efc7136025bf0595f2339eee93b3d1c2ea39c4b3/fusion_rule.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Sensitivity of the packaged fusion rule on cached validation distances (development only).
|
| 2 |
+
|
| 3 |
+
fusion_rule.py NAME=INVERSE.pkl:KEY[+INVERSE.pkl:KEY...] [NAME=...] [--base NAME] [--grid]
|
| 4 |
+
|
| 5 |
+
The packaged rule (``infer.fuse`` followed by the pool mean):
|
| 6 |
+
|
| 7 |
+
fused(pool) = mean_q simulator(q) + mean_q w(q) * inverse(q)
|
| 8 |
+
w(q) = wd for [M+H]+ spectra with a recorded collision energy
|
| 9 |
+
= max(wn, c / n_spectra) otherwise
|
| 10 |
+
|
| 11 |
+
Each NAME is an inverse model given as one or more ``eval_inv.py`` pickles (several =
|
| 12 |
+
plain mean of their distances, i.e. an inverse ensemble). Reports the simulator alone, the
|
| 13 |
+
inverse alone (pool mean) and the rule for the selected constants and a grid around them,
|
| 14 |
+
with the paired pool bootstrap versus the simulator and non-domain Hit@1 by pool size.
|
| 15 |
+
"""
|
| 16 |
+
import argparse
|
| 17 |
+
import pickle
|
| 18 |
+
import sys
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
|
| 23 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 24 |
+
from fuselab import Lab
|
| 25 |
+
|
| 26 |
+
MEMBERS = ['B20k=/workspace/research/evals/B20k-full/pred/scorelab-v3.pkl',
|
| 27 |
+
'B30k=/workspace/research/evals/B30k-full/pred/scorelab-v5.pkl']
|
| 28 |
+
BINS = ((1, 1), (2, 4), (5, 15), (16, 63), (64, 9999))
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def main():
|
| 32 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 33 |
+
p.add_argument('models', nargs='+')
|
| 34 |
+
p.add_argument('--root', default='/workspace/research/validation-input')
|
| 35 |
+
p.add_argument('--variant', default='noprec_pp0.75')
|
| 36 |
+
p.add_argument('--members', nargs='*', default=MEMBERS)
|
| 37 |
+
p.add_argument('--selected', default='0.75,0.05,0.5')
|
| 38 |
+
p.add_argument('--grid', action='store_true')
|
| 39 |
+
p.add_argument('--versus', help='NAME of the model whose selected rule is the paired-bootstrap base (default: simulator)')
|
| 40 |
+
args = p.parse_args()
|
| 41 |
+
lab = Lab(args.root, args.variant, args.members).setup()
|
| 42 |
+
pools = len(lab.members)
|
| 43 |
+
size = np.array([len(m) for m in lab.members])
|
| 44 |
+
dom = [lab.domain[m] for m in lab.members]
|
| 45 |
+
sim = [lab.matrix(lab.sim, s).mean(0) for s in range(pools)]
|
| 46 |
+
non_domain = np.array([(~d).all() for d in dom])
|
| 47 |
+
base = lab.pool_rule(lambda s: sim[s])
|
| 48 |
+
|
| 49 |
+
def report(name, rank, reference):
|
| 50 |
+
hit = rank == 0
|
| 51 |
+
pool_hit = np.array([hit[m[0]] for m in lab.members])
|
| 52 |
+
cells = []
|
| 53 |
+
for low, high in BINS:
|
| 54 |
+
m = non_domain & (size >= low) & (size <= high)
|
| 55 |
+
cells.append(f'{(pool_hit[m] * size[m]).sum() / size[m].sum():.3f}')
|
| 56 |
+
print(lab.line(name, rank, reference) + ' | non-domain by pool size ' + ' '.join(cells), flush=True)
|
| 57 |
+
|
| 58 |
+
def load(spec):
|
| 59 |
+
parts = []
|
| 60 |
+
for item in spec.split('+'):
|
| 61 |
+
path, key = item.rsplit(':', 1)
|
| 62 |
+
data = pickle.load(open(path, 'rb'))[key]
|
| 63 |
+
parts.append([lab.matrix(data, s) for s in range(pools)])
|
| 64 |
+
return [np.mean([part[s] for part in parts], axis=0) for s in range(pools)]
|
| 65 |
+
|
| 66 |
+
def rule(inv, wd, wn, c):
|
| 67 |
+
def fused(s):
|
| 68 |
+
w = np.where(dom[s], wd, max(wn, c / len(dom[s])))
|
| 69 |
+
return sim[s] + (w[:, None] * inv[s]).mean(0)
|
| 70 |
+
return lab.pool_rule(fused)
|
| 71 |
+
|
| 72 |
+
print('non-domain pool-size bins: ' + ' '.join(f'{a}-{b}' for a, b in BINS))
|
| 73 |
+
print(lab.line('simulator (released forward branch)', base))
|
| 74 |
+
selected = tuple(float(x) for x in args.selected.split(','))
|
| 75 |
+
models = {}
|
| 76 |
+
for spec in args.models:
|
| 77 |
+
name, value = spec.split('=', 1)
|
| 78 |
+
models[name] = load(value)
|
| 79 |
+
reference = base
|
| 80 |
+
if args.versus:
|
| 81 |
+
reference = rule(models[args.versus], *selected)
|
| 82 |
+
for name, inv in models.items():
|
| 83 |
+
print('---', name)
|
| 84 |
+
report(f'{name}: inverse alone (pool mean)', lab.pool_rule(lambda s: inv[s].mean(0)), base)
|
| 85 |
+
report(f'{name}: wd={selected[0]} wn={selected[1]} c={selected[2]}', rule(inv, *selected), reference)
|
| 86 |
+
if not args.grid:
|
| 87 |
+
continue
|
| 88 |
+
wd0, wn0, c0 = selected
|
| 89 |
+
for wd in (0.3, 0.5, 0.6, 0.9, 1.0, 1.25):
|
| 90 |
+
report(f'{name}: wd={wd}', rule(inv, wd, wn0, c0), base)
|
| 91 |
+
for wn in (0.0, 0.02, 0.035, 0.07, 0.1, 0.15):
|
| 92 |
+
report(f'{name}: wn={wn}', rule(inv, wd0, wn, c0), base)
|
| 93 |
+
for c in (0.0, 0.25, 1.0, 2.0):
|
| 94 |
+
report(f'{name}: c={c}', rule(inv, wd0, wn0, c), base)
|
| 95 |
+
report(f'{name}: wn=0 c=0 (domain only)', rule(inv, wd0, 0.0, 0.0), base)
|
| 96 |
+
report(f'{name}: wd=0 (non-domain only)', rule(inv, 0.0, wn0, c0), base)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
if __name__ == '__main__':
|
| 100 |
+
main()
|
shared/package-files/14/1430eeac7ff4da529e00b39c3a058abe74a4f5dbf69ffe9707ae447b9524d7df/validation.jsonl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"step": 5000, "elapsed": 159.4368463968858, "val_loss": 0.03798504603173534, "val_cos": 0.6285174646308354, "val_loss_ema": 0.035821626347001825, "val_cos_ema": 0.6467729985017564}
|
| 2 |
+
{"step": 10000, "elapsed": 310.5557022858411, "val_loss": 0.033269719730483024, "val_cos": 0.67887269684251, "val_loss_ema": 0.032438482097728025, "val_cos_ema": 0.686638024887893, "ind_cos": 0.4086159864120644, "agg_cos": 0.45535024962684645, "ind_nll": 0.27870708734366156, "agg_nll": 0.2551855473776314, "retrieval_seconds": 15.939691528212279}
|
| 3 |
+
{"step": 15000, "elapsed": 479.3448803727515, "val_loss": 0.03283510184078186, "val_cos": 0.68909920968253, "val_loss_ema": 0.031045216982446503, "val_cos_ema": 0.7039999806989552}
|
| 4 |
+
{"step": 20000, "elapsed": 634.2012787316926, "val_loss": 0.031917238046496016, "val_cos": 0.6994428105015377, "val_loss_ema": 0.030351062240416025, "val_cos_ema": 0.7142906418683089, "ind_cos": 0.4696072880745278, "agg_cos": 0.5133048535694066, "ind_nll": 0.36126408976272584, "agg_nll": 0.3542127747182047, "retrieval_seconds": 16.779075880069286}
|
| 5 |
+
{"step": 25000, "elapsed": 808.2070019226521, "val_loss": 0.03156954907519345, "val_cos": 0.7080652507004671, "val_loss_ema": 0.030508682727691007, "val_cos_ema": 0.7174829668279377}
|
| 6 |
+
{"step": 30000, "elapsed": 969.49993793061, "val_loss": 0.031984809374034945, "val_cos": 0.7082619931867312, "val_loss_ema": 0.030744728238775637, "val_cos_ema": 0.7184512484760217, "ind_cos": 0.4821143651242987, "agg_cos": 0.5330176540223377, "ind_nll": 0.38478562972875596, "agg_nll": 0.37423439188841423, "retrieval_seconds": 17.300428166985512}
|
| 7 |
+
{"step": 35000, "elapsed": 1158.2591622639447, "val_loss": 0.03171259482329391, "val_cos": 0.7140220168124164, "val_loss_ema": 0.030994197541720416, "val_cos_ema": 0.7199540031975398}
|
| 8 |
+
{"step": 40000, "elapsed": 1299.0981366955675, "val_loss": 0.031872882398306615, "val_cos": 0.7161092878437194, "val_loss_ema": 0.031333974781023614, "val_cos_ema": 0.7194546703401649, "ind_cos": 0.48509959339132225, "agg_cos": 0.5305985897369911, "ind_nll": 0.39430747851150344, "agg_nll": 0.3822636265376499, "retrieval_seconds": 12.715768855065107}
|
| 9 |
+
{"step": 45000, "elapsed": 1405.196320829913, "val_loss": 0.031078219837116273, "val_cos": 0.7219372483827333, "val_loss_ema": 0.031063084742493904, "val_cos_ema": 0.721944153281258}
|
| 10 |
+
{"step": 50000, "elapsed": 1497.6725360290147, "val_loss": 0.0312791907098291, "val_cos": 0.7212922718013344, "val_loss_ema": 0.031130075295185355, "val_cos_ema": 0.7220687241848526, "ind_cos": 0.4890627412630604, "agg_cos": 0.5365175768181584, "ind_nll": 0.39770446240156465, "agg_nll": 0.39312368109526996, "retrieval_seconds": 13.11741911014542}
|
shared/package-files/14/143891692e5ef02133824bcde29064d730aeac6542f790fe77f7cab759576ea7/release_pools.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Missed pools of a released package by size (lab, E65; validation labels: analysis only)
|
| 2 |
+
|
| 3 |
+
release_pools.py --pred evals/fullfold/NAME/pred --rankings evals/fullfold/NAME/rankings.jsonl [--top 40]
|
| 4 |
+
|
| 5 |
+
A pool = all validation spectra of one molecule (they share the candidate pool); the pool rule gives
|
| 6 |
+
them one ranking. Prints the lost share by pool size and, for the largest missed pools, the
|
| 7 |
+
pool-mean rank of the target under each branch alone, the formula / similarity of the wrong top-1.
|
| 8 |
+
"""
|
| 9 |
+
import argparse
|
| 10 |
+
import json
|
| 11 |
+
import pickle
|
| 12 |
+
import sys
|
| 13 |
+
from collections import Counter
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
from rdkit import Chem, DataStructs, RDLogger
|
| 18 |
+
from rdkit.Chem import AllChem, rdMolDescriptors
|
| 19 |
+
|
| 20 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 21 |
+
import scorelab
|
| 22 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'pkg'))
|
| 23 |
+
import infer
|
| 24 |
+
|
| 25 |
+
RDLogger.DisableLog('rdApp.*')
|
| 26 |
+
ROOT = Path('/workspace/research')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def fp(smiles):
|
| 30 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 31 |
+
return None if mol is None else (AllChem.GetMorganFingerprintAsBitVect(mol, 2, 2048), rdMolDescriptors.CalcMolFormula(mol))
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def main():
|
| 35 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 36 |
+
p.add_argument('--pred', required=True)
|
| 37 |
+
p.add_argument('--rankings', required=True)
|
| 38 |
+
p.add_argument('--top', type=int, default=40)
|
| 39 |
+
p.add_argument('--save')
|
| 40 |
+
args = p.parse_args()
|
| 41 |
+
root = ROOT / 'validation-input'
|
| 42 |
+
queries = list(infer.read_jsonl(root / 'queries.jsonl'))
|
| 43 |
+
pools = {r['candidate_pool_id']: r['candidates'] for r in infer.read_jsonl(root / 'candidate_pools.jsonl')}
|
| 44 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 45 |
+
n_all = len(queries)
|
| 46 |
+
branch = {name: pickle.load(open(ROOT / args.pred / f'{name}.pkl', 'rb')) for name in ('distances', 'inverse', 'library', 'ion')}
|
| 47 |
+
top = {}
|
| 48 |
+
rank = np.full(n_all, 10 ** 6)
|
| 49 |
+
index = {q['query_id']: i for i, q in enumerate(queries)}
|
| 50 |
+
for line in open(ROOT / args.rankings):
|
| 51 |
+
row = json.loads(line)
|
| 52 |
+
i = index[row['query_id']]
|
| 53 |
+
ids = ev.ids[queries[i]['candidate_pool_id']]
|
| 54 |
+
order = row.get('ranked_candidate_ids') or row.get('ranking') or row.get('candidates')
|
| 55 |
+
top[i] = order[:5]
|
| 56 |
+
rank[i] = order.index(ids[ev.target[i]])
|
| 57 |
+
print(f'queries {n_all} Hit@1 {np.mean(rank == 0):.4f} Hit@5 {np.mean(rank < 5):.4f} Hit@20 {np.mean(rank < 20):.4f}')
|
| 58 |
+
print('rank classes (share of all): 1 %.4f | 2 %.4f | 3-5 %.4f | 6-20 %.4f | beyond %.4f' % (
|
| 59 |
+
np.mean(rank == 0), np.mean(rank == 1), np.mean((rank >= 2) & (rank < 5)), np.mean((rank >= 5) & (rank < 20)), np.mean(rank >= 20)))
|
| 60 |
+
mz = np.array([float(q['precursor_mz']) for q in queries])
|
| 61 |
+
adduct = np.array([q['adduct'] for q in queries])
|
| 62 |
+
energy = np.array([q.get('collision_energy') is not None for q in queries])
|
| 63 |
+
rows = []
|
| 64 |
+
for pid, members in ev.by_pool.items():
|
| 65 |
+
members = np.array(members)
|
| 66 |
+
r = rank[members]
|
| 67 |
+
own = {}
|
| 68 |
+
for name, pred in branch.items():
|
| 69 |
+
vals = [pred.get(queries[i]['query_id']) for i in members]
|
| 70 |
+
vals = [v for v in vals if v is not None]
|
| 71 |
+
if not vals:
|
| 72 |
+
own[name] = -1
|
| 73 |
+
continue
|
| 74 |
+
mean = np.mean(vals, axis=0)
|
| 75 |
+
order = np.lexsort((ev.ids[pid], mean))
|
| 76 |
+
own[name] = int(np.where(order == ev.target[members[0]])[0][0])
|
| 77 |
+
rows.append({'pool': pid, 'size': len(members), 'missed': int((r > 0).sum()), 'rank': int(np.median(r)), 'mz': float(np.median(mz[members])),
|
| 78 |
+
'na': float(np.mean(adduct[members] == '[M+Na]+')), 'energy': float(np.mean(energy[members])), 'cands': len(pools[pid]),
|
| 79 |
+
'own': own, 'first': int(members[0])})
|
| 80 |
+
print('\nby pool size: pools | queries | Hit@1 | lost share | missed pools | top-5 among missed')
|
| 81 |
+
for lo, hi in ((1, 2), (2, 5), (5, 20), (20, 50), (50, 100), (100, 10 ** 6)):
|
| 82 |
+
sel = [r for r in rows if lo <= r['size'] < hi]
|
| 83 |
+
q = sum(r['size'] for r in sel)
|
| 84 |
+
miss = sum(r['missed'] for r in sel)
|
| 85 |
+
missed = [r for r in sel if r['missed'] > r['size'] / 2]
|
| 86 |
+
print(f' [{lo},{hi}) {len(sel):5d} | {q:6d} | {1 - miss / q:.4f} | {miss / n_all:.4f} | {len(missed):4d} | '
|
| 87 |
+
f'{np.mean([r["rank"] < 5 for r in missed]) if missed else float("nan"):.3f}')
|
| 88 |
+
missed = sorted([r for r in rows if r['missed'] > 0], key=lambda r: -r['missed'])
|
| 89 |
+
cum = np.cumsum([r['missed'] for r in missed]) / n_all
|
| 90 |
+
print(f'\nmissed pools {len(missed)}; lost share in the largest 10 / 25 / 50 / 100 / 200: ' + ' / '.join(f'{cum[min(k, len(cum)) - 1]:.4f}' for k in (10, 25, 50, 100, 200)))
|
| 91 |
+
print('\nlargest missed pools: size | missed | rank | m/z | Na share | energy share | cands | alone F / I / L / ion | top-1 same formula | Tanimoto top-1 | isomers in pool')
|
| 92 |
+
stats = Counter()
|
| 93 |
+
detail = []
|
| 94 |
+
for r in missed[:args.top if args.top > 0 else len(missed)]:
|
| 95 |
+
i = r['first']
|
| 96 |
+
cands = pools[r['pool']]
|
| 97 |
+
by_id = {c['candidate_id']: c['smiles'] for c in cands}
|
| 98 |
+
target = fp(by_id[ev.ids[r['pool']][ev.target[i]]])
|
| 99 |
+
first = fp(by_id[top[i][0]])
|
| 100 |
+
same = int(first is not None and target is not None and first[1] == target[1])
|
| 101 |
+
tani = DataStructs.TanimotoSimilarity(first[0], target[0]) if first and target else float('nan')
|
| 102 |
+
formulas = Counter()
|
| 103 |
+
for c in cands:
|
| 104 |
+
f = fp(c['smiles'])
|
| 105 |
+
formulas[f[1] if f else '?'] += 1
|
| 106 |
+
iso = formulas[target[1]] if target else 0
|
| 107 |
+
own = r['own']
|
| 108 |
+
r.update(same=same, tanimoto=tani, isomers=iso)
|
| 109 |
+
detail.append(r)
|
| 110 |
+
print(f" {r['size']:4d} | {r['missed']:4d} | {r['rank'] + 1:4d} | {r['mz']:7.2f} | {r['na']:.2f} | {r['energy']:.2f} | {r['cands']:3d} | "
|
| 111 |
+
f"{own['distances'] + 1:3d} / {own['inverse'] + 1:3d} / {own['library'] + 1:3d} / {own['ion'] + 1:3d} | {same} | {tani:.2f} | {iso}")
|
| 112 |
+
if args.save:
|
| 113 |
+
json.dump(detail, open(ROOT / args.save, 'w'))
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == '__main__':
|
| 117 |
+
main()
|
shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net-val-sub.report.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.7647880763856544,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.5968397927995166,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 25 |
+
"hit_rate_at_20": 0.8984629715882627,
|
| 26 |
+
"hit_rate_at_5": 0.8528178854215184
|
| 27 |
+
},
|
| 28 |
+
"paired_baseline_delta": {
|
| 29 |
+
"confidence": 0.95,
|
| 30 |
+
"estimate": 0.0055891942244993015,
|
| 31 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 32 |
+
"lower": -0.0004286552025327156,
|
| 33 |
+
"molecule_groups": 413,
|
| 34 |
+
"queries": 2147,
|
| 35 |
+
"resamples": 2000,
|
| 36 |
+
"seed": 0,
|
| 37 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 38 |
+
"upper": 0.01210618751997078
|
| 39 |
+
},
|
| 40 |
+
"queries": 2147,
|
| 41 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 42 |
+
"strata": {
|
| 43 |
+
"adduct": {
|
| 44 |
+
"[M+H]+": {
|
| 45 |
+
"hit_rate_at_1": 0.8244873341375151,
|
| 46 |
+
"queries": 1658
|
| 47 |
+
},
|
| 48 |
+
"[M+Na]+": {
|
| 49 |
+
"hit_rate_at_1": 0.5623721881390593,
|
| 50 |
+
"queries": 489
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"candidate_pool_size": {
|
| 54 |
+
"129-256": {
|
| 55 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 56 |
+
"queries": 2147
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"collision_energy": {
|
| 60 |
+
"20-39.999": {
|
| 61 |
+
"hit_rate_at_1": 0.927734375,
|
| 62 |
+
"queries": 512
|
| 63 |
+
},
|
| 64 |
+
"40-59.999": {
|
| 65 |
+
"hit_rate_at_1": 0.903954802259887,
|
| 66 |
+
"queries": 177
|
| 67 |
+
},
|
| 68 |
+
"<20": {
|
| 69 |
+
"hit_rate_at_1": 0.6622516556291391,
|
| 70 |
+
"queries": 151
|
| 71 |
+
},
|
| 72 |
+
">=60": {
|
| 73 |
+
"hit_rate_at_1": 0.9540229885057471,
|
| 74 |
+
"queries": 348
|
| 75 |
+
},
|
| 76 |
+
"missing": {
|
| 77 |
+
"hit_rate_at_1": 0.5995828988529719,
|
| 78 |
+
"queries": 959
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
"instrument_type": {
|
| 82 |
+
"": {
|
| 83 |
+
"hit_rate_at_1": 0.7714285714285715,
|
| 84 |
+
"queries": 35
|
| 85 |
+
},
|
| 86 |
+
"Orbitrap": {
|
| 87 |
+
"hit_rate_at_1": 0.7759358288770053,
|
| 88 |
+
"queries": 1870
|
| 89 |
+
},
|
| 90 |
+
"QTOF": {
|
| 91 |
+
"hit_rate_at_1": 0.6776859504132231,
|
| 92 |
+
"queries": 242
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"routing_domain": {
|
| 96 |
+
"fallback": {
|
| 97 |
+
"hit_rate_at_1": 0.5993945509586277,
|
| 98 |
+
"queries": 991
|
| 99 |
+
},
|
| 100 |
+
"glacier_released": {
|
| 101 |
+
"hit_rate_at_1": 0.9065743944636678,
|
| 102 |
+
"queries": 1156
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
"uncertainty": {
|
| 107 |
+
"confidence": 0.95,
|
| 108 |
+
"estimate": 0.7647880763856544,
|
| 109 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 110 |
+
"lower": 0.6640621247089459,
|
| 111 |
+
"molecule_groups": 413,
|
| 112 |
+
"queries": 2147,
|
| 113 |
+
"resamples": 2000,
|
| 114 |
+
"seed": 0,
|
| 115 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 116 |
+
"upper": 0.8615961684824949
|
| 117 |
+
},
|
| 118 |
+
"valid_rankings": 2147
|
| 119 |
+
}
|
shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net-val-sub.score.log
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.7647880763856544,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.5968397927995166,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 25 |
+
"hit_rate_at_20": 0.8984629715882627,
|
| 26 |
+
"hit_rate_at_5": 0.8528178854215184
|
| 27 |
+
},
|
| 28 |
+
"paired_baseline_delta": {
|
| 29 |
+
"confidence": 0.95,
|
| 30 |
+
"estimate": 0.0055891942244993015,
|
| 31 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 32 |
+
"lower": -0.0004286552025327156,
|
| 33 |
+
"molecule_groups": 413,
|
| 34 |
+
"queries": 2147,
|
| 35 |
+
"resamples": 2000,
|
| 36 |
+
"seed": 0,
|
| 37 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 38 |
+
"upper": 0.01210618751997078
|
| 39 |
+
},
|
| 40 |
+
"queries": 2147,
|
| 41 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 42 |
+
"strata": {
|
| 43 |
+
"adduct": {
|
| 44 |
+
"[M+H]+": {
|
| 45 |
+
"hit_rate_at_1": 0.8244873341375151,
|
| 46 |
+
"queries": 1658
|
| 47 |
+
},
|
| 48 |
+
"[M+Na]+": {
|
| 49 |
+
"hit_rate_at_1": 0.5623721881390593,
|
| 50 |
+
"queries": 489
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"candidate_pool_size": {
|
| 54 |
+
"129-256": {
|
| 55 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 56 |
+
"queries": 2147
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"collision_energy": {
|
| 60 |
+
"20-39.999": {
|
| 61 |
+
"hit_rate_at_1": 0.927734375,
|
| 62 |
+
"queries": 512
|
| 63 |
+
},
|
| 64 |
+
"40-59.999": {
|
| 65 |
+
"hit_rate_at_1": 0.903954802259887,
|
| 66 |
+
"queries": 177
|
| 67 |
+
},
|
| 68 |
+
"<20": {
|
| 69 |
+
"hit_rate_at_1": 0.6622516556291391,
|
| 70 |
+
"queries": 151
|
| 71 |
+
},
|
| 72 |
+
">=60": {
|
| 73 |
+
"hit_rate_at_1": 0.9540229885057471,
|
| 74 |
+
"queries": 348
|
| 75 |
+
},
|
| 76 |
+
"missing": {
|
| 77 |
+
"hit_rate_at_1": 0.5995828988529719,
|
| 78 |
+
"queries": 959
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
"instrument_type": {
|
| 82 |
+
"": {
|
| 83 |
+
"hit_rate_at_1": 0.7714285714285715,
|
| 84 |
+
"queries": 35
|
| 85 |
+
},
|
| 86 |
+
"Orbitrap": {
|
| 87 |
+
"hit_rate_at_1": 0.7759358288770053,
|
| 88 |
+
"queries": 1870
|
| 89 |
+
},
|
| 90 |
+
"QTOF": {
|
| 91 |
+
"hit_rate_at_1": 0.6776859504132231,
|
| 92 |
+
"queries": 242
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"routing_domain": {
|
| 96 |
+
"fallback": {
|
| 97 |
+
"hit_rate_at_1": 0.5993945509586277,
|
| 98 |
+
"queries": 991
|
| 99 |
+
},
|
| 100 |
+
"glacier_released": {
|
| 101 |
+
"hit_rate_at_1": 0.9065743944636678,
|
| 102 |
+
"queries": 1156
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
"uncertainty": {
|
| 107 |
+
"confidence": 0.95,
|
| 108 |
+
"estimate": 0.7647880763856544,
|
| 109 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 110 |
+
"lower": 0.6640621247089459,
|
| 111 |
+
"molecule_groups": 413,
|
| 112 |
+
"queries": 2147,
|
| 113 |
+
"resamples": 2000,
|
| 114 |
+
"seed": 0,
|
| 115 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 116 |
+
"upper": 0.8615961684824949
|
| 117 |
+
},
|
| 118 |
+
"valid_rankings": 2147
|
| 119 |
+
}
|
shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net2-val-sub.report.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.7647880763856544,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.5968397927995166,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 25 |
+
"hit_rate_at_20": 0.8984629715882627,
|
| 26 |
+
"hit_rate_at_5": 0.8528178854215184
|
| 27 |
+
},
|
| 28 |
+
"paired_baseline_delta": {
|
| 29 |
+
"confidence": 0.95,
|
| 30 |
+
"estimate": 0.0055891942244993015,
|
| 31 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 32 |
+
"lower": -0.0004286552025327156,
|
| 33 |
+
"molecule_groups": 413,
|
| 34 |
+
"queries": 2147,
|
| 35 |
+
"resamples": 2000,
|
| 36 |
+
"seed": 0,
|
| 37 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 38 |
+
"upper": 0.01210618751997078
|
| 39 |
+
},
|
| 40 |
+
"queries": 2147,
|
| 41 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 42 |
+
"strata": {
|
| 43 |
+
"adduct": {
|
| 44 |
+
"[M+H]+": {
|
| 45 |
+
"hit_rate_at_1": 0.8244873341375151,
|
| 46 |
+
"queries": 1658
|
| 47 |
+
},
|
| 48 |
+
"[M+Na]+": {
|
| 49 |
+
"hit_rate_at_1": 0.5623721881390593,
|
| 50 |
+
"queries": 489
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"candidate_pool_size": {
|
| 54 |
+
"129-256": {
|
| 55 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 56 |
+
"queries": 2147
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"collision_energy": {
|
| 60 |
+
"20-39.999": {
|
| 61 |
+
"hit_rate_at_1": 0.927734375,
|
| 62 |
+
"queries": 512
|
| 63 |
+
},
|
| 64 |
+
"40-59.999": {
|
| 65 |
+
"hit_rate_at_1": 0.903954802259887,
|
| 66 |
+
"queries": 177
|
| 67 |
+
},
|
| 68 |
+
"<20": {
|
| 69 |
+
"hit_rate_at_1": 0.6622516556291391,
|
| 70 |
+
"queries": 151
|
| 71 |
+
},
|
| 72 |
+
">=60": {
|
| 73 |
+
"hit_rate_at_1": 0.9540229885057471,
|
| 74 |
+
"queries": 348
|
| 75 |
+
},
|
| 76 |
+
"missing": {
|
| 77 |
+
"hit_rate_at_1": 0.5995828988529719,
|
| 78 |
+
"queries": 959
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
"instrument_type": {
|
| 82 |
+
"": {
|
| 83 |
+
"hit_rate_at_1": 0.7714285714285715,
|
| 84 |
+
"queries": 35
|
| 85 |
+
},
|
| 86 |
+
"Orbitrap": {
|
| 87 |
+
"hit_rate_at_1": 0.7759358288770053,
|
| 88 |
+
"queries": 1870
|
| 89 |
+
},
|
| 90 |
+
"QTOF": {
|
| 91 |
+
"hit_rate_at_1": 0.6776859504132231,
|
| 92 |
+
"queries": 242
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"routing_domain": {
|
| 96 |
+
"fallback": {
|
| 97 |
+
"hit_rate_at_1": 0.5993945509586277,
|
| 98 |
+
"queries": 991
|
| 99 |
+
},
|
| 100 |
+
"glacier_released": {
|
| 101 |
+
"hit_rate_at_1": 0.9065743944636678,
|
| 102 |
+
"queries": 1156
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
"uncertainty": {
|
| 107 |
+
"confidence": 0.95,
|
| 108 |
+
"estimate": 0.7647880763856544,
|
| 109 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 110 |
+
"lower": 0.6640621247089459,
|
| 111 |
+
"molecule_groups": 413,
|
| 112 |
+
"queries": 2147,
|
| 113 |
+
"resamples": 2000,
|
| 114 |
+
"seed": 0,
|
| 115 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 116 |
+
"upper": 0.8615961684824949
|
| 117 |
+
},
|
| 118 |
+
"valid_rankings": 2147
|
| 119 |
+
}
|
shared/package-files/14/14c7984c850f4dbbadd26d8da8728c2e9364736e776e7f0e6558f6d574d3d65b/replay-5Ms-N5-L-ion-net2-val-sub.score.log
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.7647880763856544,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.5968397927995166,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 25 |
+
"hit_rate_at_20": 0.8984629715882627,
|
| 26 |
+
"hit_rate_at_5": 0.8528178854215184
|
| 27 |
+
},
|
| 28 |
+
"paired_baseline_delta": {
|
| 29 |
+
"confidence": 0.95,
|
| 30 |
+
"estimate": 0.0055891942244993015,
|
| 31 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 32 |
+
"lower": -0.0004286552025327156,
|
| 33 |
+
"molecule_groups": 413,
|
| 34 |
+
"queries": 2147,
|
| 35 |
+
"resamples": 2000,
|
| 36 |
+
"seed": 0,
|
| 37 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 38 |
+
"upper": 0.01210618751997078
|
| 39 |
+
},
|
| 40 |
+
"queries": 2147,
|
| 41 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 42 |
+
"strata": {
|
| 43 |
+
"adduct": {
|
| 44 |
+
"[M+H]+": {
|
| 45 |
+
"hit_rate_at_1": 0.8244873341375151,
|
| 46 |
+
"queries": 1658
|
| 47 |
+
},
|
| 48 |
+
"[M+Na]+": {
|
| 49 |
+
"hit_rate_at_1": 0.5623721881390593,
|
| 50 |
+
"queries": 489
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"candidate_pool_size": {
|
| 54 |
+
"129-256": {
|
| 55 |
+
"hit_rate_at_1": 0.7647880763856544,
|
| 56 |
+
"queries": 2147
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"collision_energy": {
|
| 60 |
+
"20-39.999": {
|
| 61 |
+
"hit_rate_at_1": 0.927734375,
|
| 62 |
+
"queries": 512
|
| 63 |
+
},
|
| 64 |
+
"40-59.999": {
|
| 65 |
+
"hit_rate_at_1": 0.903954802259887,
|
| 66 |
+
"queries": 177
|
| 67 |
+
},
|
| 68 |
+
"<20": {
|
| 69 |
+
"hit_rate_at_1": 0.6622516556291391,
|
| 70 |
+
"queries": 151
|
| 71 |
+
},
|
| 72 |
+
">=60": {
|
| 73 |
+
"hit_rate_at_1": 0.9540229885057471,
|
| 74 |
+
"queries": 348
|
| 75 |
+
},
|
| 76 |
+
"missing": {
|
| 77 |
+
"hit_rate_at_1": 0.5995828988529719,
|
| 78 |
+
"queries": 959
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
"instrument_type": {
|
| 82 |
+
"": {
|
| 83 |
+
"hit_rate_at_1": 0.7714285714285715,
|
| 84 |
+
"queries": 35
|
| 85 |
+
},
|
| 86 |
+
"Orbitrap": {
|
| 87 |
+
"hit_rate_at_1": 0.7759358288770053,
|
| 88 |
+
"queries": 1870
|
| 89 |
+
},
|
| 90 |
+
"QTOF": {
|
| 91 |
+
"hit_rate_at_1": 0.6776859504132231,
|
| 92 |
+
"queries": 242
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"routing_domain": {
|
| 96 |
+
"fallback": {
|
| 97 |
+
"hit_rate_at_1": 0.5993945509586277,
|
| 98 |
+
"queries": 991
|
| 99 |
+
},
|
| 100 |
+
"glacier_released": {
|
| 101 |
+
"hit_rate_at_1": 0.9065743944636678,
|
| 102 |
+
"queries": 1156
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
"uncertainty": {
|
| 107 |
+
"confidence": 0.95,
|
| 108 |
+
"estimate": 0.7647880763856544,
|
| 109 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 110 |
+
"lower": 0.6640621247089459,
|
| 111 |
+
"molecule_groups": 413,
|
| 112 |
+
"queries": 2147,
|
| 113 |
+
"resamples": 2000,
|
| 114 |
+
"seed": 0,
|
| 115 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 116 |
+
"upper": 0.8615961684824949
|
| 117 |
+
},
|
| 118 |
+
"valid_rankings": 2147
|
| 119 |
+
}
|
shared/package-files/1c/1c06df17bd17c3cd374ae9966cd2693cbe07985405904fa5b7cc79379346a442/train-decoys-audit.log
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
validation candidates 863339, with the fingerprint of a train label: 2011 (0.0023)
|
| 2 |
+
pools with at least one train-label candidate: 0.192 of pools, 0.184 of queries; median count in those pools 1, mean 3.1
|
| 3 |
+
target carries a train-label fingerprint (should be ~0; fingerprint collisions): 10 pools, 79 queries
|
| 4 |
+
all queries 19429 | fused top-1 is a train label: 0.0113 of queries = 0.033 of the missed queries | forward-only top-1 is a train label: 0.0047
|
| 5 |
+
domain pools queries 7569 | fused top-1 is a train label: 0.0037 of queries = 0.034 of the missed queries | forward-only top-1 is a train label: 0.0013
|
| 6 |
+
mixed pools queries 3437 | fused top-1 is a train label: 0.0038 of queries = 0.002 of the missed queries | forward-only top-1 is a train label: 0.0032
|
| 7 |
+
non-domain pools queries 8423 | fused top-1 is a train label: 0.0213 of queries = 0.039 of the missed queries | forward-only top-1 is a train label: 0.0083
|
| 8 |
+
simulator all=0.6539 dom=0.8039 non=0.5034 h5=0.8177 h20=0.8925 macro=0.7519
|
| 9 |
+
packaged rule all=0.7265 dom=0.8937 non=0.5586 h5=0.8372 h20=0.9033 macro=0.8116
|
| 10 |
+
AUDIT (not a release candidate): demote every train-label candidate to the end
|
| 11 |
+
simulator, train labels demoted all=0.6500 dom=0.8035 non=0.4958 h5=0.8138 h20=0.8884 macro=0.7493 | -0.0040 [-0.0086,-0.0006]
|
| 12 |
+
packaged rule, train labels demoted all=0.7248 dom=0.8940 non=0.5550 h5=0.8333 h20=0.8999 macro=0.8110 | -0.0016 [-0.0046,+0.0004]
|
| 13 |
+
|
| 14 |
+
real 0m1.976s
|
| 15 |
+
user 0m1.911s
|
| 16 |
+
sys 0m0.441s
|
shared/package-files/1c/1c3ab6fda7483fa65758b5b0ef134e17eacce3f108cd0b2f9e526d2b89366eb3/train-C1.log
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"event": "resumed", "source": "/workspace/research/forks/B-step0035000-resume.ckpt", "step": 35000, "epoch": 5, "batch_in_epoch": 5460, "elapsed": 9512.104094705079, "skipped": 0}
|
| 2 |
+
{"parameters": 15108154, "train_rows": 189066, "validation_rows": 2048, "steps_per_epoch": 5908, "identity": "own-checkpoint:0739bdd163a52753b55f2558914ac1fb8383b00c0436512105f4f0e28d55a5a8", "gpu": "NVIDIA H100 80GB HBM3"}
|
| 3 |
+
/opt/glacier/lib/python3.11/site-packages/torch/nn/modules/transformer.py:508: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. We recommend specifying layout=torch.jagged when constructing a nested tensor, as this layout receives active development, has better operator coverage, and works with torch.compile. (Triggered internally at /pytorch/aten/src/ATen/NestedTensorImpl.cpp:178.)
|
| 4 |
+
output = torch._nested_tensor_from_mask(
|
| 5 |
+
{"step": 37500, "elapsed_seconds": 11359.873801814043, "validation_loss": 0.5803505964577198, "validation_loss_ema": 0.5706611545756459}
|
| 6 |
+
{"step": 40000, "elapsed_seconds": 13108.830896281055, "validation_loss": 0.5801039915531874, "validation_loss_ema": 0.5671867122873664}
|
shared/package-files/1c/1c62fd3fc145992a5442c8e61d5c4838eeb967bb18dfb4db155e63e9a2d50887/replay-B20k+B30k-I1-50k-val-sub.report.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"benchmark_score": {
|
| 3 |
+
"at_or_above_upper_reference": true,
|
| 4 |
+
"comparable_to_test_reference": false,
|
| 5 |
+
"direction": "maximize",
|
| 6 |
+
"evaluation_fold": "validation",
|
| 7 |
+
"lower_reference": 0.04004329004329004,
|
| 8 |
+
"metric": "hit_rate_at_1",
|
| 9 |
+
"raw_performance": 0.695854680950163,
|
| 10 |
+
"saturation": "upper",
|
| 11 |
+
"score": 1.0,
|
| 12 |
+
"unclipped_score": 1.4449579290613783,
|
| 13 |
+
"upper_reference": 0.4939052175894281,
|
| 14 |
+
"version": "massspecgym-retrieval-score/v1"
|
| 15 |
+
},
|
| 16 |
+
"external_reference_context": {
|
| 17 |
+
"comparable_to_this_validation_report": false,
|
| 18 |
+
"fold": "test",
|
| 19 |
+
"hit_rate_at_1": 0.4939052175894281,
|
| 20 |
+
"name": "GLACIER no-CF with strict-clean MIST fallback"
|
| 21 |
+
},
|
| 22 |
+
"global_error": null,
|
| 23 |
+
"metrics": {
|
| 24 |
+
"hit_rate_at_1": 0.695854680950163,
|
| 25 |
+
"hit_rate_at_20": 0.8938053097345132,
|
| 26 |
+
"hit_rate_at_5": 0.816022356776898
|
| 27 |
+
},
|
| 28 |
+
"queries": 2147,
|
| 29 |
+
"schema": "massspecgym-retrieval-development-report/v1",
|
| 30 |
+
"strata": {
|
| 31 |
+
"adduct": {
|
| 32 |
+
"[M+H]+": {
|
| 33 |
+
"hit_rate_at_1": 0.7623642943305187,
|
| 34 |
+
"queries": 1658
|
| 35 |
+
},
|
| 36 |
+
"[M+Na]+": {
|
| 37 |
+
"hit_rate_at_1": 0.4703476482617587,
|
| 38 |
+
"queries": 489
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"candidate_pool_size": {
|
| 42 |
+
"129-256": {
|
| 43 |
+
"hit_rate_at_1": 0.695854680950163,
|
| 44 |
+
"queries": 2147
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
"collision_energy": {
|
| 48 |
+
"20-39.999": {
|
| 49 |
+
"hit_rate_at_1": 0.865234375,
|
| 50 |
+
"queries": 512
|
| 51 |
+
},
|
| 52 |
+
"40-59.999": {
|
| 53 |
+
"hit_rate_at_1": 0.8305084745762712,
|
| 54 |
+
"queries": 177
|
| 55 |
+
},
|
| 56 |
+
"<20": {
|
| 57 |
+
"hit_rate_at_1": 0.6556291390728477,
|
| 58 |
+
"queries": 151
|
| 59 |
+
},
|
| 60 |
+
">=60": {
|
| 61 |
+
"hit_rate_at_1": 0.8850574712643678,
|
| 62 |
+
"queries": 348
|
| 63 |
+
},
|
| 64 |
+
"missing": {
|
| 65 |
+
"hit_rate_at_1": 0.5182481751824818,
|
| 66 |
+
"queries": 959
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"instrument_type": {
|
| 70 |
+
"": {
|
| 71 |
+
"hit_rate_at_1": 0.6857142857142857,
|
| 72 |
+
"queries": 35
|
| 73 |
+
},
|
| 74 |
+
"Orbitrap": {
|
| 75 |
+
"hit_rate_at_1": 0.7128342245989305,
|
| 76 |
+
"queries": 1870
|
| 77 |
+
},
|
| 78 |
+
"QTOF": {
|
| 79 |
+
"hit_rate_at_1": 0.5661157024793388,
|
| 80 |
+
"queries": 242
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"routing_domain": {
|
| 84 |
+
"fallback": {
|
| 85 |
+
"hit_rate_at_1": 0.513622603430878,
|
| 86 |
+
"queries": 991
|
| 87 |
+
},
|
| 88 |
+
"glacier_released": {
|
| 89 |
+
"hit_rate_at_1": 0.8520761245674741,
|
| 90 |
+
"queries": 1156
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
},
|
| 94 |
+
"uncertainty": {
|
| 95 |
+
"confidence": 0.95,
|
| 96 |
+
"estimate": 0.695854680950163,
|
| 97 |
+
"grouping": "supplied target_inchikey connectivity block",
|
| 98 |
+
"lower": 0.5969655535929207,
|
| 99 |
+
"molecule_groups": 413,
|
| 100 |
+
"queries": 2147,
|
| 101 |
+
"resamples": 2000,
|
| 102 |
+
"seed": 0,
|
| 103 |
+
"statistic": "spectrum-weighted mean; molecules sampled with replacement",
|
| 104 |
+
"upper": 0.79291710887529
|
| 105 |
+
},
|
| 106 |
+
"valid_rankings": 2147
|
| 107 |
+
}
|
shared/package-files/1c/1c779b0269e213cd4430fb1a2449b8eee4f9af5d3326082b46c4ff1c595bf0da/e74-unexplained-train-orbi-noenergy.log
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
== [M+H]+ Orbitrap energy=no: 11675 spectra, with unexplained peaks 10664; unexplained share 0.289; of it +1.00335 above a stronger peak 0.044, control +1.0237 0.004
|
| 2 |
+
unexplained - explained (Da: share of pair weight, explained-explained share of the same bin):
|
| 3 |
+
+0.136: 0.0036 (0.0003); +0.128: 0.0035 (0.0003); +0.166: 0.0033 (0.0003); +0.158: 0.0031 (0.0003); +0.196: 0.0030 (0.0001); +0.174: 0.0029 (0.0002); +0.144: 0.0029 (0.0004); +0.008: 0.0029 (0.0010); -0.090: 0.0029 (0.0002); +1.004: 0.0028 (0.0001); -0.098: 0.0028 (0.0004); -0.076: 0.0028 (0.0003); +0.090: 0.0027 (0.0003); +0.106: 0.0027 (0.0004); +0.234: 0.0027 (0.0000); +0.098: 0.0026 (0.0004); +0.204: 0.0026 (0.0002); +0.120: 0.0026 (0.0003); -0.068: 0.0025 (0.0005); +0.188: 0.0025 (0.0002); +0.150: 0.0025 (0.0002); -0.030: 0.0025 (0.0007); +0.076: 0.0024 (0.0003); +0.114: 0.0024 (0.0002)
|
| 4 |
+
precursor - unexplained (Da: share):
|
| 5 |
+
18.012: 0.0038; 45.002: 0.0016; 18.000: 0.0014; 31.040: 0.0013; 46.000: 0.0012; 61.076: 0.0012; 57.060: 0.0012; 17.008: 0.0011; 18.016: 0.0010; 176.036: 0.0010; 1.014: 0.0009; 18.008: 0.0009; 17.006: 0.0009; 45.060: 0.0008; 28.000: 0.0008; 18.014: 0.0008; 18.018: 0.0008; 32.026: 0.0008; 94.016: 0.0007; 16.024: 0.0007; 134.072: 0.0007; 60.024: 0.0007; 68.066: 0.0007; 150.026: 0.0007
|
| 6 |
+
== [M+Na]+ Orbitrap energy=no: 10933 spectra, with unexplained peaks 10326; unexplained share 0.615; of it +1.00335 above a stronger peak 0.029, control +1.0237 0.001
|
| 7 |
+
unexplained - explained (Da: share of pair weight, explained-explained share of the same bin):
|
| 8 |
+
-21.982: 0.0064 (0.0021); +1.004: 0.0050 (0.0012); -1.004: 0.0045 (0.0022); +1.002: 0.0036 (0.0013); -1.006: 0.0034 (0.0035); -1.002: 0.0033 (0.0024); +1.006: 0.0031 (0.0030); +2.016: 0.0030 (0.0053); +14.016: 0.0028 (0.0064); +0.004: 0.0028 (0.0003); -14.014: 0.0026 (0.0040); +18.010: 0.0025 (0.0129); -27.994: 0.0025 (0.0067); +0.002: 0.0024 (0.0002); -2.014: 0.0022 (0.0033); +15.024: 0.0022 (0.0080); -23.998: 0.0021 (0.0013); -26.014: 0.0021 (0.0028); +1.008: 0.0020 (0.0137); +14.014: 0.0020 (0.0038); -11.998: 0.0019 (0.0014); -39.992: 0.0019 (0.0007); +2.014: 0.0019 (0.0033); +0.006: 0.0019 (0.0003)
|
| 9 |
+
precursor - unexplained (Da: share):
|
| 10 |
+
21.980: 0.0093; 21.982: 0.0083; 21.984: 0.0073; 21.986: 0.0053; 21.978: 0.0045; 32.028: 0.0037; 28.032: 0.0031; 21.976: 0.0028; 154.228: 0.0025; 21.988: 0.0025; 65.974: 0.0024; 27.992: 0.0022; 55.992: 0.0021; 15.024: 0.0021; 200.082: 0.0020; 56.056: 0.0020; 70.002: 0.0020; 14.016: 0.0019; 118.228: 0.0017; 83.986: 0.0014; 15.026: 0.0014; 101.992: 0.0014; 43.020: 0.0014; 754.336: 0.0013
|
shared/package-files/1c/1cdaec009d6b592fc243d2f279ae1865f98c39a20541157547082c5708efce0a/prepare_inv.py
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Training/evaluation stores for the inverse branch (``pkg/inverse.py``).
|
| 3 |
+
|
| 4 |
+
prepare_inv.py synth OUT_DIR [--sqlite /tmp/synth/subformulae.sqlite]
|
| 5 |
+
Supplied synthetic corpus: root formula = the corpus' ``cand_form``, peak sub-formulae =
|
| 6 |
+
the corpus' own assignment (identical to ``inverse.SubformulaTable`` at 20 ppm / 4 mDa,
|
| 7 |
+
see ``check_assign.py``), intensity = ``ms2_inten`` squared (as in ``prepare_synth.py``).
|
| 8 |
+
prepare_inv.py real OUT_DIR --fold train|validation
|
| 9 |
+
Experimental spectra of a labelled fold annotated under the LABEL formula (training
|
| 10 |
+
targets for train; a diagnostic only for validation).
|
| 11 |
+
prepare_inv.py pools OUT_DIR --input INPUT_ROOT
|
| 12 |
+
Inference-style store of a query set: every query annotated under every distinct
|
| 13 |
+
candidate formula of its pool, plus candidate fingerprints. Reads no label.
|
| 14 |
+
|
| 15 |
+
Stores (npz): root int16 [N,E]; offset int64 [N+1]; peaks uint8 [T,E]; inten float32 [T]
|
| 16 |
+
(strongest first, at most ``inverse.MAX_PEAKS`` per spectrum); adduct, instrument uint8 [N];
|
| 17 |
+
energy float32 [N] (NaN = not recorded); mol int32 [N] -> fps uint8 [M,512].
|
| 18 |
+
"""
|
| 19 |
+
import argparse
|
| 20 |
+
import csv
|
| 21 |
+
import hashlib
|
| 22 |
+
import json
|
| 23 |
+
import multiprocessing
|
| 24 |
+
import re
|
| 25 |
+
import sqlite3
|
| 26 |
+
import sys
|
| 27 |
+
import time
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
|
| 30 |
+
import numpy as np
|
| 31 |
+
|
| 32 |
+
HERE = Path(__file__).resolve().parent
|
| 33 |
+
sys.path.insert(0, str(HERE.parent / 'pkg'))
|
| 34 |
+
import inverse
|
| 35 |
+
import invrun
|
| 36 |
+
|
| 37 |
+
DATA = Path('/workspace/data')
|
| 38 |
+
LABELS = DATA / 'synthetic_augmentation' / 'labels.tsv'
|
| 39 |
+
ENERGY = re.compile(r'_ev-(\d+(?:\.\d+)?)$')
|
| 40 |
+
PPM, FLOOR = invrun.PPM, invrun.FLOOR
|
| 41 |
+
STATE = {}
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def digest(path):
|
| 45 |
+
h = hashlib.sha256()
|
| 46 |
+
with Path(path).open('rb') as f:
|
| 47 |
+
for block in iter(lambda: f.read(8 * 1024 * 1024), b''):
|
| 48 |
+
h.update(block)
|
| 49 |
+
return h.hexdigest()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
instrument_index = invrun.instrument_index
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def fingerprint_chunk(chunk):
|
| 56 |
+
from rdkit import Chem, RDLogger
|
| 57 |
+
RDLogger.DisableLog('rdApp.*')
|
| 58 |
+
out = []
|
| 59 |
+
for smiles in chunk:
|
| 60 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 61 |
+
if mol is None:
|
| 62 |
+
out.append(None)
|
| 63 |
+
continue
|
| 64 |
+
formula = inverse.mol_formula(mol)
|
| 65 |
+
out.append(None if formula is None else (inverse.fingerprint(mol), formula, Chem.GetFormalCharge(mol)))
|
| 66 |
+
return out
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def fingerprints(smiles_list, workers):
|
| 70 |
+
chunks = [smiles_list[i:i + 2000] for i in range(0, len(smiles_list), 2000)]
|
| 71 |
+
with multiprocessing.Pool(workers) as pool:
|
| 72 |
+
return [d for part in pool.imap(fingerprint_chunk, chunks, chunksize=1) for d in part]
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def save(out, name, rows, fps, extra):
|
| 76 |
+
"""rows: list of (root, peaks, inten, adduct, instrument, energy, mol)."""
|
| 77 |
+
counts = np.array([len(r[2]) for r in rows], dtype=np.int64)
|
| 78 |
+
np.savez(out / name,
|
| 79 |
+
root=np.stack([r[0] for r in rows]).astype(np.int16),
|
| 80 |
+
offset=np.concatenate([[0], np.cumsum(counts)]),
|
| 81 |
+
peaks=np.concatenate([r[1] for r in rows]).astype(np.uint8),
|
| 82 |
+
inten=np.concatenate([r[2] for r in rows]).astype(np.float32),
|
| 83 |
+
adduct=np.array([r[3] for r in rows], dtype=np.uint8),
|
| 84 |
+
instrument=np.array([r[4] for r in rows], dtype=np.uint8),
|
| 85 |
+
energy=np.array([r[5] for r in rows], dtype=np.float32),
|
| 86 |
+
mol=np.array([r[6] for r in rows], dtype=np.int32),
|
| 87 |
+
fps=fps, **extra)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
# --------------------------------------------------------------------------
|
| 91 |
+
# synthetic corpus
|
| 92 |
+
# --------------------------------------------------------------------------
|
| 93 |
+
|
| 94 |
+
def extract_synth(job):
|
| 95 |
+
low, high = job
|
| 96 |
+
db = sqlite3.connect(f"file:{STATE['sqlite']}?mode=ro", uri=True)
|
| 97 |
+
cache = {}
|
| 98 |
+
names, roots, adducts, counts, peaks, intens = [], [], [], [], [], []
|
| 99 |
+
for spec, payload in db.execute('SELECT spec, payload FROM subformulae WHERE spec >= ? AND spec < ? ORDER BY spec',
|
| 100 |
+
(low, high)):
|
| 101 |
+
data = json.loads(payload)
|
| 102 |
+
table = data.get('output_tbl')
|
| 103 |
+
root = inverse.parse_formula(data['cand_form'])
|
| 104 |
+
if not table or root is None or data['cand_ion'] not in inverse.ADDUCTS:
|
| 105 |
+
continue
|
| 106 |
+
inten = np.asarray(table['ms2_inten'], dtype=np.float64) ** 2
|
| 107 |
+
order = np.argsort(-inten, kind='stable')[:inverse.MAX_PEAKS]
|
| 108 |
+
rows = []
|
| 109 |
+
for k in order:
|
| 110 |
+
text = table['formula'][k]
|
| 111 |
+
vec = cache.get(text)
|
| 112 |
+
if vec is None:
|
| 113 |
+
vec = cache[text] = inverse.parse_formula(text)
|
| 114 |
+
rows.append(vec)
|
| 115 |
+
if not rows or any(v is None for v in rows):
|
| 116 |
+
continue
|
| 117 |
+
inten = inten[order] / inten[order].max()
|
| 118 |
+
names.append(spec)
|
| 119 |
+
roots.append(root)
|
| 120 |
+
adducts.append(inverse.ADDUCTS.index(data['cand_ion']))
|
| 121 |
+
counts.append(len(rows))
|
| 122 |
+
peaks.append(np.minimum(np.stack(rows), 255).astype(np.uint8))
|
| 123 |
+
intens.append(inten.astype(np.float32))
|
| 124 |
+
db.close()
|
| 125 |
+
return (names, np.stack(roots).astype(np.int16), np.array(adducts, dtype=np.uint8), np.array(counts, dtype=np.int32),
|
| 126 |
+
np.concatenate(peaks), np.concatenate(intens))
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def run_synth(args):
|
| 130 |
+
started = time.monotonic()
|
| 131 |
+
STATE['sqlite'] = str(args.sqlite)
|
| 132 |
+
labels, smiles_list, smiles_index = {}, [], {}
|
| 133 |
+
with LABELS.open() as stream:
|
| 134 |
+
for row in csv.DictReader(stream, delimiter='\t'):
|
| 135 |
+
index = smiles_index.get(row['smiles'])
|
| 136 |
+
if index is None:
|
| 137 |
+
index = smiles_index[row['smiles']] = len(smiles_list)
|
| 138 |
+
smiles_list.append(row['smiles'])
|
| 139 |
+
energy = ENERGY.search(row['spec'])
|
| 140 |
+
labels[row['spec']] = (index, instrument_index(row['instrument']), float(energy.group(1)) if energy else float('nan'))
|
| 141 |
+
described = fingerprints(smiles_list, args.workers)
|
| 142 |
+
print(json.dumps({'labels': len(labels), 'label_smiles': len(smiles_list),
|
| 143 |
+
'described': sum(d is not None for d in described), 'seconds': time.monotonic() - started}), flush=True)
|
| 144 |
+
prefixes = sorted({name.rsplit('_', 4)[0] for name in labels})
|
| 145 |
+
jobs = [(prefix + token, prefix + token[:-1] + '`') for prefix in prefixes for token in ('_Orbitrap_', '_QTOF_')]
|
| 146 |
+
with multiprocessing.Pool(args.workers) as pool:
|
| 147 |
+
parts = pool.map(extract_synth, jobs, chunksize=1)
|
| 148 |
+
print(json.dumps({'payloads_kept': sum(len(p[0]) for p in parts), 'seconds': time.monotonic() - started}), flush=True)
|
| 149 |
+
slot_of, fps = {}, []
|
| 150 |
+
root, adduct, instrument, energy, mol, counts, peaks, inten = [], [], [], [], [], [], [], []
|
| 151 |
+
skipped = {'structure': 0, 'formula_mismatch': 0}
|
| 152 |
+
for names, part_root, part_adduct, part_counts, part_peaks, part_inten in parts:
|
| 153 |
+
keep = np.zeros(len(names), dtype=bool)
|
| 154 |
+
for i, name in enumerate(names):
|
| 155 |
+
index, ins, ev = labels[name]
|
| 156 |
+
info = described[index]
|
| 157 |
+
if info is None:
|
| 158 |
+
skipped['structure'] += 1
|
| 159 |
+
continue
|
| 160 |
+
if not np.array_equal(info[1], part_root[i]):
|
| 161 |
+
skipped['formula_mismatch'] += 1
|
| 162 |
+
continue
|
| 163 |
+
slot = slot_of.get(index)
|
| 164 |
+
if slot is None:
|
| 165 |
+
slot = slot_of[index] = len(fps)
|
| 166 |
+
fps.append(info[0])
|
| 167 |
+
keep[i] = True
|
| 168 |
+
instrument.append(ins)
|
| 169 |
+
energy.append(ev)
|
| 170 |
+
mol.append(slot)
|
| 171 |
+
root.append(part_root[keep])
|
| 172 |
+
adduct.append(part_adduct[keep])
|
| 173 |
+
counts.append(part_counts[keep])
|
| 174 |
+
mask = np.repeat(keep, part_counts)
|
| 175 |
+
peaks.append(part_peaks[mask])
|
| 176 |
+
inten.append(part_inten[mask])
|
| 177 |
+
counts = np.concatenate(counts)
|
| 178 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 179 |
+
np.savez(args.output / 'synth.npz', root=np.concatenate(root), offset=np.concatenate([[0], np.cumsum(counts, dtype=np.int64)]),
|
| 180 |
+
peaks=np.concatenate(peaks), inten=np.concatenate(inten), adduct=np.concatenate(adduct),
|
| 181 |
+
instrument=np.array(instrument, dtype=np.uint8), energy=np.array(energy, dtype=np.float32),
|
| 182 |
+
mol=np.array(mol, dtype=np.int32), fps=np.stack(fps))
|
| 183 |
+
manifest = {'schema': 'allcond-inverse-synth/v1', 'spectra': int(len(counts)), 'structures': len(fps),
|
| 184 |
+
'peaks': int(counts.sum()), 'skipped': skipped, 'max_peaks': inverse.MAX_PEAKS,
|
| 185 |
+
'intensity': 'ms2_inten squared, max scaled to 1', 'sources': {'labels.tsv': digest(LABELS)},
|
| 186 |
+
'sha256': digest(args.output / 'synth.npz'), 'elapsed_seconds': time.monotonic() - started}
|
| 187 |
+
(args.output / 'synth.manifest.json').write_text(json.dumps(manifest, indent=1) + '\n')
|
| 188 |
+
print(json.dumps(manifest, indent=1))
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
# --------------------------------------------------------------------------
|
| 192 |
+
# labelled experimental folds (label formula)
|
| 193 |
+
# --------------------------------------------------------------------------
|
| 194 |
+
|
| 195 |
+
def annotate_real_chunk(chunk):
|
| 196 |
+
out = []
|
| 197 |
+
tables = {}
|
| 198 |
+
for row, formula in chunk:
|
| 199 |
+
key = formula.tobytes()
|
| 200 |
+
table = tables.get(key)
|
| 201 |
+
if table is None:
|
| 202 |
+
if len(tables) > 64:
|
| 203 |
+
tables.clear()
|
| 204 |
+
table = tables[key] = inverse.SubformulaTable(formula)
|
| 205 |
+
mz, inten = inverse.select_peaks(row['mzs'], row['intensities'])
|
| 206 |
+
peaks, kept = inverse.annotate(table, mz, inten, row['adduct'], PPM, FLOOR)
|
| 207 |
+
out.append((peaks, kept, len(mz), float(inten.sum()), float(kept.sum())))
|
| 208 |
+
return out
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def run_real(args):
|
| 212 |
+
started = time.monotonic()
|
| 213 |
+
path = DATA / f'{args.fold}.jsonl'
|
| 214 |
+
rows = [json.loads(line) for line in path.open()]
|
| 215 |
+
smiles_list, smiles_index = [], {}
|
| 216 |
+
for row in rows:
|
| 217 |
+
if row['target_smiles'] not in smiles_index:
|
| 218 |
+
smiles_index[row['target_smiles']] = len(smiles_list)
|
| 219 |
+
smiles_list.append(row['target_smiles'])
|
| 220 |
+
described = fingerprints(smiles_list, args.workers)
|
| 221 |
+
jobs, kept_rows, skipped = [], [], {'structure': 0, 'adduct': 0}
|
| 222 |
+
for i, row in enumerate(rows):
|
| 223 |
+
info = described[smiles_index[row['target_smiles']]]
|
| 224 |
+
if info is None:
|
| 225 |
+
skipped['structure'] += 1
|
| 226 |
+
elif row['adduct'] not in inverse.ADDUCTS:
|
| 227 |
+
skipped['adduct'] += 1
|
| 228 |
+
else:
|
| 229 |
+
jobs.append(({k: row[k] for k in ('mzs', 'intensities', 'adduct')}, info[1]))
|
| 230 |
+
kept_rows.append(i)
|
| 231 |
+
chunks = [jobs[i:i + 500] for i in range(0, len(jobs), 500)]
|
| 232 |
+
with multiprocessing.Pool(args.workers) as pool:
|
| 233 |
+
annotated = [a for part in pool.imap(annotate_real_chunk, chunks, chunksize=1) for a in part]
|
| 234 |
+
slot_of, fps, out = {}, [], []
|
| 235 |
+
for i, (peaks, inten, _, _, _) in zip(kept_rows, annotated):
|
| 236 |
+
row = rows[i]
|
| 237 |
+
index = smiles_index[row['target_smiles']]
|
| 238 |
+
slot = slot_of.get(index)
|
| 239 |
+
if slot is None:
|
| 240 |
+
slot = slot_of[index] = len(fps)
|
| 241 |
+
fps.append(described[index][0])
|
| 242 |
+
energy = row['collision_energy']
|
| 243 |
+
out.append((described[index][1], peaks, inten, inverse.ADDUCTS.index(row['adduct']),
|
| 244 |
+
instrument_index(row['instrument_type']), float('nan') if energy is None else float(energy), slot))
|
| 245 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 246 |
+
name = f'real-{args.fold}.npz'
|
| 247 |
+
save(args.output, name, out, np.stack(fps), {'row': np.array(kept_rows, dtype=np.int64)})
|
| 248 |
+
selected = np.array([a[2] for a in annotated])
|
| 249 |
+
total = np.array([a[3] for a in annotated])
|
| 250 |
+
explained = np.array([a[4] for a in annotated])
|
| 251 |
+
manifest = {'schema': 'allcond-inverse-real/v1', 'fold': args.fold, 'spectra': len(out), 'structures': len(fps),
|
| 252 |
+
'skipped': skipped, 'ppm': PPM, 'floor': FLOOR, 'max_peaks': inverse.MAX_PEAKS,
|
| 253 |
+
'mean_selected_peaks': float(selected.mean()), 'mean_annotated_peaks': float(np.mean([len(a[1]) for a in annotated])),
|
| 254 |
+
'no_annotated_peak': int(sum(len(a[1]) == 0 for a in annotated)),
|
| 255 |
+
'mean_explained_intensity': float(np.mean(explained / np.maximum(total, 1e-9))),
|
| 256 |
+
'source_sha256': digest(path), 'sha256': digest(args.output / name),
|
| 257 |
+
'elapsed_seconds': time.monotonic() - started}
|
| 258 |
+
(args.output / f'real-{args.fold}.manifest.json').write_text(json.dumps(manifest, indent=1) + '\n')
|
| 259 |
+
print(json.dumps(manifest, indent=1))
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
# --------------------------------------------------------------------------
|
| 263 |
+
# inference-style store: queries x distinct candidate formulae
|
| 264 |
+
# --------------------------------------------------------------------------
|
| 265 |
+
|
| 266 |
+
def run_pools(args):
|
| 267 |
+
started = time.monotonic()
|
| 268 |
+
queries = [json.loads(line) for line in (args.input / 'queries.jsonl').open()]
|
| 269 |
+
pools = {}
|
| 270 |
+
for line in (args.input / 'candidate_pools.jsonl').open():
|
| 271 |
+
pool = json.loads(line)
|
| 272 |
+
pools[pool['candidate_pool_id']] = pool['candidates']
|
| 273 |
+
store = invrun.build_store(queries, pools, args.workers)
|
| 274 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 275 |
+
name = f'pools-{args.input.name}.npz'
|
| 276 |
+
np.savez(args.output / name, **store)
|
| 277 |
+
manifest = {'schema': 'allcond-inverse-pools/v1', 'input': str(args.input), 'queries': len(queries),
|
| 278 |
+
'pools': len(store['pool_id']), 'pairs': int(len(store['offset']) - 1),
|
| 279 |
+
'distinct_formulae': int(store['pool_formula_start'][-1]), 'candidates': int(store['pool_cand_start'][-1]),
|
| 280 |
+
'unsupported_candidates': int((store['cand_formula'] < 0).sum()),
|
| 281 |
+
'mean_annotated_peaks': float(np.diff(store['offset']).mean()), 'ppm': PPM, 'floor': FLOOR,
|
| 282 |
+
'query_sha256': digest(args.input / 'queries.jsonl'), 'sha256': digest(args.output / name),
|
| 283 |
+
'elapsed_seconds': time.monotonic() - started}
|
| 284 |
+
(args.output / f'pools-{args.input.name}.manifest.json').write_text(json.dumps(manifest, indent=1) + '\n')
|
| 285 |
+
print(json.dumps(manifest, indent=1))
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
def main():
|
| 289 |
+
p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 290 |
+
p.add_argument('mode', choices=['synth', 'real', 'pools'])
|
| 291 |
+
p.add_argument('output', type=Path)
|
| 292 |
+
p.add_argument('--sqlite', type=Path, default=Path('/tmp/synth/subformulae.sqlite'))
|
| 293 |
+
p.add_argument('--fold', default='train')
|
| 294 |
+
p.add_argument('--input', type=Path)
|
| 295 |
+
p.add_argument('--workers', type=int, default=11)
|
| 296 |
+
args = p.parse_args()
|
| 297 |
+
{'synth': run_synth, 'real': run_real, 'pools': run_pools}[args.mode](args)
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
if __name__ == '__main__':
|
| 301 |
+
main()
|
shared/package-files/22/2229e517381cf87046e431cae8abff14fb5e32484fa8a6b03c500faef0c05fb4/metrics.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/package-files/22/2247cadad1b57623c51a598fcfda8f22afa41d0669fdea95f3f36210effc3d2a/fuse.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Fusion of the simulator distance with the inverse-branch distance (validation study).
|
| 2 |
+
|
| 3 |
+
fuse.py INPUT_ROOT VARIANT INVERSE.pkl[,INVERSE2.pkl...] NAME=CACHE.pkl [NAME=CACHE.pkl ...] [--key cos] [--weights ...]
|
| 4 |
+
|
| 5 |
+
Simulator distance = mean over the member caches (scorelab format) of VARIANT; inverse distance
|
| 6 |
+
= mean over the given inverse pickles (``inv/eval_inv.py``). Fused distance per query and
|
| 7 |
+
candidate: simulator + w * inverse, then the usual pool mean. One global w for every query.
|
| 8 |
+
Reports per-spectrum (ind) and pool-aggregated (agg) Hit@1 with the paired molecule-group
|
| 9 |
+
bootstrap difference to the simulator alone.
|
| 10 |
+
"""
|
| 11 |
+
import argparse
|
| 12 |
+
import pickle
|
| 13 |
+
import sys
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
|
| 18 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 19 |
+
import scorelab
|
| 20 |
+
from scorelab import infer
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def main():
|
| 24 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 25 |
+
p.add_argument('root', type=Path)
|
| 26 |
+
p.add_argument('variant')
|
| 27 |
+
p.add_argument('inverse')
|
| 28 |
+
p.add_argument('members', nargs='+')
|
| 29 |
+
p.add_argument('--key', default='cos')
|
| 30 |
+
p.add_argument('--weights', type=float, nargs='*', default=[0.05, 0.1, 0.2, 0.3, 0.5, 0.75, 1.0, 1.5, 2.0, 4.0])
|
| 31 |
+
p.add_argument('--strata', action='store_true')
|
| 32 |
+
args = p.parse_args()
|
| 33 |
+
queries = list(infer.read_jsonl(args.root / 'queries.jsonl'))
|
| 34 |
+
pools = {r['candidate_pool_id']: r['candidates'] for r in infer.read_jsonl(args.root / 'candidate_pools.jsonl')}
|
| 35 |
+
ev = scorelab.Evaluator(queries, pools)
|
| 36 |
+
member = []
|
| 37 |
+
for spec in args.members:
|
| 38 |
+
name, path = spec.split('=', 1)
|
| 39 |
+
results = pickle.load(open(path, 'rb'))
|
| 40 |
+
first = results[next(iter(results))]
|
| 41 |
+
member.append([d if d is not None else f for d, f in zip(results[args.variant], first)])
|
| 42 |
+
del results
|
| 43 |
+
sim = [None if any(m[i] is None for m in member) else np.mean([m[i] for m in member], axis=0) for i in range(len(queries))]
|
| 44 |
+
parts = [pickle.load(open(path, 'rb'))[args.key] for path in args.inverse.split(',')]
|
| 45 |
+
inv = [np.mean([part[i] for part in parts], axis=0).astype(np.float64) for i in range(len(queries))]
|
| 46 |
+
base = ev.ranks(sim, 0.0), ev.ranks(sim, 1.0)
|
| 47 |
+
print('simulator ' + ev.line('ind', base[0]))
|
| 48 |
+
print('simulator ' + ev.line('agg', base[1]))
|
| 49 |
+
own = ev.ranks(inv, 0.0), ev.ranks(inv, 1.0)
|
| 50 |
+
print('inverse ' + ev.line('ind', own[0], base[0]))
|
| 51 |
+
print('inverse ' + ev.line('agg', own[1], base[1]), flush=True)
|
| 52 |
+
best = None
|
| 53 |
+
for w in args.weights:
|
| 54 |
+
fused = [None if s is None else s + w * d for s, d in zip(sim, inv)]
|
| 55 |
+
ind, agg = ev.ranks(fused, 0.0, fallback=inv), ev.ranks(fused, 1.0, fallback=inv)
|
| 56 |
+
print(f'w={w:<6g} ' + ev.line('ind', ind, base[0]))
|
| 57 |
+
print(f'w={w:<6g} ' + ev.line('agg', agg, base[1]), flush=True)
|
| 58 |
+
if best is None or (agg == 0).mean() > (best[1] == 0).mean():
|
| 59 |
+
best = (w, agg)
|
| 60 |
+
if args.strata:
|
| 61 |
+
w, agg = best
|
| 62 |
+
mz = np.array([q['precursor_mz'] for q in queries])
|
| 63 |
+
adduct = np.array([q['adduct'] for q in queries])
|
| 64 |
+
ce = np.array([q['collision_energy'] is not None for q in queries])
|
| 65 |
+
print(f'strata at w={w}: agg Hit@1 simulator -> fused (queries)')
|
| 66 |
+
for name, mask in [('[M+H]+', adduct == '[M+H]+'), ('[M+Na]+', adduct == '[M+Na]+'), ('CE given', ce), ('CE missing', ~ce),
|
| 67 |
+
('m/z < 300', mz < 300), ('300-500', (mz >= 300) & (mz < 500)), ('500-700', (mz >= 500) & (mz < 700)),
|
| 68 |
+
('>= 700', mz >= 700)]:
|
| 69 |
+
print(f' {name:12s} {np.mean(base[1][mask] == 0):.4f} -> {np.mean(agg[mask] == 0):.4f} ({mask.sum()})')
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
if __name__ == '__main__':
|
| 73 |
+
main()
|
shared/package-files/22/22482fc489c97e37de1c2177cf654374cc958c1f72a788269591849d757134a0/validation.jsonl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"step": 5000, "elapsed": 121.40688379108906, "val_loss": 0.036577283928070234, "val_cos": 0.6400906965646553, "val_loss_ema": 0.035260315114185786, "val_cos_ema": 0.6527446739168897}
|
| 2 |
+
{"step": 10000, "elapsed": 218.64231286710128, "val_loss": 0.03294205904878218, "val_cos": 0.6823312719247806, "val_loss_ema": 0.03166316966646287, "val_cos_ema": 0.6933056688374981, "ind_cos": 0.4269391116372433, "agg_cos": 0.45632816923156105, "ind_nll": 0.2793247207782181, "agg_nll": 0.25863400072057235, "retrieval_seconds": 11.530367560917512}
|
| 3 |
+
{"step": 15000, "elapsed": 330.3985719040502, "val_loss": 0.031660898400933564, "val_cos": 0.703660842743933, "val_loss_ema": 0.03031666026419009, "val_cos_ema": 0.7126848477147563}
|
| 4 |
+
{"step": 20000, "elapsed": 442.6312280650018, "val_loss": 0.03025526776844637, "val_cos": 0.7159169559477778, "val_loss_ema": 0.029355065184126942, "val_cos_ema": 0.7258356447674867, "ind_cos": 0.495290545061506, "agg_cos": 0.5195841268207319, "ind_nll": 0.3696021411292398, "agg_nll": 0.35524216377579904, "retrieval_seconds": 11.309179823030718}
|
| 5 |
+
{"step": 25000, "elapsed": 551.3109733470483, "val_loss": 0.029532987266814227, "val_cos": 0.726935590704456, "val_loss_ema": 0.02929995126109207, "val_cos_ema": 0.7297817157382328}
|
| 6 |
+
{"step": 30000, "elapsed": 650.677494857111, "val_loss": 0.02974170062611785, "val_cos": 0.7290448330097727, "val_loss_ema": 0.028814111307391456, "val_cos_ema": 0.7371385678303052, "ind_cos": 0.5120181172474136, "agg_cos": 0.549642287302486, "ind_nll": 0.4011529157445056, "agg_nll": 0.38663853003242576, "retrieval_seconds": 11.366464950027876}
|
| 7 |
+
{"step": 35000, "elapsed": 759.0612655470613, "val_loss": 0.029209357060457908, "val_cos": 0.7338960676935895, "val_loss_ema": 0.028294090064053333, "val_cos_ema": 0.7418983361695146}
|
| 8 |
+
{"step": 40000, "elapsed": 856.2324718420859, "val_loss": 0.02859549846606957, "val_cos": 0.7419642311428792, "val_loss_ema": 0.028326214099177013, "val_cos_ema": 0.7435733175319432, "ind_cos": 0.5247825415615832, "agg_cos": 0.562509650522415, "ind_nll": 0.41669669051417985, "agg_nll": 0.4035205105769726, "retrieval_seconds": 11.363689224002883}
|
| 9 |
+
{"step": 45000, "elapsed": 964.9528176950989, "val_loss": 0.02769213755037874, "val_cos": 0.7494391387793375, "val_loss_ema": 0.02820316287013272, "val_cos_ema": 0.7460510137672745}
|
| 10 |
+
{"step": 50000, "elapsed": 1065.981066885055, "val_loss": 0.02860307288529409, "val_cos": 0.743471534678348, "val_loss_ema": 0.02836841589338505, "val_cos_ema": 0.7449706453223918, "ind_cos": 0.5250398888259817, "agg_cos": 0.5633331617684904, "ind_nll": 0.4202480827628802, "agg_nll": 0.41036594780997476, "retrieval_seconds": 11.291447255993262}
|
shared/package-files/22/226b69a1f981df4100272d5626afef8cc961c8ad0f6ef2d4353d4b170744e58e/recur-weighted-10.log
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
weighted tol 10 mDa: 17307 of 19429 spectra in groups of >= 3; peaks 432025 -> 432025; 1 s
|
| 2 |
+
wrote /workspace/research/inv/recur/weighted-10.npz 154 s
|
shared/package-files/22/227d6102bbb5328f8d88440470e4b3b83d5ab292a603bcb12d20481a517f0349/build-5Ms-I1+I3x2g07-L.log
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"built": "/run-state/workspace/research/builds/5Ms-I1+I3x2g07-L",
|
| 3 |
+
"checkpoint_sha256": "4ffa8ea9f5153437613890358e2cb23410064c1daa236232f75f828b30842e75",
|
| 4 |
+
"members": [
|
| 5 |
+
{
|
| 6 |
+
"source": "runs/B-all-b32/checkpoints/step-0020000-ema.ckpt",
|
| 7 |
+
"sha256": "80ec4715663e505007412e3d89dbe6020cd145713840c15affaf82604fc5765c",
|
| 8 |
+
"global_step": 20000,
|
| 9 |
+
"weights": "ema",
|
| 10 |
+
"subset": "all",
|
| 11 |
+
"seed": 1,
|
| 12 |
+
"elapsed_seconds": 5136.2172065590275,
|
| 13 |
+
"data_manifest_sha256": "695645989510ffe27c4ef0d2f8f8f14f8c5514a5b23b5bfda55a7d035503ed4e",
|
| 14 |
+
"initialization": "random",
|
| 15 |
+
"training_data": "MassSpecGym v1.5 train fold",
|
| 16 |
+
"synthetic": null
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"source": "runs/B-all-b32/checkpoints/step-0030000-ema.ckpt",
|
| 20 |
+
"sha256": "0228e4fa0589333f02db8223e49d6ecd23cd100d1a6182ad268d9db4f8468798",
|
| 21 |
+
"global_step": 30000,
|
| 22 |
+
"weights": "ema",
|
| 23 |
+
"subset": "all",
|
| 24 |
+
"seed": 1,
|
| 25 |
+
"elapsed_seconds": 8314.79353913304,
|
| 26 |
+
"data_manifest_sha256": "695645989510ffe27c4ef0d2f8f8f14f8c5514a5b23b5bfda55a7d035503ed4e",
|
| 27 |
+
"initialization": "random",
|
| 28 |
+
"training_data": "MassSpecGym v1.5 train fold",
|
| 29 |
+
"synthetic": null
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"source": "runs/B2-all-b32-seed2/checkpoints/step-0020000-ema.ckpt",
|
| 33 |
+
"sha256": "ac3c85cdabfb5f68ca3ca506732f1f8e79fa6e9f3d5bf5fa574b6e1f3249312c",
|
| 34 |
+
"global_step": 20000,
|
| 35 |
+
"weights": "ema",
|
| 36 |
+
"subset": "all",
|
| 37 |
+
"seed": 2,
|
| 38 |
+
"elapsed_seconds": 6945.18486677701,
|
| 39 |
+
"data_manifest_sha256": "695645989510ffe27c4ef0d2f8f8f14f8c5514a5b23b5bfda55a7d035503ed4e",
|
| 40 |
+
"initialization": "random",
|
| 41 |
+
"training_data": "MassSpecGym v1.5 train fold",
|
| 42 |
+
"synthetic": null
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"source": "runs/B2-all-b32-seed2/checkpoints/step-0030000-ema.ckpt",
|
| 46 |
+
"sha256": "f11667b8ee56a15c82d26ab9052816ecc63f2081eaa6fd4ea82d38d1e2a36ce1",
|
| 47 |
+
"global_step": 30000,
|
| 48 |
+
"weights": "ema",
|
| 49 |
+
"subset": "all",
|
| 50 |
+
"seed": 2,
|
| 51 |
+
"elapsed_seconds": 9298.063542745003,
|
| 52 |
+
"data_manifest_sha256": "695645989510ffe27c4ef0d2f8f8f14f8c5514a5b23b5bfda55a7d035503ed4e",
|
| 53 |
+
"initialization": "random",
|
| 54 |
+
"training_data": "MassSpecGym v1.5 train fold",
|
| 55 |
+
"synthetic": null
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"source": "runs/S2-B20k-synth/checkpoints/step-0030000-ema.ckpt",
|
| 59 |
+
"sha256": "44742fa31f337e59b543d903018780560569c2e8e50a008ba008859c8440e3a2",
|
| 60 |
+
"global_step": 30000,
|
| 61 |
+
"weights": "ema",
|
| 62 |
+
"subset": "all",
|
| 63 |
+
"seed": 1,
|
| 64 |
+
"elapsed_seconds": 8906.84206694903,
|
| 65 |
+
"data_manifest_sha256": "695645989510ffe27c4ef0d2f8f8f14f8c5514a5b23b5bfda55a7d035503ed4e",
|
| 66 |
+
"initialization": "own-checkpoint:6c5a43fada335e5f4e9f8265ec6cfd54a8f317eb8d2100d96ea3731809005be2",
|
| 67 |
+
"training_data": "MassSpecGym v1.5 train fold + supplied synthetic_augmentation corpus (auxiliary intensity term)",
|
| 68 |
+
"synthetic": {
|
| 69 |
+
"manifest_sha256": "431454e702f8da3194684fc9a565135d29a38a407aaa31e9399d871360c6e962",
|
| 70 |
+
"per_item": 1,
|
| 71 |
+
"weight": 1.0,
|
| 72 |
+
"schedule": "e2e",
|
| 73 |
+
"instrument": "flag"
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"config": {
|
| 78 |
+
"sparse_k": 100,
|
| 79 |
+
"inference_batch_size": 128,
|
| 80 |
+
"workers": 14,
|
| 81 |
+
"num_bins": 150000,
|
| 82 |
+
"upper_limit": 1500,
|
| 83 |
+
"max_observed_peaks": 50,
|
| 84 |
+
"observed_intensity_threshold": 0.001,
|
| 85 |
+
"ensemble": "prediction",
|
| 86 |
+
"pool_aggregation": 1.0,
|
| 87 |
+
"autocast": false,
|
| 88 |
+
"model": {
|
| 89 |
+
"pe_embed_k": 14,
|
| 90 |
+
"embed_elem_group": true,
|
| 91 |
+
"multi_hop_max_dist": 10
|
| 92 |
+
},
|
| 93 |
+
"checkpoint": "model.pt",
|
| 94 |
+
"views": [
|
| 95 |
+
{
|
| 96 |
+
"precursor_window": 0.5,
|
| 97 |
+
"pred_power": 0.75,
|
| 98 |
+
"match_ppm": 20,
|
| 99 |
+
"match_floor_mda": 4,
|
| 100 |
+
"match_by_instrument": {
|
| 101 |
+
"Orbitrap": [
|
| 102 |
+
10,
|
| 103 |
+
1
|
| 104 |
+
]
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
],
|
| 108 |
+
"inverse": {
|
| 109 |
+
"pooled": true,
|
| 110 |
+
"score": {
|
| 111 |
+
"members": "probability",
|
| 112 |
+
"power": 0.7
|
| 113 |
+
},
|
| 114 |
+
"weight_domain": 0.75,
|
| 115 |
+
"weight_other": 0.05,
|
| 116 |
+
"weight_other_single": 0.5,
|
| 117 |
+
"batch": 2048
|
| 118 |
+
},
|
| 119 |
+
"library": {
|
| 120 |
+
"kind": "sum",
|
| 121 |
+
"k": 20,
|
| 122 |
+
"top": 32,
|
| 123 |
+
"power": 6,
|
| 124 |
+
"debias": true,
|
| 125 |
+
"weight_domain": 0.0,
|
| 126 |
+
"weight_other": 0.4,
|
| 127 |
+
"weight_other_single": 0.0
|
| 128 |
+
},
|
| 129 |
+
"inverse_members": [
|
| 130 |
+
{
|
| 131 |
+
"source": "runs/I1-ff512x6/step-0050000-ema.pt",
|
| 132 |
+
"sha256": "c131cac451c9d360d13a7576304a4f3ce59c4e542d10ec5e8e4b943838ba385b",
|
| 133 |
+
"step": 50000,
|
| 134 |
+
"class": "FormulaFormer",
|
| 135 |
+
"weights": "ema",
|
| 136 |
+
"initialization": "random",
|
| 137 |
+
"seed": 1,
|
| 138 |
+
"training_data": "MassSpecGym v1.5 train fold + supplied synthetic_augmentation corpus",
|
| 139 |
+
"stores": {
|
| 140 |
+
"pools-validation-input.manifest.json": "13490ff1249eca04dc3a23c94838008071da73002c497d5a614d236258301758",
|
| 141 |
+
"real-train.manifest.json": "59912f8d472101e1f789f5f673f8ef2bdcb521e7973fcd9f4db96bc46d8e46c6",
|
| 142 |
+
"real-validation.manifest.json": "ff9c1d5b46543ad3da990c1a3aeaa2e4f68939761224689af930a39671fdb597",
|
| 143 |
+
"synth.manifest.json": "28d43b29c6334a14a568b8f8f412b260ad87934f687903ad927ac57a0f8e20cc"
|
| 144 |
+
},
|
| 145 |
+
"recipe": {
|
| 146 |
+
"store": "/workspace/research/inv",
|
| 147 |
+
"out": "/workspace/research/runs/I1-ff512x6",
|
| 148 |
+
"pools": "pools-validation-input.npz",
|
| 149 |
+
"input": "/workspace/research/validation-input",
|
| 150 |
+
"steps": 100000,
|
| 151 |
+
"batch": 512,
|
| 152 |
+
"real_frac": 0.2,
|
| 153 |
+
"real_balance": 0.5,
|
| 154 |
+
"no_synth": false,
|
| 155 |
+
"lr": 0.0006,
|
| 156 |
+
"weight_decay": 0.0001,
|
| 157 |
+
"warmup": 2000,
|
| 158 |
+
"ema": 0.999,
|
| 159 |
+
"dim": 512,
|
| 160 |
+
"layers": 6,
|
| 161 |
+
"heads": 8,
|
| 162 |
+
"dropout": 0.1,
|
| 163 |
+
"peak_drop": 0.3,
|
| 164 |
+
"truncate": 0.3,
|
| 165 |
+
"min_keep": 4,
|
| 166 |
+
"jitter": 0.15,
|
| 167 |
+
"synth_energy_drop": 0.3,
|
| 168 |
+
"synth_instrument_drop": 0.3,
|
| 169 |
+
"validate_every": 5000,
|
| 170 |
+
"retrieve_every": 10000,
|
| 171 |
+
"retrieve_pools": 0,
|
| 172 |
+
"seed": 1,
|
| 173 |
+
"max_steps_this_run": 0
|
| 174 |
+
}
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"source": "runs/I3-ff512x6-real08/step-0030000-ema.pt",
|
| 178 |
+
"sha256": "27125fd05eb958236b7f815eb97d8ae9b148aedd5c552067361a7bc116dffbae",
|
| 179 |
+
"step": 30000,
|
| 180 |
+
"class": "FormulaFormer",
|
| 181 |
+
"weights": "ema",
|
| 182 |
+
"initialization": "random",
|
| 183 |
+
"seed": 1,
|
| 184 |
+
"training_data": "MassSpecGym v1.5 train fold + supplied synthetic_augmentation corpus",
|
| 185 |
+
"stores": {
|
| 186 |
+
"pools-validation-input.manifest.json": "13490ff1249eca04dc3a23c94838008071da73002c497d5a614d236258301758",
|
| 187 |
+
"real-train.manifest.json": "59912f8d472101e1f789f5f673f8ef2bdcb521e7973fcd9f4db96bc46d8e46c6",
|
| 188 |
+
"real-validation.manifest.json": "ff9c1d5b46543ad3da990c1a3aeaa2e4f68939761224689af930a39671fdb597",
|
| 189 |
+
"synth.manifest.json": "28d43b29c6334a14a568b8f8f412b260ad87934f687903ad927ac57a0f8e20cc"
|
| 190 |
+
},
|
| 191 |
+
"recipe": {
|
| 192 |
+
"store": "/workspace/research/inv",
|
| 193 |
+
"out": "/workspace/research/runs/I3-ff512x6-real08",
|
| 194 |
+
"pools": "pools-validation-input.npz",
|
| 195 |
+
"input": "/workspace/research/validation-input",
|
| 196 |
+
"steps": 100000,
|
| 197 |
+
"batch": 512,
|
| 198 |
+
"real_frac": 0.08,
|
| 199 |
+
"real_balance": 0.5,
|
| 200 |
+
"no_synth": false,
|
| 201 |
+
"lr": 0.0006,
|
| 202 |
+
"weight_decay": 0.0001,
|
| 203 |
+
"warmup": 2000,
|
| 204 |
+
"ema": 0.999,
|
| 205 |
+
"dim": 512,
|
| 206 |
+
"layers": 6,
|
| 207 |
+
"heads": 8,
|
| 208 |
+
"dropout": 0.1,
|
| 209 |
+
"peak_drop": 0.3,
|
| 210 |
+
"truncate": 0.3,
|
| 211 |
+
"min_keep": 4,
|
| 212 |
+
"jitter": 0.15,
|
| 213 |
+
"synth_energy_drop": 0.3,
|
| 214 |
+
"synth_instrument_drop": 0.3,
|
| 215 |
+
"validate_every": 5000,
|
| 216 |
+
"retrieve_every": 10000,
|
| 217 |
+
"retrieve_pools": 0,
|
| 218 |
+
"seed": 1,
|
| 219 |
+
"max_steps_this_run": 0
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"source": "runs/I3-ff512x6-real08/step-0100000-ema.pt",
|
| 224 |
+
"sha256": "d3a914a9bf011751408a2739cb18b0312df430fd31447b9115b0010861ab08e3",
|
| 225 |
+
"step": 100000,
|
| 226 |
+
"class": "FormulaFormer",
|
| 227 |
+
"weights": "ema",
|
| 228 |
+
"initialization": "random",
|
| 229 |
+
"seed": 1,
|
| 230 |
+
"training_data": "MassSpecGym v1.5 train fold + supplied synthetic_augmentation corpus",
|
| 231 |
+
"stores": {
|
| 232 |
+
"pools-validation-input.manifest.json": "13490ff1249eca04dc3a23c94838008071da73002c497d5a614d236258301758",
|
| 233 |
+
"real-train.manifest.json": "59912f8d472101e1f789f5f673f8ef2bdcb521e7973fcd9f4db96bc46d8e46c6",
|
| 234 |
+
"real-validation.manifest.json": "ff9c1d5b46543ad3da990c1a3aeaa2e4f68939761224689af930a39671fdb597",
|
| 235 |
+
"synth.manifest.json": "28d43b29c6334a14a568b8f8f412b260ad87934f687903ad927ac57a0f8e20cc"
|
| 236 |
+
},
|
| 237 |
+
"recipe": {
|
| 238 |
+
"store": "/workspace/research/inv",
|
| 239 |
+
"out": "/workspace/research/runs/I3-ff512x6-real08",
|
| 240 |
+
"pools": "pools-validation-input.npz",
|
| 241 |
+
"input": "/workspace/research/validation-input",
|
| 242 |
+
"steps": 100000,
|
| 243 |
+
"batch": 512,
|
| 244 |
+
"real_frac": 0.08,
|
| 245 |
+
"real_balance": 0.5,
|
| 246 |
+
"no_synth": false,
|
| 247 |
+
"lr": 0.0006,
|
| 248 |
+
"weight_decay": 0.0001,
|
| 249 |
+
"warmup": 2000,
|
| 250 |
+
"ema": 0.999,
|
| 251 |
+
"dim": 512,
|
| 252 |
+
"layers": 6,
|
| 253 |
+
"heads": 8,
|
| 254 |
+
"dropout": 0.1,
|
| 255 |
+
"peak_drop": 0.3,
|
| 256 |
+
"truncate": 0.3,
|
| 257 |
+
"min_keep": 4,
|
| 258 |
+
"jitter": 0.15,
|
| 259 |
+
"synth_energy_drop": 0.3,
|
| 260 |
+
"synth_instrument_drop": 0.3,
|
| 261 |
+
"validate_every": 5000,
|
| 262 |
+
"retrieve_every": 10000,
|
| 263 |
+
"retrieve_pools": 0,
|
| 264 |
+
"seed": 1,
|
| 265 |
+
"max_steps_this_run": 0
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
],
|
| 269 |
+
"library_asset": {
|
| 270 |
+
"schema": "train-library/v1",
|
| 271 |
+
"fold": "train",
|
| 272 |
+
"spectra": 194119,
|
| 273 |
+
"molecules": 25046,
|
| 274 |
+
"bin": 0.01,
|
| 275 |
+
"prior_sample": 1024,
|
| 276 |
+
"prior_seed": 0,
|
| 277 |
+
"fragment_entries": 6765621,
|
| 278 |
+
"loss_entries": 6763777,
|
| 279 |
+
"source": "/workspace/data/train.jsonl",
|
| 280 |
+
"source_sha256": "de7f46e91f7b67eb5ca67468381abbdb20a8f739a0ae4b27070276798ecad0fc",
|
| 281 |
+
"structure_store": "/run-state/workspace/research/inv/real-train.npz",
|
| 282 |
+
"structure_store_sha256": "59912f8d472101e1f789f5f673f8ef2bdcb521e7973fcd9f4db96bc46d8e46c6",
|
| 283 |
+
"sha256": "22d1ddb216eef78d5040209ff6526371e5fcd8aac88e68a36823b6d5e73b3712",
|
| 284 |
+
"elapsed_seconds": 13.499361125999712,
|
| 285 |
+
"training_data": "MassSpecGym v1.5 train fold"
|
| 286 |
+
},
|
| 287 |
+
"method": "native-glacier-all-conditions-forward-simulation+formula-transformer-inverse-fusion+train-library-neighbour-fusion",
|
| 288 |
+
"inference_runtime": "/opt/glacier/bin/python"
|
| 289 |
+
}
|
| 290 |
+
}
|
shared/package-files/28/2804e7b9760bb69c26eeee10e497c40277d8399398fe6288cc2dec108433c325/netprop-neigh-inv-s0.8.log
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule from saved branches: Hit@1 0.7713 pool-macro 0.8591 Hit@5 0.8797 Hit@20 0.9377 | twin pools 354 (macro 0.7429), others macro 0.8727
|
| 2 |
+
|
| 3 |
+
k=10 p=3.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4041 (domain 0.3638 / other 0.4447) macro 0.3275
|
| 4 |
+
lam 1.00/1.00: Hit@1 0.7655 (-0.0059 [-0.0389, +0.0257]) macro +0.0006 [-0.0062, +0.0062] pools +66 -64 | no top 20 -0.0058 cap30 -0.0071 [-0.0263, +0.0107] | Hit@5 -0.0405 macro@5 -0.0041 cap30@5 -0.0145
|
| 5 |
+
|
| 6 |
+
k=10 p=2.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4084 (domain 0.3679 / other 0.4490) macro 0.3305
|
| 7 |
+
lam 1.00/1.00: Hit@1 0.7690 (-0.0023 [-0.0354, +0.0292]) macro +0.0030 [-0.0038, +0.0089] pools +69 -59 | no top 20 -0.0018 cap30 -0.0030 [-0.0220, +0.0151] | Hit@5 -0.0395 macro@5 -0.0032 cap30@5 -0.0133
|
| 8 |
+
|
| 9 |
+
k=10 p=1.0 half=0.5 | m=10 tau=0.02 kernel=plain debias=fold control=none shuffle=None: alone Hit@1 0.4113 (domain 0.3677 / other 0.4551) macro 0.3328
|
| 10 |
+
lam 1.00/1.00: Hit@1 0.7694 (-0.0020 [-0.0349, +0.0296]) macro +0.0032 [-0.0035, +0.0095] pools +69 -58 | no top 20 -0.0014 cap30 -0.0026 [-0.0214, +0.0151] | Hit@5 -0.0401 macro@5 -0.0038 cap30@5 -0.0140
|
shared/package-files/28/282255e7b2da7a61b86b091c34fd2e5bbeea2a5b789e571e9d3f9a8b17cae659/recur-ms10-p48.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
merged tol 10 mDa: 17307 of 19429 spectra in groups of >= 3; peaks 432025 -> 1838331; energy set missing for 0; 0 s
|
| 2 |
+
select_peaks (100,) annotate (48,)
|
| 3 |
+
wrote /workspace/research/inv/recur/ms10-p48.npz 99 s
|
shared/package-files/28/284950469ffa8b8a1c7f89264927cb6c0b03707c5bf13af087abd2cba78ada90/replays-5Ms-I9b+I13-L-ion-net.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
cd /workspace/research
|
| 3 |
+
N=5Ms-I9b+I13-L-ion-net
|
| 4 |
+
for pair in val-tiny:tiny edge-input:edge val-sub:sub; do
|
| 5 |
+
input=${pair%%:*}; tag=${pair##*:}; name=$input; [ "$input" = edge-input ] && name=edge
|
| 6 |
+
bash allcond/checks/replay.sh builds/$N /workspace/research/$input net-$tag 8-21 > logs/replay-$N-$name.log 2>&1
|
| 7 |
+
mkdir -p evals/replay/$N-$tag; cp /tmp/reloc-net-$tag/out/rankings.jsonl evals/replay/$N-$tag/rankings.jsonl
|
| 8 |
+
done
|
| 9 |
+
date -u +%H:%M:%S > logs/replays-$N.done
|
shared/package-files/28/2868f987d0f0f48e55f3687a9a8133074a57ebb7e24c03175925940a1c29bb38/anchor_fused.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Tolerance-matched forward distance inside the fused rule (development only).
|
| 2 |
+
|
| 3 |
+
anchor_fused.py INVERSE.pkl:KEY[+...] MEMBER=ANCHOR.pkl[,MEMBER=ANCHOR.pkl...] VARIANT[,VARIANT...] [--grid]
|
| 4 |
+
|
| 5 |
+
Reference: the released fused rule on the released forward view (fixed 0.01 Da bins). For every
|
| 6 |
+
variant the forward distance is replaced by the tolerance-matched distance of the same members;
|
| 7 |
+
fusion constants as released unless --grid. Paired bootstrap over pools; validation labels:
|
| 8 |
+
evaluation only.
|
| 9 |
+
"""
|
| 10 |
+
import pickle
|
| 11 |
+
import sys
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 17 |
+
from fuselab import Lab
|
| 18 |
+
from fusion_rule import MEMBERS
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
inverse, member_spec, variants = sys.argv[1], sys.argv[2].split(','), sys.argv[3].split(',')
|
| 23 |
+
grid = '--grid' in sys.argv
|
| 24 |
+
ref_lab = Lab('/workspace/research/validation-input', 'noprec_pp0.75', MEMBERS).setup()
|
| 25 |
+
pools = len(ref_lab.members)
|
| 26 |
+
parts = []
|
| 27 |
+
for item in inverse.split('+'):
|
| 28 |
+
path, key = item.rsplit(':', 1)
|
| 29 |
+
loaded = pickle.load(open(path, 'rb'))[key]
|
| 30 |
+
parts.append([ref_lab.matrix(loaded, s) for s in range(pools)])
|
| 31 |
+
inv = [np.mean([part[s] for part in parts], axis=0) for s in range(pools)]
|
| 32 |
+
dom = [ref_lab.domain[m] for m in ref_lab.members]
|
| 33 |
+
mixed = np.array([d.any() and not d.all() for d in dom])
|
| 34 |
+
alldom = np.array([d.all() for d in dom])
|
| 35 |
+
size = np.array([len(m) for m in ref_lab.members], dtype=float)
|
| 36 |
+
|
| 37 |
+
def fused(lab, wd=0.75, wn=0.05, c=0.5):
|
| 38 |
+
sim = [lab.matrix(lab.sim, s).mean(0) for s in range(pools)]
|
| 39 |
+
def rule(s):
|
| 40 |
+
w = np.where(dom[s], wd, max(wn, c / len(dom[s])))
|
| 41 |
+
return sim[s] + (w[:, None] * inv[s]).mean(0)
|
| 42 |
+
return lab.pool_rule(lambda s: sim[s]), lab.pool_rule(rule)
|
| 43 |
+
|
| 44 |
+
def strata(rank):
|
| 45 |
+
hit = np.array([rank[m[0]] == 0 for m in ref_lab.members])
|
| 46 |
+
f = lambda mask: (hit[mask] * size[mask]).sum() / size[mask].sum()
|
| 47 |
+
return f'pools: domain {f(alldom):.4f} mixed {f(mixed):.4f} other {f(~alldom & ~mixed):.4f}'
|
| 48 |
+
|
| 49 |
+
ref_forward, ref_fused = fused(ref_lab)
|
| 50 |
+
print(ref_lab.line('released forward', ref_forward))
|
| 51 |
+
print(ref_lab.line('released fused', ref_fused), '|', strata(ref_fused))
|
| 52 |
+
for variant in variants:
|
| 53 |
+
lab = Lab('/workspace/research/validation-input', variant, member_spec).setup()
|
| 54 |
+
forward, rank = fused(lab)
|
| 55 |
+
print(ref_lab.line(f'{variant} forward', forward, ref_forward), flush=True)
|
| 56 |
+
print(ref_lab.line(f'{variant} fused', rank, ref_fused), '|', strata(rank), flush=True)
|
| 57 |
+
if grid:
|
| 58 |
+
for wd in (0.5, 0.6, 0.9, 1.0):
|
| 59 |
+
print(ref_lab.line(f'{variant} fused wd={wd}', fused(lab, wd=wd)[1], ref_fused), flush=True)
|
| 60 |
+
for wn in (0.035, 0.07, 0.1):
|
| 61 |
+
print(ref_lab.line(f'{variant} fused wn={wn}', fused(lab, wn=wn)[1], ref_fused), flush=True)
|
| 62 |
+
for c in (0.25, 1.0):
|
| 63 |
+
print(ref_lab.line(f'{variant} fused c={c}', fused(lab, c=c)[1], ref_fused), flush=True)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
if __name__ == '__main__':
|
| 67 |
+
main()
|
shared/package-files/28/2877620d291592f08b06d878f89de2e7fee81bc252b17e82776f01632ac9a4f7/swap-quick-N5-recur-ms10-p48.log
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
released rule without consensus: Hit@1 0.7685 domain 0.9301 other 0.6062 macro 0.8650 Hit@5 0.8793 Hit@20 0.9358
|
| 2 |
+
lin w 0.05: Hit@1 0.7698 (+0.0013 [-0.0074, +0.0102]) macro 0.8680 (+0.0030 [-0.0006, +0.0068]) pools +23 -13 | other 0.6064 Hit@5 0.8830 Hit@20 0.9366
|
| 3 |
+
lin w 0.10: Hit@1 0.7708 (+0.0023 [-0.0065, +0.0101]) macro 0.8683 (+0.0032 [-0.0006, +0.0068]) pools +24 -13 | other 0.6085 Hit@5 0.8819 Hit@20 0.9357
|
| 4 |
+
lin w 0.20: Hit@1 0.7738 (+0.0053 [-0.0067, +0.0172]) macro 0.8683 (+0.0032 [-0.0003, +0.0071]) pools +26 -15 | other 0.6140 Hit@5 0.8771 Hit@20 0.9314
|