s42chen commited on
Commit
bebb825
·
verified ·
1 Parent(s): db4d99c

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/config.json +150 -0
  2. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/data.py +33 -0
  3. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/infer.sh +3 -0
  4. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/training.json +3685 -0
  5. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/config.json +194 -0
  6. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/covariances.py +25 -0
  7. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/data.py +33 -0
  8. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/features.py +63 -0
  9. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/infer.py +24 -0
  10. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/infer.sh +3 -0
  11. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/model.py +111 -0
  12. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/training.json +0 -0
  13. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S017/features.py +63 -0
  14. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S017/training.json +0 -0
  15. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/alpha_features.py +45 -0
  16. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/config.json +697 -0
  17. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/covariances.py +25 -0
  18. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/envelope_features.py +44 -0
  19. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/frequency_features.py +11 -0
  20. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/infer.py +24 -0
  21. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/infer.sh +3 -0
  22. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/model.py +277 -0
  23. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/tangent_features.py +25 -0
  24. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/MODEL_CARD.md +15 -0
  25. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/alpha_features.py +45 -0
  26. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/config.json +742 -0
  27. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/covariances.py +25 -0
  28. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/data.py +33 -0
  29. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/envelope_features.py +44 -0
  30. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/features.py +63 -0
  31. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/frequency_features.py +11 -0
  32. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/infer.py +24 -0
  33. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/infer.sh +3 -0
  34. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/model.py +350 -0
  35. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/ordinal_features.py +25 -0
  36. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/phase_features.py +37 -0
  37. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/tangent_features.py +25 -0
  38. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S091/student_features.py +34 -0
  39. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/MODEL_CARD.md +55 -0
  40. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/alpha_features.py +45 -0
  41. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/config.json +1033 -0
  42. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/coupling_features.py +34 -0
  43. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/covariances.py +25 -0
  44. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/data.py +33 -0
  45. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/envelope_features.py +44 -0
  46. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/features.py +63 -0
  47. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/frequency_features.py +11 -0
  48. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/infer.py +24 -0
  49. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/infer.sh +3 -0
  50. tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/model.py +515 -0
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/config.json ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "bci-shared-biot-fusiononly-v1",
3
+ "architecture": {
4
+ "channels": 32,
5
+ "width": 128,
6
+ "depth": 2,
7
+ "dropout": 0.5,
8
+ "wave_filters": 32
9
+ },
10
+ "initialization": {
11
+ "initialization": "jointly trained parent plus audited pretrained BIOT in a single coupled backbone",
12
+ "parent": "/workspace/research/runs/hybrid_wide1/epoch-004/weights.pt",
13
+ "audited_biot": {
14
+ "initialization": "pretrained",
15
+ "repo": "braindecode/biot-pretrained-six-datasets-18chs",
16
+ "revision": "7e9aabf302870012f73773276803aab97993951c",
17
+ "sha256": "a218f4054ae29962c6fd9d23d94c446d354c4f53e805a6771c85749ccc20baaa",
18
+ "license": "BSD-3-Clause",
19
+ "source_braindecode": "1.3.0",
20
+ "loaded_core_tensors": 56,
21
+ "skipped_classifier_tensors": 3
22
+ },
23
+ "neural_channel_indices": {
24
+ "faced": [
25
+ 0,
26
+ 1,
27
+ 2,
28
+ 3,
29
+ 4,
30
+ 5,
31
+ 6,
32
+ 7,
33
+ 8,
34
+ 9,
35
+ 10,
36
+ 11,
37
+ 12,
38
+ 13,
39
+ 14,
40
+ 15,
41
+ 16,
42
+ 17
43
+ ],
44
+ "tuev": [
45
+ 0,
46
+ 1,
47
+ 2,
48
+ 3,
49
+ 4,
50
+ 5,
51
+ 6,
52
+ 7,
53
+ 8,
54
+ 9,
55
+ 10,
56
+ 11,
57
+ 12,
58
+ 13,
59
+ 14,
60
+ 15
61
+ ],
62
+ "ad65": [
63
+ 0,
64
+ 1,
65
+ 2,
66
+ 3,
67
+ 4,
68
+ 5,
69
+ 6,
70
+ 7,
71
+ 8,
72
+ 9,
73
+ 10,
74
+ 11,
75
+ 12,
76
+ 13,
77
+ 14,
78
+ 15,
79
+ 16,
80
+ 17
81
+ ],
82
+ "openbmi": [
83
+ 0,
84
+ 1,
85
+ 3,
86
+ 5,
87
+ 12,
88
+ 14,
89
+ 23,
90
+ 25,
91
+ 28,
92
+ 30,
93
+ 2,
94
+ 6,
95
+ 11,
96
+ 15,
97
+ 22,
98
+ 26,
99
+ 4,
100
+ 13
101
+ ],
102
+ "longitudinal": [
103
+ 0,
104
+ 2,
105
+ 7,
106
+ 11,
107
+ 23,
108
+ 27,
109
+ 41,
110
+ 45,
111
+ 55,
112
+ 57,
113
+ 5,
114
+ 13,
115
+ 21,
116
+ 29,
117
+ 39,
118
+ 47,
119
+ 9,
120
+ 25
121
+ ]
122
+ },
123
+ "rebase": "incumbent waveform, fusion and four heads; joint BIOT and TUEV head from readout epoch 9; zero initialized neural interaction",
124
+ "jointly_finetuned_neural_parent": "/workspace/research/runs/hybrid_biot_readout1/epoch-009/weights.pt",
125
+ "tuev_high_dimensional_spectral_projection_disabled": true,
126
+ "frozen_prior_representation": true,
127
+ "nonclinical_head_updates": "only the 256 added BIOT columns; original columns and biases fixed",
128
+ "faced_openbmi_neural_path": "common nonlinear fusion only; direct head columns masked",
129
+ "retention_teacher": "/workspace/research/runs/hybrid_wide1/epoch-004",
130
+ "retention_loss": {
131
+ "split": "train",
132
+ "temperature": 2.0,
133
+ "kl_weight": 1.0,
134
+ "tracks": [
135
+ "faced",
136
+ "ad65",
137
+ "openbmi",
138
+ "longitudinal"
139
+ ]
140
+ }
141
+ },
142
+ "loader_scale": 0.01,
143
+ "tracks": [
144
+ "faced",
145
+ "tuev",
146
+ "ad65",
147
+ "openbmi",
148
+ "longitudinal"
149
+ ]
150
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/data.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from functools import lru_cache
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ @lru_cache(maxsize=8)
7
+ def array(path):return np.load(path,mmap_mode='r',allow_pickle=False)
8
+ class Dataset(torch.utils.data.Dataset):
9
+ def __init__(self,root,limit=None,cache=False):
10
+ self.root=Path(root)
11
+ self.rows=json.loads((self.root/'manifest.json').read_text())['samples']
12
+ if limit:self.rows=self.rows[:limit]
13
+ self.cached=None
14
+ if cache and self.rows:
15
+ from collections import defaultdict
16
+ groups=defaultdict(list)
17
+ for i,r in enumerate(self.rows):groups[r['path']].append((i,r['index']))
18
+ for name,indices in groups.items():
19
+ path=(self.root/name).resolve()
20
+ if not path.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
21
+ source=np.load(path,mmap_mode='r',allow_pickle=False)
22
+ if self.cached is None:self.cached=torch.empty((len(self.rows),*source.shape[1:]),dtype=torch.float32)
23
+ dst,src=zip(*indices)
24
+ self.cached[list(dst)]=torch.as_tensor(source[list(src)]/100,dtype=torch.float32)
25
+ def __len__(self):return len(self.rows)
26
+ def __getitem__(self,i):
27
+ r=self.rows[i]
28
+ if self.cached is not None:return self.cached[i],r.get('label',-1),r['id']
29
+ p=(self.root/r['path']).resolve()
30
+ if not p.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
31
+ # Division precedes float32 conversion, matching official FACED/TUEV collate.
32
+ x=np.asarray(array(str(p))[r['index']])/100
33
+ return torch.as_tensor(x,dtype=torch.float32),r.get('label',-1),r['id']
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/infer.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ exec python "$(dirname -- "$0")/infer.py" "$1" "$2"
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S007/training.json ADDED
@@ -0,0 +1,3685 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "settings": {
3
+ "source": "/workspace/research/runs/hybrid_biot_fusiononly1/epoch-007",
4
+ "common_fusion_shrinkage": 0.1,
5
+ "procedure": "fixed scalar applied equally to shared residual projection weights and bias; direct BIOT features and all other parameters retained"
6
+ },
7
+ "all_tracks_update_shared_backbone": true,
8
+ "parameters": 10168029,
9
+ "parent_training_history": [
10
+ {
11
+ "epoch": 1,
12
+ "validation": {
13
+ "faced": {
14
+ "class_counts": [
15
+ 180,
16
+ 180,
17
+ 180,
18
+ 180,
19
+ 240,
20
+ 180,
21
+ 180,
22
+ 180,
23
+ 180
24
+ ],
25
+ "predicted_class_counts": [
26
+ 159,
27
+ 189,
28
+ 178,
29
+ 211,
30
+ 242,
31
+ 167,
32
+ 182,
33
+ 176,
34
+ 176
35
+ ],
36
+ "confusion_matrix": [
37
+ [
38
+ 77,
39
+ 14,
40
+ 5,
41
+ 22,
42
+ 19,
43
+ 9,
44
+ 14,
45
+ 10,
46
+ 10
47
+ ],
48
+ [
49
+ 12,
50
+ 86,
51
+ 9,
52
+ 13,
53
+ 19,
54
+ 11,
55
+ 14,
56
+ 6,
57
+ 10
58
+ ],
59
+ [
60
+ 6,
61
+ 7,
62
+ 93,
63
+ 21,
64
+ 17,
65
+ 5,
66
+ 7,
67
+ 10,
68
+ 14
69
+ ],
70
+ [
71
+ 14,
72
+ 18,
73
+ 9,
74
+ 71,
75
+ 21,
76
+ 8,
77
+ 16,
78
+ 15,
79
+ 8
80
+ ],
81
+ [
82
+ 13,
83
+ 13,
84
+ 17,
85
+ 26,
86
+ 111,
87
+ 17,
88
+ 14,
89
+ 18,
90
+ 11
91
+ ],
92
+ [
93
+ 7,
94
+ 11,
95
+ 11,
96
+ 13,
97
+ 11,
98
+ 87,
99
+ 10,
100
+ 14,
101
+ 16
102
+ ],
103
+ [
104
+ 8,
105
+ 11,
106
+ 9,
107
+ 13,
108
+ 17,
109
+ 14,
110
+ 89,
111
+ 10,
112
+ 9
113
+ ],
114
+ [
115
+ 8,
116
+ 16,
117
+ 14,
118
+ 17,
119
+ 15,
120
+ 11,
121
+ 10,
122
+ 84,
123
+ 5
124
+ ],
125
+ [
126
+ 14,
127
+ 13,
128
+ 11,
129
+ 15,
130
+ 12,
131
+ 5,
132
+ 8,
133
+ 9,
134
+ 93
135
+ ]
136
+ ],
137
+ "per_class_recall": [
138
+ 0.42777777777777776,
139
+ 0.4777777777777778,
140
+ 0.5166666666666667,
141
+ 0.39444444444444443,
142
+ 0.4625,
143
+ 0.48333333333333334,
144
+ 0.49444444444444446,
145
+ 0.4666666666666667,
146
+ 0.5166666666666667
147
+ ],
148
+ "balanced_accuracy": 0.471141975308642,
149
+ "accuracy": 0.4708333333333333,
150
+ "weighted_f1": 0.4719396333394912,
151
+ "macro_f1": 0.47236032669046973,
152
+ "kappa": 0.40389865415010306,
153
+ "samples": 1680,
154
+ "reward": 0.471141975308642,
155
+ "subjects": 20
156
+ },
157
+ "tuev": {
158
+ "class_counts": [
159
+ 119,
160
+ 291,
161
+ 669,
162
+ 86,
163
+ 500,
164
+ 13822
165
+ ],
166
+ "predicted_class_counts": [
167
+ 1695,
168
+ 428,
169
+ 290,
170
+ 720,
171
+ 1682,
172
+ 10672
173
+ ],
174
+ "confusion_matrix": [
175
+ [
176
+ 45,
177
+ 38,
178
+ 25,
179
+ 4,
180
+ 0,
181
+ 7
182
+ ],
183
+ [
184
+ 17,
185
+ 84,
186
+ 0,
187
+ 96,
188
+ 94,
189
+ 0
190
+ ],
191
+ [
192
+ 154,
193
+ 16,
194
+ 158,
195
+ 86,
196
+ 255,
197
+ 0
198
+ ],
199
+ [
200
+ 8,
201
+ 4,
202
+ 0,
203
+ 74,
204
+ 0,
205
+ 0
206
+ ],
207
+ [
208
+ 4,
209
+ 0,
210
+ 0,
211
+ 24,
212
+ 424,
213
+ 48
214
+ ],
215
+ [
216
+ 1467,
217
+ 286,
218
+ 107,
219
+ 436,
220
+ 909,
221
+ 10617
222
+ ]
223
+ ],
224
+ "per_class_recall": [
225
+ 0.37815126050420167,
226
+ 0.28865979381443296,
227
+ 0.23617339312406577,
228
+ 0.8604651162790697,
229
+ 0.848,
230
+ 0.7681232817247866
231
+ ],
232
+ "balanced_accuracy": 0.5632621409077595,
233
+ "accuracy": 0.7362303867760057,
234
+ "weighted_f1": 0.8062779480900836,
235
+ "macro_f1": 0.3419908611855867,
236
+ "kappa": 0.30414149377793265,
237
+ "samples": 15487,
238
+ "reward": 0.5632621409077595,
239
+ "subjects": 58
240
+ },
241
+ "ad65": {
242
+ "class_counts": [
243
+ 464,
244
+ 393,
245
+ 486
246
+ ],
247
+ "predicted_class_counts": [
248
+ 533,
249
+ 324,
250
+ 486
251
+ ],
252
+ "confusion_matrix": [
253
+ [
254
+ 342,
255
+ 97,
256
+ 25
257
+ ],
258
+ [
259
+ 131,
260
+ 195,
261
+ 67
262
+ ],
263
+ [
264
+ 60,
265
+ 32,
266
+ 394
267
+ ]
268
+ ],
269
+ "per_class_recall": [
270
+ 0.7370689655172413,
271
+ 0.4961832061068702,
272
+ 0.8106995884773662
273
+ ],
274
+ "balanced_accuracy": 0.6813172533671592,
275
+ "accuracy": 0.6932241250930752,
276
+ "weighted_f1": 0.6895731074873461,
277
+ "macro_f1": 0.6802302724647475,
278
+ "kappa": 0.5361235537290547,
279
+ "samples": 1343,
280
+ "subject_metrics": {
281
+ "class_counts": [
282
+ 7,
283
+ 5,
284
+ 6
285
+ ],
286
+ "predicted_class_counts": [
287
+ 7,
288
+ 5,
289
+ 6
290
+ ],
291
+ "confusion_matrix": [
292
+ [
293
+ 5,
294
+ 2,
295
+ 0
296
+ ],
297
+ [
298
+ 2,
299
+ 3,
300
+ 0
301
+ ],
302
+ [
303
+ 0,
304
+ 0,
305
+ 6
306
+ ]
307
+ ],
308
+ "per_class_recall": [
309
+ 0.7142857142857143,
310
+ 0.6,
311
+ 1.0
312
+ ],
313
+ "balanced_accuracy": 0.7714285714285714,
314
+ "accuracy": 0.7777777777777778,
315
+ "weighted_f1": 0.7777777777777778,
316
+ "macro_f1": 0.7714285714285714,
317
+ "kappa": 0.6635514018691588
318
+ },
319
+ "reward": 0.7714285714285714,
320
+ "subjects": 18
321
+ },
322
+ "openbmi": {
323
+ "class_counts": [
324
+ 2200,
325
+ 2200
326
+ ],
327
+ "predicted_class_counts": [
328
+ 2059,
329
+ 2341
330
+ ],
331
+ "confusion_matrix": [
332
+ [
333
+ 1696,
334
+ 504
335
+ ],
336
+ [
337
+ 363,
338
+ 1837
339
+ ]
340
+ ],
341
+ "per_class_recall": [
342
+ 0.7709090909090909,
343
+ 0.835
344
+ ],
345
+ "balanced_accuracy": 0.8029545454545455,
346
+ "accuracy": 0.8029545454545455,
347
+ "weighted_f1": 0.8027519892716276,
348
+ "macro_f1": 0.8027519892716275,
349
+ "kappa": 0.605909090909091,
350
+ "samples": 4400,
351
+ "subject_scores": {
352
+ "19": 0.8425,
353
+ "35": 0.9525,
354
+ "34": 0.6425000000000001,
355
+ "51": 0.7475,
356
+ "20": 0.82,
357
+ "44": 0.94,
358
+ "24": 0.5974999999999999,
359
+ "15": 0.9,
360
+ "31": 0.88,
361
+ "26": 0.79,
362
+ "23": 0.72
363
+ },
364
+ "reward": 0.8029545454545456,
365
+ "subjects": 11
366
+ },
367
+ "longitudinal": {
368
+ "class_counts": [
369
+ 4260,
370
+ 4158
371
+ ],
372
+ "predicted_class_counts": [
373
+ 4576,
374
+ 3842
375
+ ],
376
+ "confusion_matrix": [
377
+ [
378
+ 3659,
379
+ 601
380
+ ],
381
+ [
382
+ 917,
383
+ 3241
384
+ ]
385
+ ],
386
+ "per_class_recall": [
387
+ 0.8589201877934273,
388
+ 0.7794612794612794
389
+ ],
390
+ "balanced_accuracy": 0.8191907336273534,
391
+ "accuracy": 0.819672131147541,
392
+ "weighted_f1": 0.8193351694632243,
393
+ "macro_f1": 0.8192264033499321,
394
+ "kappa": 0.6389628187072087,
395
+ "samples": 8418,
396
+ "subject_scores": {
397
+ "sub-G2021": 0.8384604490935013,
398
+ "sub-G2007": 0.7643956272712626,
399
+ "sub-G2019": 0.82505149822325,
400
+ "sub-G2031": 0.788678938415735,
401
+ "sub-G2015": 0.8429774626319118,
402
+ "sub-CTR002": 0.9869493251846193,
403
+ "sub-G2011": 0.765938925240826,
404
+ "sub-G2035": 0.9564871486872261,
405
+ "sub-CTR003": 0.5773809523809523
406
+ },
407
+ "reward": 0.816257814125476,
408
+ "subjects": 9
409
+ }
410
+ },
411
+ "losses": {
412
+ "faced": 1.1245755493640899,
413
+ "tuev": 0.8888261109590531,
414
+ "ad65": 0.40307730436325073,
415
+ "openbmi": 0.41378349512815477,
416
+ "longitudinal": 0.23857621401548385
417
+ },
418
+ "seconds": 33.768038749694824
419
+ },
420
+ {
421
+ "epoch": 2,
422
+ "validation": {
423
+ "faced": {
424
+ "class_counts": [
425
+ 180,
426
+ 180,
427
+ 180,
428
+ 180,
429
+ 240,
430
+ 180,
431
+ 180,
432
+ 180,
433
+ 180
434
+ ],
435
+ "predicted_class_counts": [
436
+ 160,
437
+ 189,
438
+ 179,
439
+ 211,
440
+ 241,
441
+ 165,
442
+ 182,
443
+ 176,
444
+ 177
445
+ ],
446
+ "confusion_matrix": [
447
+ [
448
+ 77,
449
+ 14,
450
+ 5,
451
+ 22,
452
+ 19,
453
+ 9,
454
+ 14,
455
+ 10,
456
+ 10
457
+ ],
458
+ [
459
+ 12,
460
+ 86,
461
+ 9,
462
+ 13,
463
+ 19,
464
+ 11,
465
+ 14,
466
+ 6,
467
+ 10
468
+ ],
469
+ [
470
+ 6,
471
+ 7,
472
+ 93,
473
+ 20,
474
+ 17,
475
+ 5,
476
+ 7,
477
+ 10,
478
+ 15
479
+ ],
480
+ [
481
+ 14,
482
+ 18,
483
+ 9,
484
+ 71,
485
+ 21,
486
+ 8,
487
+ 16,
488
+ 15,
489
+ 8
490
+ ],
491
+ [
492
+ 14,
493
+ 13,
494
+ 17,
495
+ 26,
496
+ 110,
497
+ 17,
498
+ 14,
499
+ 18,
500
+ 11
501
+ ],
502
+ [
503
+ 7,
504
+ 11,
505
+ 11,
506
+ 14,
507
+ 11,
508
+ 86,
509
+ 10,
510
+ 14,
511
+ 16
512
+ ],
513
+ [
514
+ 8,
515
+ 11,
516
+ 9,
517
+ 13,
518
+ 17,
519
+ 14,
520
+ 89,
521
+ 10,
522
+ 9
523
+ ],
524
+ [
525
+ 8,
526
+ 16,
527
+ 15,
528
+ 17,
529
+ 15,
530
+ 10,
531
+ 10,
532
+ 84,
533
+ 5
534
+ ],
535
+ [
536
+ 14,
537
+ 13,
538
+ 11,
539
+ 15,
540
+ 12,
541
+ 5,
542
+ 8,
543
+ 9,
544
+ 93
545
+ ]
546
+ ],
547
+ "per_class_recall": [
548
+ 0.42777777777777776,
549
+ 0.4777777777777778,
550
+ 0.5166666666666667,
551
+ 0.39444444444444443,
552
+ 0.4583333333333333,
553
+ 0.4777777777777778,
554
+ 0.49444444444444446,
555
+ 0.4666666666666667,
556
+ 0.5166666666666667
557
+ ],
558
+ "balanced_accuracy": 0.4700617283950618,
559
+ "accuracy": 0.46964285714285714,
560
+ "weighted_f1": 0.4707177428763859,
561
+ "macro_f1": 0.4712117164132721,
562
+ "kappa": 0.40257190066811943,
563
+ "samples": 1680,
564
+ "reward": 0.4700617283950618,
565
+ "subjects": 20
566
+ },
567
+ "tuev": {
568
+ "class_counts": [
569
+ 119,
570
+ 291,
571
+ 669,
572
+ 86,
573
+ 500,
574
+ 13822
575
+ ],
576
+ "predicted_class_counts": [
577
+ 1895,
578
+ 593,
579
+ 224,
580
+ 690,
581
+ 1501,
582
+ 10584
583
+ ],
584
+ "confusion_matrix": [
585
+ [
586
+ 55,
587
+ 38,
588
+ 18,
589
+ 4,
590
+ 0,
591
+ 4
592
+ ],
593
+ [
594
+ 17,
595
+ 171,
596
+ 0,
597
+ 61,
598
+ 42,
599
+ 0
600
+ ],
601
+ [
602
+ 172,
603
+ 116,
604
+ 143,
605
+ 69,
606
+ 169,
607
+ 0
608
+ ],
609
+ [
610
+ 7,
611
+ 4,
612
+ 0,
613
+ 75,
614
+ 0,
615
+ 0
616
+ ],
617
+ [
618
+ 4,
619
+ 0,
620
+ 0,
621
+ 25,
622
+ 412,
623
+ 59
624
+ ],
625
+ [
626
+ 1640,
627
+ 264,
628
+ 63,
629
+ 456,
630
+ 878,
631
+ 10521
632
+ ]
633
+ ],
634
+ "per_class_recall": [
635
+ 0.46218487394957986,
636
+ 0.5876288659793815,
637
+ 0.21375186846038863,
638
+ 0.872093023255814,
639
+ 0.824,
640
+ 0.761177832441036
641
+ ],
642
+ "balanced_accuracy": 0.6201394106810333,
643
+ "accuracy": 0.7346161296571317,
644
+ "weighted_f1": 0.8053662242323045,
645
+ "macro_f1": 0.37150372912054547,
646
+ "kappa": 0.30961610971125775,
647
+ "samples": 15487,
648
+ "reward": 0.6201394106810333,
649
+ "subjects": 58
650
+ },
651
+ "ad65": {
652
+ "class_counts": [
653
+ 464,
654
+ 393,
655
+ 486
656
+ ],
657
+ "predicted_class_counts": [
658
+ 533,
659
+ 324,
660
+ 486
661
+ ],
662
+ "confusion_matrix": [
663
+ [
664
+ 342,
665
+ 97,
666
+ 25
667
+ ],
668
+ [
669
+ 131,
670
+ 195,
671
+ 67
672
+ ],
673
+ [
674
+ 60,
675
+ 32,
676
+ 394
677
+ ]
678
+ ],
679
+ "per_class_recall": [
680
+ 0.7370689655172413,
681
+ 0.4961832061068702,
682
+ 0.8106995884773662
683
+ ],
684
+ "balanced_accuracy": 0.6813172533671592,
685
+ "accuracy": 0.6932241250930752,
686
+ "weighted_f1": 0.6895731074873461,
687
+ "macro_f1": 0.6802302724647475,
688
+ "kappa": 0.5361235537290547,
689
+ "samples": 1343,
690
+ "subject_metrics": {
691
+ "class_counts": [
692
+ 7,
693
+ 5,
694
+ 6
695
+ ],
696
+ "predicted_class_counts": [
697
+ 7,
698
+ 5,
699
+ 6
700
+ ],
701
+ "confusion_matrix": [
702
+ [
703
+ 5,
704
+ 2,
705
+ 0
706
+ ],
707
+ [
708
+ 2,
709
+ 3,
710
+ 0
711
+ ],
712
+ [
713
+ 0,
714
+ 0,
715
+ 6
716
+ ]
717
+ ],
718
+ "per_class_recall": [
719
+ 0.7142857142857143,
720
+ 0.6,
721
+ 1.0
722
+ ],
723
+ "balanced_accuracy": 0.7714285714285714,
724
+ "accuracy": 0.7777777777777778,
725
+ "weighted_f1": 0.7777777777777778,
726
+ "macro_f1": 0.7714285714285714,
727
+ "kappa": 0.6635514018691588
728
+ },
729
+ "reward": 0.7714285714285714,
730
+ "subjects": 18
731
+ },
732
+ "openbmi": {
733
+ "class_counts": [
734
+ 2200,
735
+ 2200
736
+ ],
737
+ "predicted_class_counts": [
738
+ 2059,
739
+ 2341
740
+ ],
741
+ "confusion_matrix": [
742
+ [
743
+ 1696,
744
+ 504
745
+ ],
746
+ [
747
+ 363,
748
+ 1837
749
+ ]
750
+ ],
751
+ "per_class_recall": [
752
+ 0.7709090909090909,
753
+ 0.835
754
+ ],
755
+ "balanced_accuracy": 0.8029545454545455,
756
+ "accuracy": 0.8029545454545455,
757
+ "weighted_f1": 0.8027519892716276,
758
+ "macro_f1": 0.8027519892716275,
759
+ "kappa": 0.605909090909091,
760
+ "samples": 4400,
761
+ "subject_scores": {
762
+ "19": 0.8425,
763
+ "35": 0.9525,
764
+ "34": 0.6425000000000001,
765
+ "51": 0.7475,
766
+ "20": 0.82,
767
+ "44": 0.94,
768
+ "24": 0.5974999999999999,
769
+ "15": 0.9,
770
+ "31": 0.88,
771
+ "26": 0.79,
772
+ "23": 0.72
773
+ },
774
+ "reward": 0.8029545454545456,
775
+ "subjects": 11
776
+ },
777
+ "longitudinal": {
778
+ "class_counts": [
779
+ 4260,
780
+ 4158
781
+ ],
782
+ "predicted_class_counts": [
783
+ 4575,
784
+ 3843
785
+ ],
786
+ "confusion_matrix": [
787
+ [
788
+ 3659,
789
+ 601
790
+ ],
791
+ [
792
+ 916,
793
+ 3242
794
+ ]
795
+ ],
796
+ "per_class_recall": [
797
+ 0.8589201877934273,
798
+ 0.7797017797017797
799
+ ],
800
+ "balanced_accuracy": 0.8193109837476035,
801
+ "accuracy": 0.8197909242100261,
802
+ "weighted_f1": 0.8194560571387214,
803
+ "macro_f1": 0.8193476239918227,
804
+ "kappa": 0.6392016958792203,
805
+ "samples": 8418,
806
+ "subject_scores": {
807
+ "sub-G2021": 0.8384604490935013,
808
+ "sub-G2007": 0.7652179956923153,
809
+ "sub-G2019": 0.82505149822325,
810
+ "sub-G2031": 0.788678938415735,
811
+ "sub-G2015": 0.8429774626319118,
812
+ "sub-CTR002": 0.9869493251846193,
813
+ "sub-G2011": 0.765938925240826,
814
+ "sub-G2035": 0.9564871486872261,
815
+ "sub-CTR003": 0.5773809523809523
816
+ },
817
+ "reward": 0.8163491883944819,
818
+ "subjects": 9
819
+ }
820
+ },
821
+ "losses": {
822
+ "faced": 1.1657944917678833,
823
+ "tuev": 0.8340819418430329,
824
+ "ad65": 0.36363950222730634,
825
+ "openbmi": 0.418754418194294,
826
+ "longitudinal": 0.24928389638662338
827
+ },
828
+ "seconds": 46.29122805595398
829
+ },
830
+ {
831
+ "epoch": 3,
832
+ "validation": {
833
+ "faced": {
834
+ "class_counts": [
835
+ 180,
836
+ 180,
837
+ 180,
838
+ 180,
839
+ 240,
840
+ 180,
841
+ 180,
842
+ 180,
843
+ 180
844
+ ],
845
+ "predicted_class_counts": [
846
+ 159,
847
+ 191,
848
+ 179,
849
+ 210,
850
+ 240,
851
+ 167,
852
+ 182,
853
+ 175,
854
+ 177
855
+ ],
856
+ "confusion_matrix": [
857
+ [
858
+ 77,
859
+ 14,
860
+ 5,
861
+ 22,
862
+ 19,
863
+ 9,
864
+ 14,
865
+ 10,
866
+ 10
867
+ ],
868
+ [
869
+ 12,
870
+ 87,
871
+ 9,
872
+ 13,
873
+ 19,
874
+ 11,
875
+ 14,
876
+ 5,
877
+ 10
878
+ ],
879
+ [
880
+ 6,
881
+ 7,
882
+ 93,
883
+ 20,
884
+ 17,
885
+ 5,
886
+ 7,
887
+ 10,
888
+ 15
889
+ ],
890
+ [
891
+ 14,
892
+ 18,
893
+ 9,
894
+ 71,
895
+ 21,
896
+ 8,
897
+ 16,
898
+ 15,
899
+ 8
900
+ ],
901
+ [
902
+ 14,
903
+ 13,
904
+ 17,
905
+ 26,
906
+ 110,
907
+ 17,
908
+ 14,
909
+ 18,
910
+ 11
911
+ ],
912
+ [
913
+ 7,
914
+ 11,
915
+ 11,
916
+ 13,
917
+ 10,
918
+ 88,
919
+ 10,
920
+ 14,
921
+ 16
922
+ ],
923
+ [
924
+ 8,
925
+ 11,
926
+ 9,
927
+ 13,
928
+ 17,
929
+ 14,
930
+ 89,
931
+ 10,
932
+ 9
933
+ ],
934
+ [
935
+ 8,
936
+ 16,
937
+ 15,
938
+ 17,
939
+ 15,
940
+ 10,
941
+ 10,
942
+ 84,
943
+ 5
944
+ ],
945
+ [
946
+ 13,
947
+ 14,
948
+ 11,
949
+ 15,
950
+ 12,
951
+ 5,
952
+ 8,
953
+ 9,
954
+ 93
955
+ ]
956
+ ],
957
+ "per_class_recall": [
958
+ 0.42777777777777776,
959
+ 0.48333333333333334,
960
+ 0.5166666666666667,
961
+ 0.39444444444444443,
962
+ 0.4583333333333333,
963
+ 0.4888888888888889,
964
+ 0.49444444444444446,
965
+ 0.4666666666666667,
966
+ 0.5166666666666667
967
+ ],
968
+ "balanced_accuracy": 0.47191358024691366,
969
+ "accuracy": 0.4714285714285714,
970
+ "weighted_f1": 0.47247478547825605,
971
+ "macro_f1": 0.4729985429651051,
972
+ "kappa": 0.4045977011494253,
973
+ "samples": 1680,
974
+ "reward": 0.47191358024691366,
975
+ "subjects": 20
976
+ },
977
+ "tuev": {
978
+ "class_counts": [
979
+ 119,
980
+ 291,
981
+ 669,
982
+ 86,
983
+ 500,
984
+ 13822
985
+ ],
986
+ "predicted_class_counts": [
987
+ 1282,
988
+ 414,
989
+ 232,
990
+ 726,
991
+ 2052,
992
+ 10781
993
+ ],
994
+ "confusion_matrix": [
995
+ [
996
+ 39,
997
+ 38,
998
+ 28,
999
+ 0,
1000
+ 0,
1001
+ 14
1002
+ ],
1003
+ [
1004
+ 0,
1005
+ 84,
1006
+ 0,
1007
+ 113,
1008
+ 94,
1009
+ 0
1010
+ ],
1011
+ [
1012
+ 113,
1013
+ 26,
1014
+ 141,
1015
+ 114,
1016
+ 275,
1017
+ 0
1018
+ ],
1019
+ [
1020
+ 7,
1021
+ 2,
1022
+ 0,
1023
+ 76,
1024
+ 0,
1025
+ 1
1026
+ ],
1027
+ [
1028
+ 2,
1029
+ 0,
1030
+ 0,
1031
+ 48,
1032
+ 425,
1033
+ 25
1034
+ ],
1035
+ [
1036
+ 1121,
1037
+ 264,
1038
+ 63,
1039
+ 375,
1040
+ 1258,
1041
+ 10741
1042
+ ]
1043
+ ],
1044
+ "per_class_recall": [
1045
+ 0.3277310924369748,
1046
+ 0.28865979381443296,
1047
+ 0.21076233183856502,
1048
+ 0.8837209302325582,
1049
+ 0.85,
1050
+ 0.777094487049631
1051
+ ],
1052
+ "balanced_accuracy": 0.5563281058953603,
1053
+ "accuracy": 0.7429456963905211,
1054
+ "weighted_f1": 0.809492456839227,
1055
+ "macro_f1": 0.3333946220040736,
1056
+ "kappa": 0.3097083999217113,
1057
+ "samples": 15487,
1058
+ "reward": 0.5563281058953603,
1059
+ "subjects": 58
1060
+ },
1061
+ "ad65": {
1062
+ "class_counts": [
1063
+ 464,
1064
+ 393,
1065
+ 486
1066
+ ],
1067
+ "predicted_class_counts": [
1068
+ 533,
1069
+ 324,
1070
+ 486
1071
+ ],
1072
+ "confusion_matrix": [
1073
+ [
1074
+ 342,
1075
+ 97,
1076
+ 25
1077
+ ],
1078
+ [
1079
+ 131,
1080
+ 195,
1081
+ 67
1082
+ ],
1083
+ [
1084
+ 60,
1085
+ 32,
1086
+ 394
1087
+ ]
1088
+ ],
1089
+ "per_class_recall": [
1090
+ 0.7370689655172413,
1091
+ 0.4961832061068702,
1092
+ 0.8106995884773662
1093
+ ],
1094
+ "balanced_accuracy": 0.6813172533671592,
1095
+ "accuracy": 0.6932241250930752,
1096
+ "weighted_f1": 0.6895731074873461,
1097
+ "macro_f1": 0.6802302724647475,
1098
+ "kappa": 0.5361235537290547,
1099
+ "samples": 1343,
1100
+ "subject_metrics": {
1101
+ "class_counts": [
1102
+ 7,
1103
+ 5,
1104
+ 6
1105
+ ],
1106
+ "predicted_class_counts": [
1107
+ 7,
1108
+ 5,
1109
+ 6
1110
+ ],
1111
+ "confusion_matrix": [
1112
+ [
1113
+ 5,
1114
+ 2,
1115
+ 0
1116
+ ],
1117
+ [
1118
+ 2,
1119
+ 3,
1120
+ 0
1121
+ ],
1122
+ [
1123
+ 0,
1124
+ 0,
1125
+ 6
1126
+ ]
1127
+ ],
1128
+ "per_class_recall": [
1129
+ 0.7142857142857143,
1130
+ 0.6,
1131
+ 1.0
1132
+ ],
1133
+ "balanced_accuracy": 0.7714285714285714,
1134
+ "accuracy": 0.7777777777777778,
1135
+ "weighted_f1": 0.7777777777777778,
1136
+ "macro_f1": 0.7714285714285714,
1137
+ "kappa": 0.6635514018691588
1138
+ },
1139
+ "reward": 0.7714285714285714,
1140
+ "subjects": 18
1141
+ },
1142
+ "openbmi": {
1143
+ "class_counts": [
1144
+ 2200,
1145
+ 2200
1146
+ ],
1147
+ "predicted_class_counts": [
1148
+ 2056,
1149
+ 2344
1150
+ ],
1151
+ "confusion_matrix": [
1152
+ [
1153
+ 1694,
1154
+ 506
1155
+ ],
1156
+ [
1157
+ 362,
1158
+ 1838
1159
+ ]
1160
+ ],
1161
+ "per_class_recall": [
1162
+ 0.77,
1163
+ 0.8354545454545454
1164
+ ],
1165
+ "balanced_accuracy": 0.8027272727272727,
1166
+ "accuracy": 0.8027272727272727,
1167
+ "weighted_f1": 0.8025157524091919,
1168
+ "macro_f1": 0.8025157524091919,
1169
+ "kappa": 0.6054545454545455,
1170
+ "samples": 4400,
1171
+ "subject_scores": {
1172
+ "19": 0.845,
1173
+ "35": 0.9525,
1174
+ "34": 0.6425000000000001,
1175
+ "51": 0.7475,
1176
+ "20": 0.8174999999999999,
1177
+ "44": 0.94,
1178
+ "24": 0.5974999999999999,
1179
+ "15": 0.9,
1180
+ "31": 0.8775,
1181
+ "26": 0.79,
1182
+ "23": 0.72
1183
+ },
1184
+ "reward": 0.8027272727272727,
1185
+ "subjects": 11
1186
+ },
1187
+ "longitudinal": {
1188
+ "class_counts": [
1189
+ 4260,
1190
+ 4158
1191
+ ],
1192
+ "predicted_class_counts": [
1193
+ 4575,
1194
+ 3843
1195
+ ],
1196
+ "confusion_matrix": [
1197
+ [
1198
+ 3659,
1199
+ 601
1200
+ ],
1201
+ [
1202
+ 916,
1203
+ 3242
1204
+ ]
1205
+ ],
1206
+ "per_class_recall": [
1207
+ 0.8589201877934273,
1208
+ 0.7797017797017797
1209
+ ],
1210
+ "balanced_accuracy": 0.8193109837476035,
1211
+ "accuracy": 0.8197909242100261,
1212
+ "weighted_f1": 0.8194560571387214,
1213
+ "macro_f1": 0.8193476239918227,
1214
+ "kappa": 0.6392016958792203,
1215
+ "samples": 8418,
1216
+ "subject_scores": {
1217
+ "sub-G2021": 0.8384604490935013,
1218
+ "sub-G2007": 0.7652179956923153,
1219
+ "sub-G2019": 0.82505149822325,
1220
+ "sub-G2031": 0.788678938415735,
1221
+ "sub-G2015": 0.8429774626319118,
1222
+ "sub-CTR002": 0.9869493251846193,
1223
+ "sub-G2011": 0.765938925240826,
1224
+ "sub-G2035": 0.9564871486872261,
1225
+ "sub-CTR003": 0.5773809523809523
1226
+ },
1227
+ "reward": 0.8163491883944819,
1228
+ "subjects": 9
1229
+ }
1230
+ },
1231
+ "losses": {
1232
+ "faced": 1.1443339705467224,
1233
+ "tuev": 0.8239678978919983,
1234
+ "ad65": 0.38756211251020434,
1235
+ "openbmi": 0.4083534896373749,
1236
+ "longitudinal": 0.24697063267230987
1237
+ },
1238
+ "seconds": 58.648759841918945
1239
+ },
1240
+ {
1241
+ "epoch": 4,
1242
+ "validation": {
1243
+ "faced": {
1244
+ "class_counts": [
1245
+ 180,
1246
+ 180,
1247
+ 180,
1248
+ 180,
1249
+ 240,
1250
+ 180,
1251
+ 180,
1252
+ 180,
1253
+ 180
1254
+ ],
1255
+ "predicted_class_counts": [
1256
+ 157,
1257
+ 191,
1258
+ 179,
1259
+ 214,
1260
+ 241,
1261
+ 166,
1262
+ 181,
1263
+ 175,
1264
+ 176
1265
+ ],
1266
+ "confusion_matrix": [
1267
+ [
1268
+ 77,
1269
+ 14,
1270
+ 5,
1271
+ 23,
1272
+ 19,
1273
+ 9,
1274
+ 13,
1275
+ 10,
1276
+ 10
1277
+ ],
1278
+ [
1279
+ 12,
1280
+ 87,
1281
+ 9,
1282
+ 13,
1283
+ 19,
1284
+ 11,
1285
+ 14,
1286
+ 5,
1287
+ 10
1288
+ ],
1289
+ [
1290
+ 6,
1291
+ 7,
1292
+ 93,
1293
+ 21,
1294
+ 17,
1295
+ 5,
1296
+ 7,
1297
+ 10,
1298
+ 14
1299
+ ],
1300
+ [
1301
+ 14,
1302
+ 18,
1303
+ 9,
1304
+ 71,
1305
+ 21,
1306
+ 8,
1307
+ 16,
1308
+ 15,
1309
+ 8
1310
+ ],
1311
+ [
1312
+ 13,
1313
+ 13,
1314
+ 17,
1315
+ 26,
1316
+ 111,
1317
+ 17,
1318
+ 14,
1319
+ 18,
1320
+ 11
1321
+ ],
1322
+ [
1323
+ 6,
1324
+ 11,
1325
+ 11,
1326
+ 15,
1327
+ 10,
1328
+ 87,
1329
+ 10,
1330
+ 14,
1331
+ 16
1332
+ ],
1333
+ [
1334
+ 8,
1335
+ 11,
1336
+ 9,
1337
+ 13,
1338
+ 17,
1339
+ 14,
1340
+ 89,
1341
+ 10,
1342
+ 9
1343
+ ],
1344
+ [
1345
+ 8,
1346
+ 16,
1347
+ 15,
1348
+ 17,
1349
+ 15,
1350
+ 10,
1351
+ 10,
1352
+ 84,
1353
+ 5
1354
+ ],
1355
+ [
1356
+ 13,
1357
+ 14,
1358
+ 11,
1359
+ 15,
1360
+ 12,
1361
+ 5,
1362
+ 8,
1363
+ 9,
1364
+ 93
1365
+ ]
1366
+ ],
1367
+ "per_class_recall": [
1368
+ 0.42777777777777776,
1369
+ 0.48333333333333334,
1370
+ 0.5166666666666667,
1371
+ 0.39444444444444443,
1372
+ 0.4625,
1373
+ 0.48333333333333334,
1374
+ 0.49444444444444446,
1375
+ 0.4666666666666667,
1376
+ 0.5166666666666667
1377
+ ],
1378
+ "balanced_accuracy": 0.47175925925925927,
1379
+ "accuracy": 0.4714285714285714,
1380
+ "weighted_f1": 0.4726659490617784,
1381
+ "macro_f1": 0.4730780782293087,
1382
+ "kappa": 0.4045834430901123,
1383
+ "samples": 1680,
1384
+ "reward": 0.47175925925925927,
1385
+ "subjects": 20
1386
+ },
1387
+ "tuev": {
1388
+ "class_counts": [
1389
+ 119,
1390
+ 291,
1391
+ 669,
1392
+ 86,
1393
+ 500,
1394
+ 13822
1395
+ ],
1396
+ "predicted_class_counts": [
1397
+ 1566,
1398
+ 429,
1399
+ 172,
1400
+ 795,
1401
+ 2461,
1402
+ 10064
1403
+ ],
1404
+ "confusion_matrix": [
1405
+ [
1406
+ 40,
1407
+ 38,
1408
+ 25,
1409
+ 4,
1410
+ 0,
1411
+ 12
1412
+ ],
1413
+ [
1414
+ 0,
1415
+ 119,
1416
+ 0,
1417
+ 78,
1418
+ 94,
1419
+ 0
1420
+ ],
1421
+ [
1422
+ 134,
1423
+ 28,
1424
+ 128,
1425
+ 103,
1426
+ 276,
1427
+ 0
1428
+ ],
1429
+ [
1430
+ 3,
1431
+ 2,
1432
+ 0,
1433
+ 81,
1434
+ 0,
1435
+ 0
1436
+ ],
1437
+ [
1438
+ 4,
1439
+ 0,
1440
+ 0,
1441
+ 48,
1442
+ 424,
1443
+ 24
1444
+ ],
1445
+ [
1446
+ 1385,
1447
+ 242,
1448
+ 19,
1449
+ 481,
1450
+ 1667,
1451
+ 10028
1452
+ ]
1453
+ ],
1454
+ "per_class_recall": [
1455
+ 0.33613445378151263,
1456
+ 0.40893470790378006,
1457
+ 0.19133034379671152,
1458
+ 0.9418604651162791,
1459
+ 0.848,
1460
+ 0.7255100564317755
1461
+ ],
1462
+ "balanced_accuracy": 0.5752950045050098,
1463
+ "accuracy": 0.6986504810486214,
1464
+ "weighted_f1": 0.7793765940667069,
1465
+ "macro_f1": 0.3320599230522449,
1466
+ "kappa": 0.27004943473083465,
1467
+ "samples": 15487,
1468
+ "reward": 0.5752950045050098,
1469
+ "subjects": 58
1470
+ },
1471
+ "ad65": {
1472
+ "class_counts": [
1473
+ 464,
1474
+ 393,
1475
+ 486
1476
+ ],
1477
+ "predicted_class_counts": [
1478
+ 533,
1479
+ 324,
1480
+ 486
1481
+ ],
1482
+ "confusion_matrix": [
1483
+ [
1484
+ 342,
1485
+ 97,
1486
+ 25
1487
+ ],
1488
+ [
1489
+ 131,
1490
+ 195,
1491
+ 67
1492
+ ],
1493
+ [
1494
+ 60,
1495
+ 32,
1496
+ 394
1497
+ ]
1498
+ ],
1499
+ "per_class_recall": [
1500
+ 0.7370689655172413,
1501
+ 0.4961832061068702,
1502
+ 0.8106995884773662
1503
+ ],
1504
+ "balanced_accuracy": 0.6813172533671592,
1505
+ "accuracy": 0.6932241250930752,
1506
+ "weighted_f1": 0.6895731074873461,
1507
+ "macro_f1": 0.6802302724647475,
1508
+ "kappa": 0.5361235537290547,
1509
+ "samples": 1343,
1510
+ "subject_metrics": {
1511
+ "class_counts": [
1512
+ 7,
1513
+ 5,
1514
+ 6
1515
+ ],
1516
+ "predicted_class_counts": [
1517
+ 7,
1518
+ 5,
1519
+ 6
1520
+ ],
1521
+ "confusion_matrix": [
1522
+ [
1523
+ 5,
1524
+ 2,
1525
+ 0
1526
+ ],
1527
+ [
1528
+ 2,
1529
+ 3,
1530
+ 0
1531
+ ],
1532
+ [
1533
+ 0,
1534
+ 0,
1535
+ 6
1536
+ ]
1537
+ ],
1538
+ "per_class_recall": [
1539
+ 0.7142857142857143,
1540
+ 0.6,
1541
+ 1.0
1542
+ ],
1543
+ "balanced_accuracy": 0.7714285714285714,
1544
+ "accuracy": 0.7777777777777778,
1545
+ "weighted_f1": 0.7777777777777778,
1546
+ "macro_f1": 0.7714285714285714,
1547
+ "kappa": 0.6635514018691588
1548
+ },
1549
+ "reward": 0.7714285714285714,
1550
+ "subjects": 18
1551
+ },
1552
+ "openbmi": {
1553
+ "class_counts": [
1554
+ 2200,
1555
+ 2200
1556
+ ],
1557
+ "predicted_class_counts": [
1558
+ 2056,
1559
+ 2344
1560
+ ],
1561
+ "confusion_matrix": [
1562
+ [
1563
+ 1694,
1564
+ 506
1565
+ ],
1566
+ [
1567
+ 362,
1568
+ 1838
1569
+ ]
1570
+ ],
1571
+ "per_class_recall": [
1572
+ 0.77,
1573
+ 0.8354545454545454
1574
+ ],
1575
+ "balanced_accuracy": 0.8027272727272727,
1576
+ "accuracy": 0.8027272727272727,
1577
+ "weighted_f1": 0.8025157524091919,
1578
+ "macro_f1": 0.8025157524091919,
1579
+ "kappa": 0.6054545454545455,
1580
+ "samples": 4400,
1581
+ "subject_scores": {
1582
+ "19": 0.845,
1583
+ "35": 0.9525,
1584
+ "34": 0.6425000000000001,
1585
+ "51": 0.7475,
1586
+ "20": 0.8174999999999999,
1587
+ "44": 0.94,
1588
+ "24": 0.5974999999999999,
1589
+ "15": 0.9,
1590
+ "31": 0.8775,
1591
+ "26": 0.79,
1592
+ "23": 0.72
1593
+ },
1594
+ "reward": 0.8027272727272727,
1595
+ "subjects": 11
1596
+ },
1597
+ "longitudinal": {
1598
+ "class_counts": [
1599
+ 4260,
1600
+ 4158
1601
+ ],
1602
+ "predicted_class_counts": [
1603
+ 4574,
1604
+ 3844
1605
+ ],
1606
+ "confusion_matrix": [
1607
+ [
1608
+ 3658,
1609
+ 602
1610
+ ],
1611
+ [
1612
+ 916,
1613
+ 3242
1614
+ ]
1615
+ ],
1616
+ "per_class_recall": [
1617
+ 0.8586854460093897,
1618
+ 0.7797017797017797
1619
+ ],
1620
+ "balanced_accuracy": 0.8191936128555847,
1621
+ "accuracy": 0.819672131147541,
1622
+ "weighted_f1": 0.8193389120476722,
1623
+ "macro_f1": 0.819230668900581,
1624
+ "kappa": 0.6389648996053923,
1625
+ "samples": 8418,
1626
+ "subject_scores": {
1627
+ "sub-G2021": 0.837643455629449,
1628
+ "sub-G2007": 0.7652179956923153,
1629
+ "sub-G2019": 0.82505149822325,
1630
+ "sub-G2031": 0.788678938415735,
1631
+ "sub-G2015": 0.8429774626319118,
1632
+ "sub-CTR002": 0.9869493251846193,
1633
+ "sub-G2011": 0.765938925240826,
1634
+ "sub-G2035": 0.9564871486872261,
1635
+ "sub-CTR003": 0.5773809523809523
1636
+ },
1637
+ "reward": 0.8162584113429205,
1638
+ "subjects": 9
1639
+ }
1640
+ },
1641
+ "losses": {
1642
+ "faced": 1.1290458619594574,
1643
+ "tuev": 0.8124855548143387,
1644
+ "ad65": 0.3871454387903214,
1645
+ "openbmi": 0.4081333264708519,
1646
+ "longitudinal": 0.24221988543868064
1647
+ },
1648
+ "seconds": 70.8283851146698
1649
+ },
1650
+ {
1651
+ "epoch": 5,
1652
+ "validation": {
1653
+ "faced": {
1654
+ "class_counts": [
1655
+ 180,
1656
+ 180,
1657
+ 180,
1658
+ 180,
1659
+ 240,
1660
+ 180,
1661
+ 180,
1662
+ 180,
1663
+ 180
1664
+ ],
1665
+ "predicted_class_counts": [
1666
+ 160,
1667
+ 190,
1668
+ 179,
1669
+ 213,
1670
+ 241,
1671
+ 165,
1672
+ 181,
1673
+ 175,
1674
+ 176
1675
+ ],
1676
+ "confusion_matrix": [
1677
+ [
1678
+ 77,
1679
+ 14,
1680
+ 5,
1681
+ 23,
1682
+ 19,
1683
+ 9,
1684
+ 13,
1685
+ 10,
1686
+ 10
1687
+ ],
1688
+ [
1689
+ 12,
1690
+ 87,
1691
+ 9,
1692
+ 13,
1693
+ 19,
1694
+ 11,
1695
+ 14,
1696
+ 5,
1697
+ 10
1698
+ ],
1699
+ [
1700
+ 6,
1701
+ 7,
1702
+ 93,
1703
+ 21,
1704
+ 17,
1705
+ 5,
1706
+ 7,
1707
+ 10,
1708
+ 14
1709
+ ],
1710
+ [
1711
+ 14,
1712
+ 18,
1713
+ 9,
1714
+ 71,
1715
+ 21,
1716
+ 8,
1717
+ 16,
1718
+ 15,
1719
+ 8
1720
+ ],
1721
+ [
1722
+ 14,
1723
+ 13,
1724
+ 17,
1725
+ 26,
1726
+ 110,
1727
+ 17,
1728
+ 14,
1729
+ 18,
1730
+ 11
1731
+ ],
1732
+ [
1733
+ 7,
1734
+ 11,
1735
+ 11,
1736
+ 14,
1737
+ 11,
1738
+ 86,
1739
+ 10,
1740
+ 14,
1741
+ 16
1742
+ ],
1743
+ [
1744
+ 8,
1745
+ 11,
1746
+ 9,
1747
+ 13,
1748
+ 17,
1749
+ 14,
1750
+ 89,
1751
+ 10,
1752
+ 9
1753
+ ],
1754
+ [
1755
+ 8,
1756
+ 16,
1757
+ 15,
1758
+ 17,
1759
+ 15,
1760
+ 10,
1761
+ 10,
1762
+ 84,
1763
+ 5
1764
+ ],
1765
+ [
1766
+ 14,
1767
+ 13,
1768
+ 11,
1769
+ 15,
1770
+ 12,
1771
+ 5,
1772
+ 8,
1773
+ 9,
1774
+ 93
1775
+ ]
1776
+ ],
1777
+ "per_class_recall": [
1778
+ 0.42777777777777776,
1779
+ 0.48333333333333334,
1780
+ 0.5166666666666667,
1781
+ 0.39444444444444443,
1782
+ 0.4583333333333333,
1783
+ 0.4777777777777778,
1784
+ 0.49444444444444446,
1785
+ 0.4666666666666667,
1786
+ 0.5166666666666667
1787
+ ],
1788
+ "balanced_accuracy": 0.47067901234567905,
1789
+ "accuracy": 0.47023809523809523,
1790
+ "weighted_f1": 0.4714090633921556,
1791
+ "macro_f1": 0.47192864139258894,
1792
+ "kappa": 0.40324241480878376,
1793
+ "samples": 1680,
1794
+ "reward": 0.47067901234567905,
1795
+ "subjects": 20
1796
+ },
1797
+ "tuev": {
1798
+ "class_counts": [
1799
+ 119,
1800
+ 291,
1801
+ 669,
1802
+ 86,
1803
+ 500,
1804
+ 13822
1805
+ ],
1806
+ "predicted_class_counts": [
1807
+ 1470,
1808
+ 431,
1809
+ 128,
1810
+ 748,
1811
+ 2708,
1812
+ 10002
1813
+ ],
1814
+ "confusion_matrix": [
1815
+ [
1816
+ 50,
1817
+ 38,
1818
+ 15,
1819
+ 4,
1820
+ 0,
1821
+ 12
1822
+ ],
1823
+ [
1824
+ 0,
1825
+ 99,
1826
+ 0,
1827
+ 98,
1828
+ 94,
1829
+ 0
1830
+ ],
1831
+ [
1832
+ 112,
1833
+ 28,
1834
+ 113,
1835
+ 100,
1836
+ 316,
1837
+ 0
1838
+ ],
1839
+ [
1840
+ 3,
1841
+ 2,
1842
+ 0,
1843
+ 81,
1844
+ 0,
1845
+ 0
1846
+ ],
1847
+ [
1848
+ 2,
1849
+ 0,
1850
+ 0,
1851
+ 46,
1852
+ 427,
1853
+ 25
1854
+ ],
1855
+ [
1856
+ 1303,
1857
+ 264,
1858
+ 0,
1859
+ 419,
1860
+ 1871,
1861
+ 9965
1862
+ ]
1863
+ ],
1864
+ "per_class_recall": [
1865
+ 0.42016806722689076,
1866
+ 0.3402061855670103,
1867
+ 0.16890881913303438,
1868
+ 0.9418604651162791,
1869
+ 0.854,
1870
+ 0.7209521053393141
1871
+ ],
1872
+ "balanced_accuracy": 0.5743492737304214,
1873
+ "accuracy": 0.6931620068444502,
1874
+ "weighted_f1": 0.7741731196624807,
1875
+ "macro_f1": 0.3196232848661513,
1876
+ "kappa": 0.2625475606475476,
1877
+ "samples": 15487,
1878
+ "reward": 0.5743492737304214,
1879
+ "subjects": 58
1880
+ },
1881
+ "ad65": {
1882
+ "class_counts": [
1883
+ 464,
1884
+ 393,
1885
+ 486
1886
+ ],
1887
+ "predicted_class_counts": [
1888
+ 533,
1889
+ 324,
1890
+ 486
1891
+ ],
1892
+ "confusion_matrix": [
1893
+ [
1894
+ 342,
1895
+ 97,
1896
+ 25
1897
+ ],
1898
+ [
1899
+ 131,
1900
+ 195,
1901
+ 67
1902
+ ],
1903
+ [
1904
+ 60,
1905
+ 32,
1906
+ 394
1907
+ ]
1908
+ ],
1909
+ "per_class_recall": [
1910
+ 0.7370689655172413,
1911
+ 0.4961832061068702,
1912
+ 0.8106995884773662
1913
+ ],
1914
+ "balanced_accuracy": 0.6813172533671592,
1915
+ "accuracy": 0.6932241250930752,
1916
+ "weighted_f1": 0.6895731074873461,
1917
+ "macro_f1": 0.6802302724647475,
1918
+ "kappa": 0.5361235537290547,
1919
+ "samples": 1343,
1920
+ "subject_metrics": {
1921
+ "class_counts": [
1922
+ 7,
1923
+ 5,
1924
+ 6
1925
+ ],
1926
+ "predicted_class_counts": [
1927
+ 7,
1928
+ 5,
1929
+ 6
1930
+ ],
1931
+ "confusion_matrix": [
1932
+ [
1933
+ 5,
1934
+ 2,
1935
+ 0
1936
+ ],
1937
+ [
1938
+ 2,
1939
+ 3,
1940
+ 0
1941
+ ],
1942
+ [
1943
+ 0,
1944
+ 0,
1945
+ 6
1946
+ ]
1947
+ ],
1948
+ "per_class_recall": [
1949
+ 0.7142857142857143,
1950
+ 0.6,
1951
+ 1.0
1952
+ ],
1953
+ "balanced_accuracy": 0.7714285714285714,
1954
+ "accuracy": 0.7777777777777778,
1955
+ "weighted_f1": 0.7777777777777778,
1956
+ "macro_f1": 0.7714285714285714,
1957
+ "kappa": 0.6635514018691588
1958
+ },
1959
+ "reward": 0.7714285714285714,
1960
+ "subjects": 18
1961
+ },
1962
+ "openbmi": {
1963
+ "class_counts": [
1964
+ 2200,
1965
+ 2200
1966
+ ],
1967
+ "predicted_class_counts": [
1968
+ 2056,
1969
+ 2344
1970
+ ],
1971
+ "confusion_matrix": [
1972
+ [
1973
+ 1694,
1974
+ 506
1975
+ ],
1976
+ [
1977
+ 362,
1978
+ 1838
1979
+ ]
1980
+ ],
1981
+ "per_class_recall": [
1982
+ 0.77,
1983
+ 0.8354545454545454
1984
+ ],
1985
+ "balanced_accuracy": 0.8027272727272727,
1986
+ "accuracy": 0.8027272727272727,
1987
+ "weighted_f1": 0.8025157524091919,
1988
+ "macro_f1": 0.8025157524091919,
1989
+ "kappa": 0.6054545454545455,
1990
+ "samples": 4400,
1991
+ "subject_scores": {
1992
+ "19": 0.845,
1993
+ "35": 0.9525,
1994
+ "34": 0.6425000000000001,
1995
+ "51": 0.7475,
1996
+ "20": 0.8174999999999999,
1997
+ "44": 0.94,
1998
+ "24": 0.5974999999999999,
1999
+ "15": 0.9,
2000
+ "31": 0.8775,
2001
+ "26": 0.79,
2002
+ "23": 0.72
2003
+ },
2004
+ "reward": 0.8027272727272727,
2005
+ "subjects": 11
2006
+ },
2007
+ "longitudinal": {
2008
+ "class_counts": [
2009
+ 4260,
2010
+ 4158
2011
+ ],
2012
+ "predicted_class_counts": [
2013
+ 4574,
2014
+ 3844
2015
+ ],
2016
+ "confusion_matrix": [
2017
+ [
2018
+ 3658,
2019
+ 602
2020
+ ],
2021
+ [
2022
+ 916,
2023
+ 3242
2024
+ ]
2025
+ ],
2026
+ "per_class_recall": [
2027
+ 0.8586854460093897,
2028
+ 0.7797017797017797
2029
+ ],
2030
+ "balanced_accuracy": 0.8191936128555847,
2031
+ "accuracy": 0.819672131147541,
2032
+ "weighted_f1": 0.8193389120476722,
2033
+ "macro_f1": 0.819230668900581,
2034
+ "kappa": 0.6389648996053923,
2035
+ "samples": 8418,
2036
+ "subject_scores": {
2037
+ "sub-G2021": 0.837643455629449,
2038
+ "sub-G2007": 0.7652179956923153,
2039
+ "sub-G2019": 0.82505149822325,
2040
+ "sub-G2031": 0.788678938415735,
2041
+ "sub-G2015": 0.8429774626319118,
2042
+ "sub-CTR002": 0.9869493251846193,
2043
+ "sub-G2011": 0.765938925240826,
2044
+ "sub-G2035": 0.9564871486872261,
2045
+ "sub-CTR003": 0.5773809523809523
2046
+ },
2047
+ "reward": 0.8162584113429205,
2048
+ "subjects": 9
2049
+ }
2050
+ },
2051
+ "losses": {
2052
+ "faced": 1.1651152074337006,
2053
+ "tuev": 0.795024397969246,
2054
+ "ad65": 0.39580797255039213,
2055
+ "openbmi": 0.415699365735054,
2056
+ "longitudinal": 0.24489932954311372
2057
+ },
2058
+ "seconds": 83.52135276794434
2059
+ },
2060
+ {
2061
+ "epoch": 6,
2062
+ "validation": {
2063
+ "faced": {
2064
+ "class_counts": [
2065
+ 180,
2066
+ 180,
2067
+ 180,
2068
+ 180,
2069
+ 240,
2070
+ 180,
2071
+ 180,
2072
+ 180,
2073
+ 180
2074
+ ],
2075
+ "predicted_class_counts": [
2076
+ 158,
2077
+ 191,
2078
+ 179,
2079
+ 213,
2080
+ 242,
2081
+ 165,
2082
+ 181,
2083
+ 175,
2084
+ 176
2085
+ ],
2086
+ "confusion_matrix": [
2087
+ [
2088
+ 77,
2089
+ 14,
2090
+ 5,
2091
+ 23,
2092
+ 19,
2093
+ 9,
2094
+ 13,
2095
+ 10,
2096
+ 10
2097
+ ],
2098
+ [
2099
+ 12,
2100
+ 87,
2101
+ 9,
2102
+ 13,
2103
+ 19,
2104
+ 11,
2105
+ 14,
2106
+ 5,
2107
+ 10
2108
+ ],
2109
+ [
2110
+ 6,
2111
+ 7,
2112
+ 93,
2113
+ 21,
2114
+ 17,
2115
+ 5,
2116
+ 7,
2117
+ 10,
2118
+ 14
2119
+ ],
2120
+ [
2121
+ 14,
2122
+ 18,
2123
+ 9,
2124
+ 71,
2125
+ 21,
2126
+ 8,
2127
+ 16,
2128
+ 15,
2129
+ 8
2130
+ ],
2131
+ [
2132
+ 13,
2133
+ 13,
2134
+ 17,
2135
+ 26,
2136
+ 111,
2137
+ 17,
2138
+ 14,
2139
+ 18,
2140
+ 11
2141
+ ],
2142
+ [
2143
+ 7,
2144
+ 11,
2145
+ 11,
2146
+ 14,
2147
+ 11,
2148
+ 86,
2149
+ 10,
2150
+ 14,
2151
+ 16
2152
+ ],
2153
+ [
2154
+ 8,
2155
+ 11,
2156
+ 9,
2157
+ 13,
2158
+ 17,
2159
+ 14,
2160
+ 89,
2161
+ 10,
2162
+ 9
2163
+ ],
2164
+ [
2165
+ 8,
2166
+ 16,
2167
+ 15,
2168
+ 17,
2169
+ 15,
2170
+ 10,
2171
+ 10,
2172
+ 84,
2173
+ 5
2174
+ ],
2175
+ [
2176
+ 13,
2177
+ 14,
2178
+ 11,
2179
+ 15,
2180
+ 12,
2181
+ 5,
2182
+ 8,
2183
+ 9,
2184
+ 93
2185
+ ]
2186
+ ],
2187
+ "per_class_recall": [
2188
+ 0.42777777777777776,
2189
+ 0.48333333333333334,
2190
+ 0.5166666666666667,
2191
+ 0.39444444444444443,
2192
+ 0.4625,
2193
+ 0.4777777777777778,
2194
+ 0.49444444444444446,
2195
+ 0.4666666666666667,
2196
+ 0.5166666666666667
2197
+ ],
2198
+ "balanced_accuracy": 0.471141975308642,
2199
+ "accuracy": 0.4708333333333333,
2200
+ "weighted_f1": 0.47201761600953746,
2201
+ "macro_f1": 0.4724411976075547,
2202
+ "kappa": 0.40389865415010284,
2203
+ "samples": 1680,
2204
+ "reward": 0.471141975308642,
2205
+ "subjects": 20
2206
+ },
2207
+ "tuev": {
2208
+ "class_counts": [
2209
+ 119,
2210
+ 291,
2211
+ 669,
2212
+ 86,
2213
+ 500,
2214
+ 13822
2215
+ ],
2216
+ "predicted_class_counts": [
2217
+ 1417,
2218
+ 489,
2219
+ 167,
2220
+ 734,
2221
+ 1641,
2222
+ 11039
2223
+ ],
2224
+ "confusion_matrix": [
2225
+ [
2226
+ 46,
2227
+ 38,
2228
+ 19,
2229
+ 4,
2230
+ 0,
2231
+ 12
2232
+ ],
2233
+ [
2234
+ 0,
2235
+ 99,
2236
+ 0,
2237
+ 113,
2238
+ 79,
2239
+ 0
2240
+ ],
2241
+ [
2242
+ 104,
2243
+ 42,
2244
+ 148,
2245
+ 114,
2246
+ 261,
2247
+ 0
2248
+ ],
2249
+ [
2250
+ 5,
2251
+ 2,
2252
+ 0,
2253
+ 78,
2254
+ 1,
2255
+ 0
2256
+ ],
2257
+ [
2258
+ 3,
2259
+ 0,
2260
+ 0,
2261
+ 50,
2262
+ 391,
2263
+ 56
2264
+ ],
2265
+ [
2266
+ 1259,
2267
+ 308,
2268
+ 0,
2269
+ 375,
2270
+ 909,
2271
+ 10971
2272
+ ]
2273
+ ],
2274
+ "per_class_recall": [
2275
+ 0.3865546218487395,
2276
+ 0.3402061855670103,
2277
+ 0.22122571001494767,
2278
+ 0.9069767441860465,
2279
+ 0.782,
2280
+ 0.7937346259586167
2281
+ ],
2282
+ "balanced_accuracy": 0.5717829812625601,
2283
+ "accuracy": 0.7576031510298961,
2284
+ "weighted_f1": 0.8210740384280086,
2285
+ "macro_f1": 0.3509816572072955,
2286
+ "kappa": 0.3236586218946286,
2287
+ "samples": 15487,
2288
+ "reward": 0.5717829812625601,
2289
+ "subjects": 58
2290
+ },
2291
+ "ad65": {
2292
+ "class_counts": [
2293
+ 464,
2294
+ 393,
2295
+ 486
2296
+ ],
2297
+ "predicted_class_counts": [
2298
+ 533,
2299
+ 324,
2300
+ 486
2301
+ ],
2302
+ "confusion_matrix": [
2303
+ [
2304
+ 342,
2305
+ 97,
2306
+ 25
2307
+ ],
2308
+ [
2309
+ 131,
2310
+ 195,
2311
+ 67
2312
+ ],
2313
+ [
2314
+ 60,
2315
+ 32,
2316
+ 394
2317
+ ]
2318
+ ],
2319
+ "per_class_recall": [
2320
+ 0.7370689655172413,
2321
+ 0.4961832061068702,
2322
+ 0.8106995884773662
2323
+ ],
2324
+ "balanced_accuracy": 0.6813172533671592,
2325
+ "accuracy": 0.6932241250930752,
2326
+ "weighted_f1": 0.6895731074873461,
2327
+ "macro_f1": 0.6802302724647475,
2328
+ "kappa": 0.5361235537290547,
2329
+ "samples": 1343,
2330
+ "subject_metrics": {
2331
+ "class_counts": [
2332
+ 7,
2333
+ 5,
2334
+ 6
2335
+ ],
2336
+ "predicted_class_counts": [
2337
+ 7,
2338
+ 5,
2339
+ 6
2340
+ ],
2341
+ "confusion_matrix": [
2342
+ [
2343
+ 5,
2344
+ 2,
2345
+ 0
2346
+ ],
2347
+ [
2348
+ 2,
2349
+ 3,
2350
+ 0
2351
+ ],
2352
+ [
2353
+ 0,
2354
+ 0,
2355
+ 6
2356
+ ]
2357
+ ],
2358
+ "per_class_recall": [
2359
+ 0.7142857142857143,
2360
+ 0.6,
2361
+ 1.0
2362
+ ],
2363
+ "balanced_accuracy": 0.7714285714285714,
2364
+ "accuracy": 0.7777777777777778,
2365
+ "weighted_f1": 0.7777777777777778,
2366
+ "macro_f1": 0.7714285714285714,
2367
+ "kappa": 0.6635514018691588
2368
+ },
2369
+ "reward": 0.7714285714285714,
2370
+ "subjects": 18
2371
+ },
2372
+ "openbmi": {
2373
+ "class_counts": [
2374
+ 2200,
2375
+ 2200
2376
+ ],
2377
+ "predicted_class_counts": [
2378
+ 2056,
2379
+ 2344
2380
+ ],
2381
+ "confusion_matrix": [
2382
+ [
2383
+ 1694,
2384
+ 506
2385
+ ],
2386
+ [
2387
+ 362,
2388
+ 1838
2389
+ ]
2390
+ ],
2391
+ "per_class_recall": [
2392
+ 0.77,
2393
+ 0.8354545454545454
2394
+ ],
2395
+ "balanced_accuracy": 0.8027272727272727,
2396
+ "accuracy": 0.8027272727272727,
2397
+ "weighted_f1": 0.8025157524091919,
2398
+ "macro_f1": 0.8025157524091919,
2399
+ "kappa": 0.6054545454545455,
2400
+ "samples": 4400,
2401
+ "subject_scores": {
2402
+ "19": 0.845,
2403
+ "35": 0.9525,
2404
+ "34": 0.6425000000000001,
2405
+ "51": 0.7475,
2406
+ "20": 0.8174999999999999,
2407
+ "44": 0.94,
2408
+ "24": 0.5974999999999999,
2409
+ "15": 0.9,
2410
+ "31": 0.8775,
2411
+ "26": 0.79,
2412
+ "23": 0.72
2413
+ },
2414
+ "reward": 0.8027272727272727,
2415
+ "subjects": 11
2416
+ },
2417
+ "longitudinal": {
2418
+ "class_counts": [
2419
+ 4260,
2420
+ 4158
2421
+ ],
2422
+ "predicted_class_counts": [
2423
+ 4573,
2424
+ 3845
2425
+ ],
2426
+ "confusion_matrix": [
2427
+ [
2428
+ 3657,
2429
+ 603
2430
+ ],
2431
+ [
2432
+ 916,
2433
+ 3242
2434
+ ]
2435
+ ],
2436
+ "per_class_recall": [
2437
+ 0.8584507042253521,
2438
+ 0.7797017797017797
2439
+ ],
2440
+ "balanced_accuracy": 0.8190762419635659,
2441
+ "accuracy": 0.8195533380850558,
2442
+ "weighted_f1": 0.8192217642599872,
2443
+ "macro_f1": 0.8191137114479841,
2444
+ "kappa": 0.6387281046963751,
2445
+ "samples": 8418,
2446
+ "subject_scores": {
2447
+ "sub-G2021": 0.837643455629449,
2448
+ "sub-G2007": 0.7644167136410334,
2449
+ "sub-G2019": 0.82505149822325,
2450
+ "sub-G2031": 0.788678938415735,
2451
+ "sub-G2015": 0.8429774626319118,
2452
+ "sub-CTR002": 0.9869493251846193,
2453
+ "sub-G2011": 0.765938925240826,
2454
+ "sub-G2035": 0.9564871486872261,
2455
+ "sub-CTR003": 0.5773809523809523
2456
+ },
2457
+ "reward": 0.8161693800038893,
2458
+ "subjects": 9
2459
+ }
2460
+ },
2461
+ "losses": {
2462
+ "faced": 1.2065095901489258,
2463
+ "tuev": 0.8101497024297715,
2464
+ "ad65": 0.3583500549197197,
2465
+ "openbmi": 0.414377860724926,
2466
+ "longitudinal": 0.2511081449687481
2467
+ },
2468
+ "seconds": 96.09055876731873
2469
+ },
2470
+ {
2471
+ "epoch": 7,
2472
+ "validation": {
2473
+ "faced": {
2474
+ "class_counts": [
2475
+ 180,
2476
+ 180,
2477
+ 180,
2478
+ 180,
2479
+ 240,
2480
+ 180,
2481
+ 180,
2482
+ 180,
2483
+ 180
2484
+ ],
2485
+ "predicted_class_counts": [
2486
+ 158,
2487
+ 191,
2488
+ 179,
2489
+ 212,
2490
+ 242,
2491
+ 165,
2492
+ 182,
2493
+ 175,
2494
+ 176
2495
+ ],
2496
+ "confusion_matrix": [
2497
+ [
2498
+ 77,
2499
+ 14,
2500
+ 5,
2501
+ 22,
2502
+ 19,
2503
+ 9,
2504
+ 14,
2505
+ 10,
2506
+ 10
2507
+ ],
2508
+ [
2509
+ 12,
2510
+ 87,
2511
+ 9,
2512
+ 13,
2513
+ 19,
2514
+ 11,
2515
+ 14,
2516
+ 5,
2517
+ 10
2518
+ ],
2519
+ [
2520
+ 6,
2521
+ 7,
2522
+ 93,
2523
+ 21,
2524
+ 17,
2525
+ 5,
2526
+ 7,
2527
+ 10,
2528
+ 14
2529
+ ],
2530
+ [
2531
+ 14,
2532
+ 18,
2533
+ 9,
2534
+ 71,
2535
+ 21,
2536
+ 8,
2537
+ 16,
2538
+ 15,
2539
+ 8
2540
+ ],
2541
+ [
2542
+ 13,
2543
+ 13,
2544
+ 17,
2545
+ 26,
2546
+ 111,
2547
+ 17,
2548
+ 14,
2549
+ 18,
2550
+ 11
2551
+ ],
2552
+ [
2553
+ 7,
2554
+ 11,
2555
+ 11,
2556
+ 14,
2557
+ 11,
2558
+ 86,
2559
+ 10,
2560
+ 14,
2561
+ 16
2562
+ ],
2563
+ [
2564
+ 8,
2565
+ 11,
2566
+ 9,
2567
+ 13,
2568
+ 17,
2569
+ 14,
2570
+ 89,
2571
+ 10,
2572
+ 9
2573
+ ],
2574
+ [
2575
+ 8,
2576
+ 16,
2577
+ 15,
2578
+ 17,
2579
+ 15,
2580
+ 10,
2581
+ 10,
2582
+ 84,
2583
+ 5
2584
+ ],
2585
+ [
2586
+ 13,
2587
+ 14,
2588
+ 11,
2589
+ 15,
2590
+ 12,
2591
+ 5,
2592
+ 8,
2593
+ 9,
2594
+ 93
2595
+ ]
2596
+ ],
2597
+ "per_class_recall": [
2598
+ 0.42777777777777776,
2599
+ 0.48333333333333334,
2600
+ 0.5166666666666667,
2601
+ 0.39444444444444443,
2602
+ 0.4625,
2603
+ 0.4777777777777778,
2604
+ 0.49444444444444446,
2605
+ 0.4666666666666667,
2606
+ 0.5166666666666667
2607
+ ],
2608
+ "balanced_accuracy": 0.471141975308642,
2609
+ "accuracy": 0.4708333333333333,
2610
+ "weighted_f1": 0.4719704364754072,
2611
+ "macro_f1": 0.4723922706832716,
2612
+ "kappa": 0.40389865415010295,
2613
+ "samples": 1680,
2614
+ "reward": 0.471141975308642,
2615
+ "subjects": 20
2616
+ },
2617
+ "tuev": {
2618
+ "class_counts": [
2619
+ 119,
2620
+ 291,
2621
+ 669,
2622
+ 86,
2623
+ 500,
2624
+ 13822
2625
+ ],
2626
+ "predicted_class_counts": [
2627
+ 1417,
2628
+ 660,
2629
+ 125,
2630
+ 754,
2631
+ 1640,
2632
+ 10891
2633
+ ],
2634
+ "confusion_matrix": [
2635
+ [
2636
+ 45,
2637
+ 38,
2638
+ 15,
2639
+ 0,
2640
+ 4,
2641
+ 17
2642
+ ],
2643
+ [
2644
+ 17,
2645
+ 164,
2646
+ 0,
2647
+ 61,
2648
+ 49,
2649
+ 0
2650
+ ],
2651
+ [
2652
+ 131,
2653
+ 126,
2654
+ 110,
2655
+ 89,
2656
+ 213,
2657
+ 0
2658
+ ],
2659
+ [
2660
+ 8,
2661
+ 2,
2662
+ 0,
2663
+ 76,
2664
+ 0,
2665
+ 0
2666
+ ],
2667
+ [
2668
+ 4,
2669
+ 0,
2670
+ 0,
2671
+ 24,
2672
+ 435,
2673
+ 37
2674
+ ],
2675
+ [
2676
+ 1212,
2677
+ 330,
2678
+ 0,
2679
+ 504,
2680
+ 939,
2681
+ 10837
2682
+ ]
2683
+ ],
2684
+ "per_class_recall": [
2685
+ 0.37815126050420167,
2686
+ 0.563573883161512,
2687
+ 0.16442451420029897,
2688
+ 0.8837209302325582,
2689
+ 0.87,
2690
+ 0.7840399363333815
2691
+ ],
2692
+ "balanced_accuracy": 0.6073184207386587,
2693
+ "accuracy": 0.7533415122360689,
2694
+ "weighted_f1": 0.8157694653698978,
2695
+ "macro_f1": 0.35751577708839816,
2696
+ "kappa": 0.3275905700234074,
2697
+ "samples": 15487,
2698
+ "reward": 0.6073184207386587,
2699
+ "subjects": 58
2700
+ },
2701
+ "ad65": {
2702
+ "class_counts": [
2703
+ 464,
2704
+ 393,
2705
+ 486
2706
+ ],
2707
+ "predicted_class_counts": [
2708
+ 533,
2709
+ 324,
2710
+ 486
2711
+ ],
2712
+ "confusion_matrix": [
2713
+ [
2714
+ 342,
2715
+ 97,
2716
+ 25
2717
+ ],
2718
+ [
2719
+ 131,
2720
+ 195,
2721
+ 67
2722
+ ],
2723
+ [
2724
+ 60,
2725
+ 32,
2726
+ 394
2727
+ ]
2728
+ ],
2729
+ "per_class_recall": [
2730
+ 0.7370689655172413,
2731
+ 0.4961832061068702,
2732
+ 0.8106995884773662
2733
+ ],
2734
+ "balanced_accuracy": 0.6813172533671592,
2735
+ "accuracy": 0.6932241250930752,
2736
+ "weighted_f1": 0.6895731074873461,
2737
+ "macro_f1": 0.6802302724647475,
2738
+ "kappa": 0.5361235537290547,
2739
+ "samples": 1343,
2740
+ "subject_metrics": {
2741
+ "class_counts": [
2742
+ 7,
2743
+ 5,
2744
+ 6
2745
+ ],
2746
+ "predicted_class_counts": [
2747
+ 7,
2748
+ 5,
2749
+ 6
2750
+ ],
2751
+ "confusion_matrix": [
2752
+ [
2753
+ 5,
2754
+ 2,
2755
+ 0
2756
+ ],
2757
+ [
2758
+ 2,
2759
+ 3,
2760
+ 0
2761
+ ],
2762
+ [
2763
+ 0,
2764
+ 0,
2765
+ 6
2766
+ ]
2767
+ ],
2768
+ "per_class_recall": [
2769
+ 0.7142857142857143,
2770
+ 0.6,
2771
+ 1.0
2772
+ ],
2773
+ "balanced_accuracy": 0.7714285714285714,
2774
+ "accuracy": 0.7777777777777778,
2775
+ "weighted_f1": 0.7777777777777778,
2776
+ "macro_f1": 0.7714285714285714,
2777
+ "kappa": 0.6635514018691588
2778
+ },
2779
+ "reward": 0.7714285714285714,
2780
+ "subjects": 18
2781
+ },
2782
+ "openbmi": {
2783
+ "class_counts": [
2784
+ 2200,
2785
+ 2200
2786
+ ],
2787
+ "predicted_class_counts": [
2788
+ 2056,
2789
+ 2344
2790
+ ],
2791
+ "confusion_matrix": [
2792
+ [
2793
+ 1694,
2794
+ 506
2795
+ ],
2796
+ [
2797
+ 362,
2798
+ 1838
2799
+ ]
2800
+ ],
2801
+ "per_class_recall": [
2802
+ 0.77,
2803
+ 0.8354545454545454
2804
+ ],
2805
+ "balanced_accuracy": 0.8027272727272727,
2806
+ "accuracy": 0.8027272727272727,
2807
+ "weighted_f1": 0.8025157524091919,
2808
+ "macro_f1": 0.8025157524091919,
2809
+ "kappa": 0.6054545454545455,
2810
+ "samples": 4400,
2811
+ "subject_scores": {
2812
+ "19": 0.845,
2813
+ "35": 0.9525,
2814
+ "34": 0.6425000000000001,
2815
+ "51": 0.7475,
2816
+ "20": 0.8174999999999999,
2817
+ "44": 0.94,
2818
+ "24": 0.5974999999999999,
2819
+ "15": 0.9,
2820
+ "31": 0.8775,
2821
+ "26": 0.79,
2822
+ "23": 0.72
2823
+ },
2824
+ "reward": 0.8027272727272727,
2825
+ "subjects": 11
2826
+ },
2827
+ "longitudinal": {
2828
+ "class_counts": [
2829
+ 4260,
2830
+ 4158
2831
+ ],
2832
+ "predicted_class_counts": [
2833
+ 4573,
2834
+ 3845
2835
+ ],
2836
+ "confusion_matrix": [
2837
+ [
2838
+ 3657,
2839
+ 603
2840
+ ],
2841
+ [
2842
+ 916,
2843
+ 3242
2844
+ ]
2845
+ ],
2846
+ "per_class_recall": [
2847
+ 0.8584507042253521,
2848
+ 0.7797017797017797
2849
+ ],
2850
+ "balanced_accuracy": 0.8190762419635659,
2851
+ "accuracy": 0.8195533380850558,
2852
+ "weighted_f1": 0.8192217642599872,
2853
+ "macro_f1": 0.8191137114479841,
2854
+ "kappa": 0.6387281046963751,
2855
+ "samples": 8418,
2856
+ "subject_scores": {
2857
+ "sub-G2021": 0.837643455629449,
2858
+ "sub-G2007": 0.7644167136410334,
2859
+ "sub-G2019": 0.82505149822325,
2860
+ "sub-G2031": 0.788678938415735,
2861
+ "sub-G2015": 0.8429774626319118,
2862
+ "sub-CTR002": 0.9869493251846193,
2863
+ "sub-G2011": 0.765938925240826,
2864
+ "sub-G2035": 0.9564871486872261,
2865
+ "sub-CTR003": 0.5773809523809523
2866
+ },
2867
+ "reward": 0.8161693800038893,
2868
+ "subjects": 9
2869
+ }
2870
+ },
2871
+ "losses": {
2872
+ "faced": 1.1728858172893524,
2873
+ "tuev": 0.8282902628183365,
2874
+ "ad65": 0.38538945466279984,
2875
+ "openbmi": 0.4079422622919083,
2876
+ "longitudinal": 0.24979219660162927
2877
+ },
2878
+ "seconds": 108.29975962638855
2879
+ }
2880
+ ],
2881
+ "history": [
2882
+ {
2883
+ "epoch": 1,
2884
+ "validation": {
2885
+ "faced": {
2886
+ "class_counts": [
2887
+ 180,
2888
+ 180,
2889
+ 180,
2890
+ 180,
2891
+ 240,
2892
+ 180,
2893
+ 180,
2894
+ 180,
2895
+ 180
2896
+ ],
2897
+ "predicted_class_counts": [
2898
+ 158,
2899
+ 189,
2900
+ 178,
2901
+ 213,
2902
+ 242,
2903
+ 166,
2904
+ 182,
2905
+ 176,
2906
+ 176
2907
+ ],
2908
+ "confusion_matrix": [
2909
+ [
2910
+ 77,
2911
+ 14,
2912
+ 5,
2913
+ 22,
2914
+ 19,
2915
+ 9,
2916
+ 14,
2917
+ 10,
2918
+ 10
2919
+ ],
2920
+ [
2921
+ 12,
2922
+ 86,
2923
+ 9,
2924
+ 13,
2925
+ 19,
2926
+ 11,
2927
+ 14,
2928
+ 6,
2929
+ 10
2930
+ ],
2931
+ [
2932
+ 6,
2933
+ 7,
2934
+ 93,
2935
+ 21,
2936
+ 17,
2937
+ 5,
2938
+ 7,
2939
+ 10,
2940
+ 14
2941
+ ],
2942
+ [
2943
+ 14,
2944
+ 18,
2945
+ 9,
2946
+ 71,
2947
+ 21,
2948
+ 8,
2949
+ 16,
2950
+ 15,
2951
+ 8
2952
+ ],
2953
+ [
2954
+ 13,
2955
+ 13,
2956
+ 17,
2957
+ 26,
2958
+ 111,
2959
+ 17,
2960
+ 14,
2961
+ 18,
2962
+ 11
2963
+ ],
2964
+ [
2965
+ 6,
2966
+ 11,
2967
+ 11,
2968
+ 15,
2969
+ 11,
2970
+ 86,
2971
+ 10,
2972
+ 14,
2973
+ 16
2974
+ ],
2975
+ [
2976
+ 8,
2977
+ 11,
2978
+ 9,
2979
+ 13,
2980
+ 17,
2981
+ 14,
2982
+ 89,
2983
+ 10,
2984
+ 9
2985
+ ],
2986
+ [
2987
+ 8,
2988
+ 16,
2989
+ 14,
2990
+ 17,
2991
+ 15,
2992
+ 11,
2993
+ 10,
2994
+ 84,
2995
+ 5
2996
+ ],
2997
+ [
2998
+ 14,
2999
+ 13,
3000
+ 11,
3001
+ 15,
3002
+ 12,
3003
+ 5,
3004
+ 8,
3005
+ 9,
3006
+ 93
3007
+ ]
3008
+ ],
3009
+ "per_class_recall": [
3010
+ 0.42777777777777776,
3011
+ 0.4777777777777778,
3012
+ 0.5166666666666667,
3013
+ 0.39444444444444443,
3014
+ 0.4625,
3015
+ 0.4777777777777778,
3016
+ 0.49444444444444446,
3017
+ 0.4666666666666667,
3018
+ 0.5166666666666667
3019
+ ],
3020
+ "balanced_accuracy": 0.4705246913580247,
3021
+ "accuracy": 0.47023809523809523,
3022
+ "weighted_f1": 0.4714215675991068,
3023
+ "macro_f1": 0.47182307333007106,
3024
+ "kappa": 0.40322812395229657,
3025
+ "samples": 1680,
3026
+ "reward": 0.4705246913580247,
3027
+ "subjects": 20
3028
+ },
3029
+ "tuev": {
3030
+ "class_counts": [
3031
+ 119,
3032
+ 291,
3033
+ 669,
3034
+ 86,
3035
+ 500,
3036
+ 13822
3037
+ ],
3038
+ "predicted_class_counts": [
3039
+ 1415,
3040
+ 660,
3041
+ 126,
3042
+ 754,
3043
+ 1684,
3044
+ 10848
3045
+ ],
3046
+ "confusion_matrix": [
3047
+ [
3048
+ 45,
3049
+ 38,
3050
+ 15,
3051
+ 0,
3052
+ 4,
3053
+ 17
3054
+ ],
3055
+ [
3056
+ 17,
3057
+ 164,
3058
+ 0,
3059
+ 61,
3060
+ 49,
3061
+ 0
3062
+ ],
3063
+ [
3064
+ 130,
3065
+ 126,
3066
+ 111,
3067
+ 89,
3068
+ 213,
3069
+ 0
3070
+ ],
3071
+ [
3072
+ 7,
3073
+ 2,
3074
+ 0,
3075
+ 76,
3076
+ 0,
3077
+ 1
3078
+ ],
3079
+ [
3080
+ 4,
3081
+ 0,
3082
+ 0,
3083
+ 24,
3084
+ 435,
3085
+ 37
3086
+ ],
3087
+ [
3088
+ 1212,
3089
+ 330,
3090
+ 0,
3091
+ 504,
3092
+ 983,
3093
+ 10793
3094
+ ]
3095
+ ],
3096
+ "per_class_recall": [
3097
+ 0.37815126050420167,
3098
+ 0.563573883161512,
3099
+ 0.16591928251121077,
3100
+ 0.8837209302325582,
3101
+ 0.87,
3102
+ 0.7808566054116626
3103
+ ],
3104
+ "balanced_accuracy": 0.6070369936368575,
3105
+ "accuracy": 0.7505649899916058,
3106
+ "weighted_f1": 0.8137799723660881,
3107
+ "macro_f1": 0.3561849045209278,
3108
+ "kappa": 0.32441309326581047,
3109
+ "samples": 15487,
3110
+ "reward": 0.6070369936368575,
3111
+ "subjects": 58
3112
+ },
3113
+ "ad65": {
3114
+ "class_counts": [
3115
+ 464,
3116
+ 393,
3117
+ 486
3118
+ ],
3119
+ "predicted_class_counts": [
3120
+ 533,
3121
+ 324,
3122
+ 486
3123
+ ],
3124
+ "confusion_matrix": [
3125
+ [
3126
+ 342,
3127
+ 97,
3128
+ 25
3129
+ ],
3130
+ [
3131
+ 131,
3132
+ 195,
3133
+ 67
3134
+ ],
3135
+ [
3136
+ 60,
3137
+ 32,
3138
+ 394
3139
+ ]
3140
+ ],
3141
+ "per_class_recall": [
3142
+ 0.7370689655172413,
3143
+ 0.4961832061068702,
3144
+ 0.8106995884773662
3145
+ ],
3146
+ "balanced_accuracy": 0.6813172533671592,
3147
+ "accuracy": 0.6932241250930752,
3148
+ "weighted_f1": 0.6895731074873461,
3149
+ "macro_f1": 0.6802302724647475,
3150
+ "kappa": 0.5361235537290547,
3151
+ "samples": 1343,
3152
+ "subject_metrics": {
3153
+ "class_counts": [
3154
+ 7,
3155
+ 5,
3156
+ 6
3157
+ ],
3158
+ "predicted_class_counts": [
3159
+ 7,
3160
+ 5,
3161
+ 6
3162
+ ],
3163
+ "confusion_matrix": [
3164
+ [
3165
+ 5,
3166
+ 2,
3167
+ 0
3168
+ ],
3169
+ [
3170
+ 2,
3171
+ 3,
3172
+ 0
3173
+ ],
3174
+ [
3175
+ 0,
3176
+ 0,
3177
+ 6
3178
+ ]
3179
+ ],
3180
+ "per_class_recall": [
3181
+ 0.7142857142857143,
3182
+ 0.6,
3183
+ 1.0
3184
+ ],
3185
+ "balanced_accuracy": 0.7714285714285714,
3186
+ "accuracy": 0.7777777777777778,
3187
+ "weighted_f1": 0.7777777777777778,
3188
+ "macro_f1": 0.7714285714285714,
3189
+ "kappa": 0.6635514018691588
3190
+ },
3191
+ "reward": 0.7714285714285714,
3192
+ "subjects": 18
3193
+ },
3194
+ "openbmi": {
3195
+ "class_counts": [
3196
+ 2200,
3197
+ 2200
3198
+ ],
3199
+ "predicted_class_counts": [
3200
+ 2061,
3201
+ 2339
3202
+ ],
3203
+ "confusion_matrix": [
3204
+ [
3205
+ 1698,
3206
+ 502
3207
+ ],
3208
+ [
3209
+ 363,
3210
+ 1837
3211
+ ]
3212
+ ],
3213
+ "per_class_recall": [
3214
+ 0.7718181818181818,
3215
+ 0.835
3216
+ ],
3217
+ "balanced_accuracy": 0.803409090909091,
3218
+ "accuracy": 0.803409090909091,
3219
+ "weighted_f1": 0.8032127000298179,
3220
+ "macro_f1": 0.8032127000298179,
3221
+ "kappa": 0.6068181818181818,
3222
+ "samples": 4400,
3223
+ "subject_scores": {
3224
+ "19": 0.8425,
3225
+ "35": 0.9525,
3226
+ "34": 0.6425000000000001,
3227
+ "51": 0.7475,
3228
+ "20": 0.82,
3229
+ "44": 0.94,
3230
+ "24": 0.5974999999999999,
3231
+ "15": 0.9,
3232
+ "31": 0.8825000000000001,
3233
+ "26": 0.7925,
3234
+ "23": 0.72
3235
+ },
3236
+ "reward": 0.803409090909091,
3237
+ "subjects": 11
3238
+ },
3239
+ "longitudinal": {
3240
+ "class_counts": [
3241
+ 4260,
3242
+ 4158
3243
+ ],
3244
+ "predicted_class_counts": [
3245
+ 4573,
3246
+ 3845
3247
+ ],
3248
+ "confusion_matrix": [
3249
+ [
3250
+ 3657,
3251
+ 603
3252
+ ],
3253
+ [
3254
+ 916,
3255
+ 3242
3256
+ ]
3257
+ ],
3258
+ "per_class_recall": [
3259
+ 0.8584507042253521,
3260
+ 0.7797017797017797
3261
+ ],
3262
+ "balanced_accuracy": 0.8190762419635659,
3263
+ "accuracy": 0.8195533380850558,
3264
+ "weighted_f1": 0.8192217642599872,
3265
+ "macro_f1": 0.8191137114479841,
3266
+ "kappa": 0.6387281046963751,
3267
+ "samples": 8418,
3268
+ "subject_scores": {
3269
+ "sub-G2021": 0.837643455629449,
3270
+ "sub-G2007": 0.7644167136410334,
3271
+ "sub-G2019": 0.82505149822325,
3272
+ "sub-G2031": 0.788678938415735,
3273
+ "sub-G2015": 0.8429774626319118,
3274
+ "sub-CTR002": 0.9869493251846193,
3275
+ "sub-G2011": 0.765938925240826,
3276
+ "sub-G2035": 0.9564871486872261,
3277
+ "sub-CTR003": 0.5773809523809523
3278
+ },
3279
+ "reward": 0.8161693800038893,
3280
+ "subjects": 9
3281
+ }
3282
+ },
3283
+ "seconds": 13.797802209854126
3284
+ }
3285
+ ],
3286
+ "averaged_validation": {
3287
+ "faced": {
3288
+ "class_counts": [
3289
+ 180,
3290
+ 180,
3291
+ 180,
3292
+ 180,
3293
+ 240,
3294
+ 180,
3295
+ 180,
3296
+ 180,
3297
+ 180
3298
+ ],
3299
+ "predicted_class_counts": [
3300
+ 158,
3301
+ 189,
3302
+ 178,
3303
+ 213,
3304
+ 242,
3305
+ 166,
3306
+ 182,
3307
+ 176,
3308
+ 176
3309
+ ],
3310
+ "confusion_matrix": [
3311
+ [
3312
+ 77,
3313
+ 14,
3314
+ 5,
3315
+ 22,
3316
+ 19,
3317
+ 9,
3318
+ 14,
3319
+ 10,
3320
+ 10
3321
+ ],
3322
+ [
3323
+ 12,
3324
+ 86,
3325
+ 9,
3326
+ 13,
3327
+ 19,
3328
+ 11,
3329
+ 14,
3330
+ 6,
3331
+ 10
3332
+ ],
3333
+ [
3334
+ 6,
3335
+ 7,
3336
+ 93,
3337
+ 21,
3338
+ 17,
3339
+ 5,
3340
+ 7,
3341
+ 10,
3342
+ 14
3343
+ ],
3344
+ [
3345
+ 14,
3346
+ 18,
3347
+ 9,
3348
+ 71,
3349
+ 21,
3350
+ 8,
3351
+ 16,
3352
+ 15,
3353
+ 8
3354
+ ],
3355
+ [
3356
+ 13,
3357
+ 13,
3358
+ 17,
3359
+ 26,
3360
+ 111,
3361
+ 17,
3362
+ 14,
3363
+ 18,
3364
+ 11
3365
+ ],
3366
+ [
3367
+ 6,
3368
+ 11,
3369
+ 11,
3370
+ 15,
3371
+ 11,
3372
+ 86,
3373
+ 10,
3374
+ 14,
3375
+ 16
3376
+ ],
3377
+ [
3378
+ 8,
3379
+ 11,
3380
+ 9,
3381
+ 13,
3382
+ 17,
3383
+ 14,
3384
+ 89,
3385
+ 10,
3386
+ 9
3387
+ ],
3388
+ [
3389
+ 8,
3390
+ 16,
3391
+ 14,
3392
+ 17,
3393
+ 15,
3394
+ 11,
3395
+ 10,
3396
+ 84,
3397
+ 5
3398
+ ],
3399
+ [
3400
+ 14,
3401
+ 13,
3402
+ 11,
3403
+ 15,
3404
+ 12,
3405
+ 5,
3406
+ 8,
3407
+ 9,
3408
+ 93
3409
+ ]
3410
+ ],
3411
+ "per_class_recall": [
3412
+ 0.42777777777777776,
3413
+ 0.4777777777777778,
3414
+ 0.5166666666666667,
3415
+ 0.39444444444444443,
3416
+ 0.4625,
3417
+ 0.4777777777777778,
3418
+ 0.49444444444444446,
3419
+ 0.4666666666666667,
3420
+ 0.5166666666666667
3421
+ ],
3422
+ "balanced_accuracy": 0.4705246913580247,
3423
+ "accuracy": 0.47023809523809523,
3424
+ "weighted_f1": 0.4714215675991068,
3425
+ "macro_f1": 0.47182307333007106,
3426
+ "kappa": 0.40322812395229657,
3427
+ "samples": 1680,
3428
+ "reward": 0.4705246913580247,
3429
+ "subjects": 20
3430
+ },
3431
+ "tuev": {
3432
+ "class_counts": [
3433
+ 119,
3434
+ 291,
3435
+ 669,
3436
+ 86,
3437
+ 500,
3438
+ 13822
3439
+ ],
3440
+ "predicted_class_counts": [
3441
+ 1415,
3442
+ 660,
3443
+ 126,
3444
+ 754,
3445
+ 1684,
3446
+ 10848
3447
+ ],
3448
+ "confusion_matrix": [
3449
+ [
3450
+ 45,
3451
+ 38,
3452
+ 15,
3453
+ 0,
3454
+ 4,
3455
+ 17
3456
+ ],
3457
+ [
3458
+ 17,
3459
+ 164,
3460
+ 0,
3461
+ 61,
3462
+ 49,
3463
+ 0
3464
+ ],
3465
+ [
3466
+ 130,
3467
+ 126,
3468
+ 111,
3469
+ 89,
3470
+ 213,
3471
+ 0
3472
+ ],
3473
+ [
3474
+ 7,
3475
+ 2,
3476
+ 0,
3477
+ 76,
3478
+ 0,
3479
+ 1
3480
+ ],
3481
+ [
3482
+ 4,
3483
+ 0,
3484
+ 0,
3485
+ 24,
3486
+ 435,
3487
+ 37
3488
+ ],
3489
+ [
3490
+ 1212,
3491
+ 330,
3492
+ 0,
3493
+ 504,
3494
+ 983,
3495
+ 10793
3496
+ ]
3497
+ ],
3498
+ "per_class_recall": [
3499
+ 0.37815126050420167,
3500
+ 0.563573883161512,
3501
+ 0.16591928251121077,
3502
+ 0.8837209302325582,
3503
+ 0.87,
3504
+ 0.7808566054116626
3505
+ ],
3506
+ "balanced_accuracy": 0.6070369936368575,
3507
+ "accuracy": 0.7505649899916058,
3508
+ "weighted_f1": 0.8137799723660881,
3509
+ "macro_f1": 0.3561849045209278,
3510
+ "kappa": 0.32441309326581047,
3511
+ "samples": 15487,
3512
+ "reward": 0.6070369936368575,
3513
+ "subjects": 58
3514
+ },
3515
+ "ad65": {
3516
+ "class_counts": [
3517
+ 464,
3518
+ 393,
3519
+ 486
3520
+ ],
3521
+ "predicted_class_counts": [
3522
+ 533,
3523
+ 324,
3524
+ 486
3525
+ ],
3526
+ "confusion_matrix": [
3527
+ [
3528
+ 342,
3529
+ 97,
3530
+ 25
3531
+ ],
3532
+ [
3533
+ 131,
3534
+ 195,
3535
+ 67
3536
+ ],
3537
+ [
3538
+ 60,
3539
+ 32,
3540
+ 394
3541
+ ]
3542
+ ],
3543
+ "per_class_recall": [
3544
+ 0.7370689655172413,
3545
+ 0.4961832061068702,
3546
+ 0.8106995884773662
3547
+ ],
3548
+ "balanced_accuracy": 0.6813172533671592,
3549
+ "accuracy": 0.6932241250930752,
3550
+ "weighted_f1": 0.6895731074873461,
3551
+ "macro_f1": 0.6802302724647475,
3552
+ "kappa": 0.5361235537290547,
3553
+ "samples": 1343,
3554
+ "subject_metrics": {
3555
+ "class_counts": [
3556
+ 7,
3557
+ 5,
3558
+ 6
3559
+ ],
3560
+ "predicted_class_counts": [
3561
+ 7,
3562
+ 5,
3563
+ 6
3564
+ ],
3565
+ "confusion_matrix": [
3566
+ [
3567
+ 5,
3568
+ 2,
3569
+ 0
3570
+ ],
3571
+ [
3572
+ 2,
3573
+ 3,
3574
+ 0
3575
+ ],
3576
+ [
3577
+ 0,
3578
+ 0,
3579
+ 6
3580
+ ]
3581
+ ],
3582
+ "per_class_recall": [
3583
+ 0.7142857142857143,
3584
+ 0.6,
3585
+ 1.0
3586
+ ],
3587
+ "balanced_accuracy": 0.7714285714285714,
3588
+ "accuracy": 0.7777777777777778,
3589
+ "weighted_f1": 0.7777777777777778,
3590
+ "macro_f1": 0.7714285714285714,
3591
+ "kappa": 0.6635514018691588
3592
+ },
3593
+ "reward": 0.7714285714285714,
3594
+ "subjects": 18
3595
+ },
3596
+ "openbmi": {
3597
+ "class_counts": [
3598
+ 2200,
3599
+ 2200
3600
+ ],
3601
+ "predicted_class_counts": [
3602
+ 2061,
3603
+ 2339
3604
+ ],
3605
+ "confusion_matrix": [
3606
+ [
3607
+ 1698,
3608
+ 502
3609
+ ],
3610
+ [
3611
+ 363,
3612
+ 1837
3613
+ ]
3614
+ ],
3615
+ "per_class_recall": [
3616
+ 0.7718181818181818,
3617
+ 0.835
3618
+ ],
3619
+ "balanced_accuracy": 0.803409090909091,
3620
+ "accuracy": 0.803409090909091,
3621
+ "weighted_f1": 0.8032127000298179,
3622
+ "macro_f1": 0.8032127000298179,
3623
+ "kappa": 0.6068181818181818,
3624
+ "samples": 4400,
3625
+ "subject_scores": {
3626
+ "19": 0.8425,
3627
+ "35": 0.9525,
3628
+ "34": 0.6425000000000001,
3629
+ "51": 0.7475,
3630
+ "20": 0.82,
3631
+ "44": 0.94,
3632
+ "24": 0.5974999999999999,
3633
+ "15": 0.9,
3634
+ "31": 0.8825000000000001,
3635
+ "26": 0.7925,
3636
+ "23": 0.72
3637
+ },
3638
+ "reward": 0.803409090909091,
3639
+ "subjects": 11
3640
+ },
3641
+ "longitudinal": {
3642
+ "class_counts": [
3643
+ 4260,
3644
+ 4158
3645
+ ],
3646
+ "predicted_class_counts": [
3647
+ 4573,
3648
+ 3845
3649
+ ],
3650
+ "confusion_matrix": [
3651
+ [
3652
+ 3657,
3653
+ 603
3654
+ ],
3655
+ [
3656
+ 916,
3657
+ 3242
3658
+ ]
3659
+ ],
3660
+ "per_class_recall": [
3661
+ 0.8584507042253521,
3662
+ 0.7797017797017797
3663
+ ],
3664
+ "balanced_accuracy": 0.8190762419635659,
3665
+ "accuracy": 0.8195533380850558,
3666
+ "weighted_f1": 0.8192217642599872,
3667
+ "macro_f1": 0.8191137114479841,
3668
+ "kappa": 0.6387281046963751,
3669
+ "samples": 8418,
3670
+ "subject_scores": {
3671
+ "sub-G2021": 0.837643455629449,
3672
+ "sub-G2007": 0.7644167136410334,
3673
+ "sub-G2019": 0.82505149822325,
3674
+ "sub-G2031": 0.788678938415735,
3675
+ "sub-G2015": 0.8429774626319118,
3676
+ "sub-CTR002": 0.9869493251846193,
3677
+ "sub-G2011": 0.765938925240826,
3678
+ "sub-G2035": 0.9564871486872261,
3679
+ "sub-CTR003": 0.5773809523809523
3680
+ },
3681
+ "reward": 0.8161693800038893,
3682
+ "subjects": 9
3683
+ }
3684
+ }
3685
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/config.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "bci-shared-biot-covariance-bf16head-v1",
3
+ "architecture": {
4
+ "channels": 32,
5
+ "width": 128,
6
+ "depth": 2,
7
+ "dropout": 0.5,
8
+ "wave_filters": 32,
9
+ "head_width": 64,
10
+ "head_dropout": 0.3
11
+ },
12
+ "initialization": {
13
+ "initialization": "continue joint training from a complete shared-model checkpoint",
14
+ "parent": "/workspace/research/runs/hybrid_biot_fusionshrink0100/epoch-001/weights.pt",
15
+ "parent_initialization": {
16
+ "initialization": "jointly trained parent plus audited pretrained BIOT in a single coupled backbone",
17
+ "parent": "/workspace/research/runs/hybrid_wide1/epoch-004/weights.pt",
18
+ "audited_biot": {
19
+ "initialization": "pretrained",
20
+ "repo": "braindecode/biot-pretrained-six-datasets-18chs",
21
+ "revision": "7e9aabf302870012f73773276803aab97993951c",
22
+ "sha256": "a218f4054ae29962c6fd9d23d94c446d354c4f53e805a6771c85749ccc20baaa",
23
+ "license": "BSD-3-Clause",
24
+ "source_braindecode": "1.3.0",
25
+ "loaded_core_tensors": 56,
26
+ "skipped_classifier_tensors": 3
27
+ },
28
+ "neural_channel_indices": {
29
+ "faced": [
30
+ 0,
31
+ 1,
32
+ 2,
33
+ 3,
34
+ 4,
35
+ 5,
36
+ 6,
37
+ 7,
38
+ 8,
39
+ 9,
40
+ 10,
41
+ 11,
42
+ 12,
43
+ 13,
44
+ 14,
45
+ 15,
46
+ 16,
47
+ 17
48
+ ],
49
+ "tuev": [
50
+ 0,
51
+ 1,
52
+ 2,
53
+ 3,
54
+ 4,
55
+ 5,
56
+ 6,
57
+ 7,
58
+ 8,
59
+ 9,
60
+ 10,
61
+ 11,
62
+ 12,
63
+ 13,
64
+ 14,
65
+ 15
66
+ ],
67
+ "ad65": [
68
+ 0,
69
+ 1,
70
+ 2,
71
+ 3,
72
+ 4,
73
+ 5,
74
+ 6,
75
+ 7,
76
+ 8,
77
+ 9,
78
+ 10,
79
+ 11,
80
+ 12,
81
+ 13,
82
+ 14,
83
+ 15,
84
+ 16,
85
+ 17
86
+ ],
87
+ "openbmi": [
88
+ 0,
89
+ 1,
90
+ 3,
91
+ 5,
92
+ 12,
93
+ 14,
94
+ 23,
95
+ 25,
96
+ 28,
97
+ 30,
98
+ 2,
99
+ 6,
100
+ 11,
101
+ 15,
102
+ 22,
103
+ 26,
104
+ 4,
105
+ 13
106
+ ],
107
+ "longitudinal": [
108
+ 0,
109
+ 2,
110
+ 7,
111
+ 11,
112
+ 23,
113
+ 27,
114
+ 41,
115
+ 45,
116
+ 55,
117
+ 57,
118
+ 5,
119
+ 13,
120
+ 21,
121
+ 29,
122
+ 39,
123
+ 47,
124
+ 9,
125
+ 25
126
+ ]
127
+ },
128
+ "rebase": "incumbent waveform, fusion and four heads; joint BIOT and TUEV head from readout epoch 9; zero initialized neural interaction",
129
+ "jointly_finetuned_neural_parent": "/workspace/research/runs/hybrid_biot_readout1/epoch-009/weights.pt",
130
+ "tuev_high_dimensional_spectral_projection_disabled": true,
131
+ "frozen_prior_representation": true,
132
+ "nonclinical_head_updates": "only the 256 added BIOT columns; original columns and biases fixed",
133
+ "faced_openbmi_neural_path": "common nonlinear fusion only; direct head columns masked",
134
+ "retention_teacher": "/workspace/research/runs/hybrid_wide1/epoch-004",
135
+ "retention_loss": {
136
+ "split": "train",
137
+ "temperature": 2.0,
138
+ "kl_weight": 1.0,
139
+ "tracks": [
140
+ "faced",
141
+ "ad65",
142
+ "openbmi",
143
+ "longitudinal"
144
+ ]
145
+ }
146
+ },
147
+ "joint_covariance_parent": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
148
+ "frozen_prior_representation": true,
149
+ "head_updates": "one linear head per track; added 128 shared covariance columns trainable; AD head initialized from the joint covariance parent",
150
+ "new_shared_representation": "one common covariance MLP inside the coupled backbone, trained by all five tasks; fixed spatial input adapters from the same jointly trained source",
151
+ "head_arithmetic": "one linear head evaluated in fixed feature blocks to preserve original bfloat16 accumulation dimensions",
152
+ "retention_teacher": {
153
+ "ad65": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
154
+ "other_tracks": "/workspace/research/runs/hybrid_wide1/epoch-004"
155
+ },
156
+ "retention_loss": {
157
+ "split": "train",
158
+ "temperature": 2.0,
159
+ "kl_weight": 1.0,
160
+ "tracks": [
161
+ "faced",
162
+ "ad65",
163
+ "openbmi",
164
+ "longitudinal"
165
+ ]
166
+ }
167
+ },
168
+ "loader_scale": 0.01,
169
+ "tracks": [
170
+ "faced",
171
+ "tuev",
172
+ "ad65",
173
+ "openbmi",
174
+ "longitudinal"
175
+ ],
176
+ "head_arithmetic": "same linear head in fixed feature blocks, sum in bfloat16 on GPU for non-AD tracks; AD remains float32",
177
+ "head_refinement": {
178
+ "source": "/workspace/research/runs/residual_heads1/epoch-018",
179
+ "source_weights_sha256": "e0b609137391b47f99438ccadaa22fc0bc10d2c10ead0ddf0a3c25be2c907c85",
180
+ "shared_backbone_unchanged": true,
181
+ "selected_head_epochs": {
182
+ "faced": 5,
183
+ "tuev": 24,
184
+ "ad65": 0,
185
+ "openbmi": 0,
186
+ "longitudinal": 0
187
+ }
188
+ },
189
+ "clinical_spectral_refinement": {
190
+ "source": "/workspace/research/runs/head_dropout1/epoch-016",
191
+ "zero_initialized_input_adapter": true,
192
+ "backbone_unchanged": true
193
+ }
194
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/covariances.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared neural filter-bank covariance decoder with spatial input adapters."""
2
+ import torch
3
+ from torch import nn
4
+ SPECS={'faced':(32,10,9),'tuev':(16,5,6),'ad65':(19,10,3),'openbmi':(62,4,2),'longitudinal':(58,2,2)}
5
+ TRACKS=tuple(SPECS)
6
+ BANDS=[(1,4),(4,8),(8,12),(12,16),(16,20),(20,24),(24,28),(28,32),(32,40),(40,48)]
7
+
8
+ @torch.no_grad()
9
+ def extract_covariances(t,x):
10
+ x=torch.nan_to_num(x.float().flatten(2)).clamp(-1e5,1e5)
11
+ x=x-x.mean(-1,keepdim=True)
12
+ if t in ('faced','tuev'):
13
+ x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
14
+ else:x=x-x.mean(1,keepdim=True)
15
+ # Per-window normalization, preserving spatial and frequency power ratios.
16
+ x=x/x.square().mean((1,2),keepdim=True).clamp_min(1e-12).sqrt()
17
+ frames=x.unfold(-1,400,200);frames=frames-frames.mean(-1,keepdim=True)
18
+ z=torch.fft.rfft(frames*torch.hann_window(400,device=x.device),dim=-1)/200
19
+ covs=[]
20
+ for lo,hi in BANDS:
21
+ v=z[...,2*lo:2*hi].flatten(2)
22
+ cov=(v.real@v.real.transpose(-1,-2)+v.imag@v.imag.transpose(-1,-2))/v.shape[-1]
23
+ covs.append(cov)
24
+ return torch.stack(covs,1)
25
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/data.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from functools import lru_cache
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ @lru_cache(maxsize=8)
7
+ def array(path):return np.load(path,mmap_mode='r',allow_pickle=False)
8
+ class Dataset(torch.utils.data.Dataset):
9
+ def __init__(self,root,limit=None,cache=False):
10
+ self.root=Path(root)
11
+ self.rows=json.loads((self.root/'manifest.json').read_text())['samples']
12
+ if limit:self.rows=self.rows[:limit]
13
+ self.cached=None
14
+ if cache and self.rows:
15
+ from collections import defaultdict
16
+ groups=defaultdict(list)
17
+ for i,r in enumerate(self.rows):groups[r['path']].append((i,r['index']))
18
+ for name,indices in groups.items():
19
+ path=(self.root/name).resolve()
20
+ if not path.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
21
+ source=np.load(path,mmap_mode='r',allow_pickle=False)
22
+ if self.cached is None:self.cached=torch.empty((len(self.rows),*source.shape[1:]),dtype=torch.float32)
23
+ dst,src=zip(*indices)
24
+ self.cached[list(dst)]=torch.as_tensor(source[list(src)]/100,dtype=torch.float32)
25
+ def __len__(self):return len(self.rows)
26
+ def __getitem__(self,i):
27
+ r=self.rows[i]
28
+ if self.cached is not None:return self.cached[i],r.get('label',-1),r['id']
29
+ p=(self.root/r['path']).resolve()
30
+ if not p.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
31
+ # Division precedes float32 conversion, matching official FACED/TUEV collate.
32
+ x=np.asarray(array(str(p))[r['index']])/100
33
+ return torch.as_tensor(x,dtype=torch.float32),r.get('label',-1),r['id']
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/features.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One shared residual backbone, five linear input adapters and output heads."""
2
+ import torch
3
+ from torch import nn
4
+
5
+ SPECS = {'faced': (32, 10, 9), 'tuev': (16, 5, 6), 'ad65': (19, 10, 3),
6
+ 'openbmi': (62, 4, 2), 'longitudinal': (58, 2, 2)}
7
+ TRACKS = tuple(SPECS)
8
+ EDGES = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,22,25,28,32,36,40,45,50,60,70,80,95]
9
+ COV_BANDS = [(1,4),(4,8),(8,12),(12,16),(16,20),(20,28),(28,40)]
10
+
11
+ def feature_dim(channels):
12
+ return channels * (4*(len(EDGES)-1)+4) + len(COV_BANDS)*channels*(channels-1)//2
13
+
14
+ @torch.no_grad()
15
+ def extract_features(track, x):
16
+ """Fixed features; no batch statistics or fitted inference transformations."""
17
+ x = x.float().flatten(2)
18
+ x = torch.nan_to_num(x, nan=0., posinf=1e5, neginf=-1e5).clamp(-1e5,1e5)
19
+ x = x - x.mean(-1,keepdim=True)
20
+ if track in ('ad65','openbmi','longitudinal'):
21
+ x = x - x.mean(1,keepdim=True)
22
+ rms = x.square().mean(-1).clamp_min(1e-12).sqrt()
23
+ norm = x / rms.unsqueeze(-1)
24
+ moments = torch.stack([rms.log(), norm.abs().amax(-1).clamp_min(1).log(),
25
+ norm.pow(4).mean(-1).clamp_min(1).log(),
26
+ (norm[...,1:]-norm[...,:-1]).square().mean(-1).clamp_min(1e-10).log()],-1)
27
+ frames = x.unfold(-1,400,200)
28
+ frames = frames - frames.mean(-1,keepdim=True)
29
+ window = torch.hann_window(400,device=x.device)
30
+ z = torch.fft.rfft(frames*window,dim=-1)/200
31
+ power = z.abs().square()
32
+ bands = torch.stack([power[...,2*lo:2*hi].mean(-1) for lo,hi in zip(EDGES[:-1],EDGES[1:])],-1)
33
+ lp = bands.mean(-2).clamp_min(1e-12).log()
34
+ variation = bands.clamp_min(1e-12).log().std(-2,correction=0)
35
+ relative_frequency = lp - lp.mean(-1,keepdim=True)
36
+ relative_channel = lp - lp.mean(1,keepdim=True)
37
+ parts = [torch.cat([lp, relative_frequency, relative_channel, variation, moments],-1).flatten(1)]
38
+ ii,jj = torch.triu_indices(x.shape[1],x.shape[1],offset=1,device=x.device)
39
+ for lo,hi in COV_BANDS:
40
+ v = z[...,2*lo:2*hi].flatten(2)
41
+ cov = v.real @ v.real.transpose(-1,-2) + v.imag @ v.imag.transpose(-1,-2)
42
+ d = cov.diagonal(dim1=-2,dim2=-1).clamp_min(1e-12).sqrt()
43
+ cor = cov / (d.unsqueeze(1)*d.unsqueeze(2)).clamp_min(1e-12)
44
+ parts.append(cor[:,ii,jj].clamp(-1,1))
45
+ result = torch.cat(parts,-1)
46
+ return torch.nan_to_num(result).clamp(-40,40)
47
+
48
+ class Standardize(nn.Module):
49
+ def __init__(self, dim):
50
+ super().__init__()
51
+ self.register_buffer('mean',torch.zeros(dim))
52
+ self.register_buffer('scale',torch.ones(dim))
53
+ def forward(self,x):
54
+ return ((x-self.mean)/self.scale).clamp(-8,8)
55
+
56
+ class Residual(nn.Module):
57
+ def __init__(self,width,dropout):
58
+ super().__init__()
59
+ self.net=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),
60
+ nn.Dropout(dropout),nn.Linear(width*2,width),nn.Dropout(dropout))
61
+ def forward(self,x):
62
+ return x+self.net(x)
63
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/infer.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse,json
2
+ from pathlib import Path
3
+ import torch
4
+ from model import HybridModel,SPECS
5
+ from data import Dataset
6
+ from covariances import extract_covariances
7
+ p=argparse.ArgumentParser();p.add_argument('input',type=Path);p.add_argument('output',type=Path);a=p.parse_args()
8
+ root=Path(__file__).resolve().parent;c=json.loads((root/'config.json').read_text());t=json.loads((a.input/'manifest.json').read_text())['track']
9
+ if t not in SPECS:raise ValueError('unknown track')
10
+ torch.set_num_threads(4);device='cuda' if torch.cuda.is_available() else 'cpu'
11
+ m=HybridModel(**c['architecture']).to(device);m.load_state_dict(torch.load(root/'weights.pt',map_location=device,weights_only=True));m.eval()
12
+ a.output.mkdir(parents=True,exist_ok=True)
13
+ with torch.inference_mode(),(a.output/'predictions.jsonl').open('w') as f:
14
+ for x,_,ids in torch.utils.data.DataLoader(Dataset(a.input),batch_size=64,num_workers=0):
15
+ # FFT features stay float32; convolutions can use bfloat16 on CUDA.
16
+ x=x.to(device)
17
+ from features import extract_features
18
+ torch.backends.cuda.matmul.allow_tf32=False
19
+ features=extract_features(t,x)
20
+ covariances=extract_covariances(t,x)
21
+ torch.backends.cuda.matmul.allow_tf32=True
22
+ with torch.autocast(device,dtype=torch.bfloat16,enabled=device=='cuda'):pred=m(t,x,features,covariances=covariances)
23
+ pp=pred.float().softmax(-1).cpu().numpy()
24
+ for sid,pr in zip(ids,pp):f.write(json.dumps({'id':sid,'probabilities':pr.tolist()})+'\n')
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/infer.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ exec python "$(dirname -- "$0")/infer.py" "$1" "$2"
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/model.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One fused waveform/spectral backbone used identically by all five tasks."""
2
+ import torch
3
+ from torch import nn
4
+ from braindecode.models import BIOT
5
+ from features import SPECS,TRACKS,feature_dim,extract_features,Standardize,Residual
6
+ from covariances import BANDS,extract_covariances
7
+
8
+ class InputAdapter(nn.Module):
9
+ def __init__(self,c,width,channels,spectral_enabled=True):
10
+ super().__init__()
11
+ self.signal=nn.Conv1d(c,channels,1,bias=False)
12
+ self.neural=nn.Conv1d(c,18,1,bias=False)
13
+ self.normalizer=Standardize(feature_dim(c))
14
+ self.spectral=nn.Linear(feature_dim(c),width)
15
+ self.dropout=nn.Dropout(.1)
16
+ self.register_buffer("spectral_enabled",torch.tensor(float(spectral_enabled)))
17
+ self.spatial_weight=nn.Parameter(torch.randn(len(BANDS),24,c)/c**.5)
18
+ def spatial_features(self,covariances):
19
+ with torch.autocast(covariances.device.type,enabled=False):
20
+ w=self.spatial_weight.float()/self.spatial_weight.float().norm(dim=-1,keepdim=True).clamp_min(1e-6)
21
+ power=torch.einsum('bfc,nbcd,bfd->nbf',w,covariances.float(),w).clamp_min(1e-8).log()
22
+ return torch.cat([power,power-power.mean(1,keepdim=True)],1).flatten(1)
23
+ def forward(self,x,features,covariance_features):
24
+ return self.signal(x).unsqueeze(1),self.spectral_enabled*self.spectral(self.dropout(self.normalizer(features))),self.neural(x),covariance_features
25
+
26
+ class SharedBackbone(nn.Module):
27
+ def __init__(self,channels,width,depth,dropout,wave_filters):
28
+ super().__init__()
29
+ self.waveform=nn.Sequential(
30
+ nn.Conv2d(1,wave_filters,(1,64),padding=(0,32),bias=False),nn.GroupNorm(1,wave_filters),
31
+ nn.Conv2d(wave_filters,2*wave_filters,(channels,1),groups=wave_filters,bias=False),nn.GroupNorm(1,2*wave_filters),nn.ELU(),
32
+ nn.AvgPool2d((1,4)),nn.Dropout(.35),
33
+ nn.Conv2d(2*wave_filters,2*wave_filters,(1,16),padding=(0,8),groups=2*wave_filters,bias=False),nn.Conv2d(2*wave_filters,2*wave_filters,1,bias=False),
34
+ nn.GroupNorm(1,2*wave_filters),nn.ELU(),nn.AvgPool2d((1,8)),nn.Dropout(.35))
35
+ self.wave_summary=nn.Sequential(nn.AdaptiveAvgPool2d((1,8)),nn.Flatten(),nn.Linear(2*wave_filters*8,width))
36
+ self.fusion=nn.Sequential(nn.LayerNorm(width),nn.GELU(),nn.Dropout(dropout),
37
+ *[Residual(width,dropout) for _ in range(depth)],nn.LayerNorm(width))
38
+ # Both representations interact before the shared residual stack.
39
+ self.wave_gain=nn.Parameter(torch.tensor(.1))
40
+ self.biot=BIOT(n_chans=18,n_outputs=2,n_times=400,sfreq=200)
41
+ self.biot.final_layer=nn.Identity()
42
+ self.biot_projection=nn.Sequential(nn.LayerNorm(256),nn.Linear(256,width),nn.Dropout(.2))
43
+ nn.init.normal_(self.biot_projection[1].weight,std=.001);nn.init.zeros_(self.biot_projection[1].bias)
44
+ self.covariance_encoder=nn.Sequential(nn.LayerNorm(len(BANDS)*24*2),nn.Linear(len(BANDS)*24*2,width),nn.GELU(),nn.Dropout(.4),
45
+ *[Residual(width,.4) for _ in range(2)],nn.LayerNorm(width))
46
+ self.covariance_projection=nn.Linear(width,width)
47
+ nn.init.zeros_(self.covariance_projection.weight);nn.init.zeros_(self.covariance_projection.bias)
48
+ def forward(self,signal,spectral,neural_signal,covariance_features):
49
+ wave=self.waveform(signal)
50
+ neural=self.biot(neural_signal.float())
51
+ neural=self.biot_projection[0](neural)
52
+ projected=self.biot_projection[2](self.biot_projection[1](neural))
53
+ with torch.autocast(signal.device.type,enabled=False):
54
+ covariance_embedding=self.covariance_encoder(covariance_features.float())
55
+ original=spectral+self.wave_gain*self.wave_summary(wave)+.01*projected
56
+ coupled=.001*self.covariance_projection(covariance_embedding).to(original.dtype)
57
+ fused=self.fusion(original+coupled)
58
+ return torch.cat([wave.flatten(1),fused,neural,covariance_embedding],-1)
59
+
60
+ class ResidualHead(nn.Module):
61
+ """A small nonlinear classifier correction around an inherited linear readout."""
62
+ def __init__(self,features,classes,width=64,dropout=.3,full_precision=False):
63
+ super().__init__();self.full_precision=full_precision
64
+ self.base=nn.Linear(features,classes)
65
+ self.delta=nn.Sequential(nn.LayerNorm(features),nn.Linear(features,width),nn.GELU(),nn.Dropout(dropout),nn.Linear(width,classes))
66
+ nn.init.zeros_(self.delta[-1].weight);nn.init.zeros_(self.delta[-1].bias)
67
+ def forward(self,x):
68
+ if self.full_precision:
69
+ with torch.autocast(x.device.type,enabled=False):return self.base(x.float())+self.delta(x.float())
70
+ prior=nn.functional.linear(x[:,:-128].contiguous(),self.base.weight[:,:-128].contiguous(),self.base.bias)
71
+ added=nn.functional.linear(x[:,-128:].contiguous(),self.base.weight[:,-128:].contiguous())
72
+ value=prior+added
73
+ return value+self.delta(x).to(value.dtype)
74
+
75
+ class HybridModel(nn.Module):
76
+ def __init__(self,channels=32,width=128,depth=2,dropout=.5,wave_filters=32,head_width=64,head_dropout=.3):
77
+ super().__init__()
78
+ self.adapters=nn.ModuleDict({t:InputAdapter(c,width,channels,spectral_enabled=t not in ("faced","tuev","openbmi")) for t,(c,s,k) in SPECS.items()})
79
+ self.backbone=SharedBackbone(channels,width,depth,dropout,wave_filters)
80
+ self.heads=nn.ModuleDict({t:ResidualHead(2*wave_filters*(((s*200+1)//4+1)//8)+width+256+width,k,head_width,head_dropout,full_precision=t=='ad65') for t,(c,s,k) in SPECS.items()})
81
+ def forward(self,t,x,features=None,covariances=None,covariance_features=None):
82
+ if features is None:features=extract_features(t,x)
83
+ if covariance_features is None:
84
+ if covariances is None:covariances=extract_covariances(t,x)
85
+ covariance_features=self.adapters[t].spatial_features(covariances)
86
+ signal=x.flatten(2);signal=signal-signal.mean(-1,keepdim=True)
87
+ if t in ('faced','tuev'):signal=signal/signal.std(-1,keepdim=True,correction=0).clamp_min(1e-6)
88
+ else:signal=signal-signal.mean(1,keepdim=True)
89
+ signal=signal.clamp(-20,20)
90
+ adapted=self.adapters[t](signal,features,covariance_features)
91
+ representation=self.backbone(*adapted)
92
+ if t in ('faced','openbmi'):
93
+ representation=torch.cat([representation[:,:-384],torch.zeros_like(representation[:,-384:-128]),representation[:,-128:]],-1)
94
+ return self.heads[t](representation)
95
+
96
+ def widen_state_dict(state,multiplier=2):
97
+ """Duplicate temporal features and divide downstream sums to preserve outputs."""
98
+ result={}
99
+ for key,value in state.items():
100
+ if key.startswith('backbone.waveform.'):
101
+ layer=int(key.split('.')[2])
102
+ if layer in (0,2,7):value=value.repeat(multiplier,1,1,1)
103
+ elif layer in (1,3,9):value=value.repeat(multiplier)
104
+ elif layer==8:value=value.repeat(multiplier,multiplier,1,1)/multiplier
105
+ elif key=='backbone.wave_summary.2.weight':value=value.repeat(1,multiplier)/multiplier
106
+ elif key.startswith('heads.') and key.endswith('.weight'):
107
+ raw=value[:,:-128]/multiplier
108
+ value=torch.cat([raw]*multiplier+[value[:,-128:]],1)
109
+ result[key]=value
110
+ return result
111
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S015/training.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S017/features.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One shared residual backbone, five linear input adapters and output heads."""
2
+ import torch
3
+ from torch import nn
4
+
5
+ SPECS = {'faced': (32, 10, 9), 'tuev': (16, 5, 6), 'ad65': (19, 10, 3),
6
+ 'openbmi': (62, 4, 2), 'longitudinal': (58, 2, 2)}
7
+ TRACKS = tuple(SPECS)
8
+ EDGES = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,22,25,28,32,36,40,45,50,60,70,80,95]
9
+ COV_BANDS = [(1,4),(4,8),(8,12),(12,16),(16,20),(20,28),(28,40)]
10
+
11
+ def feature_dim(channels):
12
+ return channels * (4*(len(EDGES)-1)+4) + len(COV_BANDS)*channels*(channels-1)//2
13
+
14
+ @torch.no_grad()
15
+ def extract_features(track, x):
16
+ """Fixed features; no batch statistics or fitted inference transformations."""
17
+ x = x.float().flatten(2)
18
+ x = torch.nan_to_num(x, nan=0., posinf=1e5, neginf=-1e5).clamp(-1e5,1e5)
19
+ x = x - x.mean(-1,keepdim=True)
20
+ if track in ('ad65','openbmi','longitudinal'):
21
+ x = x - x.mean(1,keepdim=True)
22
+ rms = x.square().mean(-1).clamp_min(1e-12).sqrt()
23
+ norm = x / rms.unsqueeze(-1)
24
+ moments = torch.stack([rms.log(), norm.abs().amax(-1).clamp_min(1).log(),
25
+ norm.pow(4).mean(-1).clamp_min(1).log(),
26
+ (norm[...,1:]-norm[...,:-1]).square().mean(-1).clamp_min(1e-10).log()],-1)
27
+ frames = x.unfold(-1,400,200)
28
+ frames = frames - frames.mean(-1,keepdim=True)
29
+ window = torch.hann_window(400,device=x.device)
30
+ z = torch.fft.rfft(frames*window,dim=-1)/200
31
+ power = z.abs().square()
32
+ bands = torch.stack([power[...,2*lo:2*hi].mean(-1) for lo,hi in zip(EDGES[:-1],EDGES[1:])],-1)
33
+ lp = bands.mean(-2).clamp_min(1e-12).log()
34
+ variation = bands.clamp_min(1e-12).log().std(-2,correction=0)
35
+ relative_frequency = lp - lp.mean(-1,keepdim=True)
36
+ relative_channel = lp - lp.mean(1,keepdim=True)
37
+ parts = [torch.cat([lp, relative_frequency, relative_channel, variation, moments],-1).flatten(1)]
38
+ ii,jj = torch.triu_indices(x.shape[1],x.shape[1],offset=1,device=x.device)
39
+ for lo,hi in COV_BANDS:
40
+ v = z[...,2*lo:2*hi].flatten(2)
41
+ cov = v.real @ v.real.transpose(-1,-2) + v.imag @ v.imag.transpose(-1,-2)
42
+ d = cov.diagonal(dim1=-2,dim2=-1).clamp_min(1e-12).sqrt()
43
+ cor = cov / (d.unsqueeze(1)*d.unsqueeze(2)).clamp_min(1e-12)
44
+ parts.append(cor[:,ii,jj].clamp(-1,1))
45
+ result = torch.cat(parts,-1)
46
+ return torch.nan_to_num(result).clamp(-40,40)
47
+
48
+ class Standardize(nn.Module):
49
+ def __init__(self, dim):
50
+ super().__init__()
51
+ self.register_buffer('mean',torch.zeros(dim))
52
+ self.register_buffer('scale',torch.ones(dim))
53
+ def forward(self,x):
54
+ return ((x-self.mean)/self.scale).clamp(-8,8)
55
+
56
+ class Residual(nn.Module):
57
+ def __init__(self,width,dropout):
58
+ super().__init__()
59
+ self.net=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),
60
+ nn.Dropout(dropout),nn.Linear(width*2,width),nn.Dropout(dropout))
61
+ def forward(self,x):
62
+ return x+self.net(x)
63
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S017/training.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/alpha_features.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed alpha prominence features from each individual two-second window."""
2
+ import torch
3
+
4
+ REGION_NAMES=('occipital','parietal','central','frontal','left_posterior','right_posterior')
5
+ REGIONS=(('PO7','PO5','PO3','POZ','PO4','PO6','PO8','O1','OZ','O2'),
6
+ ('P7','P5','P3','P1','PZ','P2','P4','P6','P8'),
7
+ ('FC5','FC3','FC1','FCZ','FC2','FC4','FC6','C5','C3','C1','CZ','C2','C4','C6'),
8
+ ('FP1','FPZ','FP2','AF3','AF4','F7','F5','F3','F1','FZ','F2','F4','F6','F8'),
9
+ ('P7','P5','P3','P1','PO7','PO5','PO3','O1'),
10
+ ('P2','P4','P6','P8','PO4','PO6','PO8','O2'))
11
+ ALPHA_DIM=58*7+6*22
12
+
13
+ def region_matrix(channels):
14
+ result=torch.zeros(len(REGIONS),len(channels))
15
+ for i,names in enumerate(REGIONS):
16
+ for name in names:result[i,channels.index(name)]=1/len(names)
17
+ return result.tolist()
18
+
19
+ @torch.no_grad()
20
+ def extract_alpha_features(signal,regions):
21
+ with torch.autocast(signal.device.type,enabled=False):
22
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
23
+ spectrum=torch.fft.rfft(x*torch.hann_window(400,device=x.device),dim=-1)/200
24
+ power=spectrum.abs().square().clamp_min(1e-12)
25
+ lp=power.log()
26
+ # Geometric regional means resist domination by one high-amplitude channel.
27
+ regional=torch.einsum('rc,ncf->nrf',regions.float(),lp)
28
+ lp=torch.cat([lp,regional],1)
29
+ low=lp[...,8:13].mean(-1,keepdim=True)
30
+ high=lp[...,36:49].mean(-1,keepdim=True)
31
+ freq=torch.arange(7.,14.5,.5,device=x.device)
32
+ alpha=lp[...,14:29]
33
+ baseline=low+(high-low)*((freq-5)/16)
34
+ prominence=alpha-baseline
35
+ normalized=alpha.softmax(-1)
36
+ center=(normalized*freq).sum(-1)
37
+ entropy=-(normalized*normalized.clamp_min(1e-12).log()).sum(-1)
38
+ alpha_mean=torch.logsumexp(alpha,-1)-torch.log(torch.tensor(15.,device=x.device))
39
+ def log_band(lo,hi):
40
+ return torch.logsumexp(lp[...,lo:hi],-1)-torch.log(torch.tensor(float(hi-lo),device=x.device))
41
+ summaries=torch.stack([alpha_mean-log_band(2,81),alpha_mean-log_band(8,14),
42
+ alpha_mean-log_band(30,61),prominence.max(-1).values,
43
+ prominence.mean(-1),center,entropy],-1)
44
+ return torch.cat([summaries[:,:58].flatten(1),summaries[:,58:].flatten(1),
45
+ prominence[:,58:].flatten(1)],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/config.json ADDED
@@ -0,0 +1,697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "bci-shared-biot-covariance-bf16head-v1",
3
+ "architecture": {
4
+ "channels": 32,
5
+ "width": 128,
6
+ "depth": 2,
7
+ "dropout": 0.5,
8
+ "wave_filters": 32,
9
+ "head_width": 64,
10
+ "head_dropout": 0.3,
11
+ "clinical_asymmetry": true,
12
+ "alpha_regions": [
13
+ [
14
+ 0.0,
15
+ 0.0,
16
+ 0.0,
17
+ 0.0,
18
+ 0.0,
19
+ 0.0,
20
+ 0.0,
21
+ 0.0,
22
+ 0.0,
23
+ 0.0,
24
+ 0.0,
25
+ 0.0,
26
+ 0.0,
27
+ 0.0,
28
+ 0.0,
29
+ 0.0,
30
+ 0.0,
31
+ 0.0,
32
+ 0.0,
33
+ 0.0,
34
+ 0.0,
35
+ 0.0,
36
+ 0.0,
37
+ 0.0,
38
+ 0.0,
39
+ 0.0,
40
+ 0.0,
41
+ 0.0,
42
+ 0.0,
43
+ 0.0,
44
+ 0.0,
45
+ 0.0,
46
+ 0.0,
47
+ 0.0,
48
+ 0.0,
49
+ 0.0,
50
+ 0.0,
51
+ 0.0,
52
+ 0.0,
53
+ 0.0,
54
+ 0.0,
55
+ 0.0,
56
+ 0.0,
57
+ 0.0,
58
+ 0.0,
59
+ 0.0,
60
+ 0.0,
61
+ 0.0,
62
+ 0.10000000149011612,
63
+ 0.10000000149011612,
64
+ 0.10000000149011612,
65
+ 0.10000000149011612,
66
+ 0.10000000149011612,
67
+ 0.10000000149011612,
68
+ 0.10000000149011612,
69
+ 0.10000000149011612,
70
+ 0.10000000149011612,
71
+ 0.10000000149011612
72
+ ],
73
+ [
74
+ 0.0,
75
+ 0.0,
76
+ 0.0,
77
+ 0.0,
78
+ 0.0,
79
+ 0.0,
80
+ 0.0,
81
+ 0.0,
82
+ 0.0,
83
+ 0.0,
84
+ 0.0,
85
+ 0.0,
86
+ 0.0,
87
+ 0.0,
88
+ 0.0,
89
+ 0.0,
90
+ 0.0,
91
+ 0.0,
92
+ 0.0,
93
+ 0.0,
94
+ 0.0,
95
+ 0.0,
96
+ 0.0,
97
+ 0.0,
98
+ 0.0,
99
+ 0.0,
100
+ 0.0,
101
+ 0.0,
102
+ 0.0,
103
+ 0.0,
104
+ 0.0,
105
+ 0.0,
106
+ 0.0,
107
+ 0.0,
108
+ 0.0,
109
+ 0.0,
110
+ 0.0,
111
+ 0.0,
112
+ 0.0,
113
+ 0.1111111119389534,
114
+ 0.1111111119389534,
115
+ 0.1111111119389534,
116
+ 0.1111111119389534,
117
+ 0.1111111119389534,
118
+ 0.1111111119389534,
119
+ 0.1111111119389534,
120
+ 0.1111111119389534,
121
+ 0.1111111119389534,
122
+ 0.0,
123
+ 0.0,
124
+ 0.0,
125
+ 0.0,
126
+ 0.0,
127
+ 0.0,
128
+ 0.0,
129
+ 0.0,
130
+ 0.0,
131
+ 0.0
132
+ ],
133
+ [
134
+ 0.0,
135
+ 0.0,
136
+ 0.0,
137
+ 0.0,
138
+ 0.0,
139
+ 0.0,
140
+ 0.0,
141
+ 0.0,
142
+ 0.0,
143
+ 0.0,
144
+ 0.0,
145
+ 0.0,
146
+ 0.0,
147
+ 0.0,
148
+ 0.0714285746216774,
149
+ 0.0714285746216774,
150
+ 0.0714285746216774,
151
+ 0.0714285746216774,
152
+ 0.0714285746216774,
153
+ 0.0714285746216774,
154
+ 0.0714285746216774,
155
+ 0.0,
156
+ 0.0714285746216774,
157
+ 0.0714285746216774,
158
+ 0.0714285746216774,
159
+ 0.0714285746216774,
160
+ 0.0714285746216774,
161
+ 0.0714285746216774,
162
+ 0.0714285746216774,
163
+ 0.0,
164
+ 0.0,
165
+ 0.0,
166
+ 0.0,
167
+ 0.0,
168
+ 0.0,
169
+ 0.0,
170
+ 0.0,
171
+ 0.0,
172
+ 0.0,
173
+ 0.0,
174
+ 0.0,
175
+ 0.0,
176
+ 0.0,
177
+ 0.0,
178
+ 0.0,
179
+ 0.0,
180
+ 0.0,
181
+ 0.0,
182
+ 0.0,
183
+ 0.0,
184
+ 0.0,
185
+ 0.0,
186
+ 0.0,
187
+ 0.0,
188
+ 0.0,
189
+ 0.0,
190
+ 0.0,
191
+ 0.0
192
+ ],
193
+ [
194
+ 0.0714285746216774,
195
+ 0.0714285746216774,
196
+ 0.0714285746216774,
197
+ 0.0714285746216774,
198
+ 0.0714285746216774,
199
+ 0.0714285746216774,
200
+ 0.0714285746216774,
201
+ 0.0714285746216774,
202
+ 0.0714285746216774,
203
+ 0.0714285746216774,
204
+ 0.0714285746216774,
205
+ 0.0714285746216774,
206
+ 0.0714285746216774,
207
+ 0.0714285746216774,
208
+ 0.0,
209
+ 0.0,
210
+ 0.0,
211
+ 0.0,
212
+ 0.0,
213
+ 0.0,
214
+ 0.0,
215
+ 0.0,
216
+ 0.0,
217
+ 0.0,
218
+ 0.0,
219
+ 0.0,
220
+ 0.0,
221
+ 0.0,
222
+ 0.0,
223
+ 0.0,
224
+ 0.0,
225
+ 0.0,
226
+ 0.0,
227
+ 0.0,
228
+ 0.0,
229
+ 0.0,
230
+ 0.0,
231
+ 0.0,
232
+ 0.0,
233
+ 0.0,
234
+ 0.0,
235
+ 0.0,
236
+ 0.0,
237
+ 0.0,
238
+ 0.0,
239
+ 0.0,
240
+ 0.0,
241
+ 0.0,
242
+ 0.0,
243
+ 0.0,
244
+ 0.0,
245
+ 0.0,
246
+ 0.0,
247
+ 0.0,
248
+ 0.0,
249
+ 0.0,
250
+ 0.0,
251
+ 0.0
252
+ ],
253
+ [
254
+ 0.0,
255
+ 0.0,
256
+ 0.0,
257
+ 0.0,
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 0.0,
262
+ 0.0,
263
+ 0.0,
264
+ 0.0,
265
+ 0.0,
266
+ 0.0,
267
+ 0.0,
268
+ 0.0,
269
+ 0.0,
270
+ 0.0,
271
+ 0.0,
272
+ 0.0,
273
+ 0.0,
274
+ 0.0,
275
+ 0.0,
276
+ 0.0,
277
+ 0.0,
278
+ 0.0,
279
+ 0.0,
280
+ 0.0,
281
+ 0.0,
282
+ 0.0,
283
+ 0.0,
284
+ 0.0,
285
+ 0.0,
286
+ 0.0,
287
+ 0.0,
288
+ 0.0,
289
+ 0.0,
290
+ 0.0,
291
+ 0.0,
292
+ 0.0,
293
+ 0.125,
294
+ 0.125,
295
+ 0.125,
296
+ 0.125,
297
+ 0.0,
298
+ 0.0,
299
+ 0.0,
300
+ 0.0,
301
+ 0.0,
302
+ 0.125,
303
+ 0.125,
304
+ 0.125,
305
+ 0.0,
306
+ 0.0,
307
+ 0.0,
308
+ 0.0,
309
+ 0.125,
310
+ 0.0,
311
+ 0.0
312
+ ],
313
+ [
314
+ 0.0,
315
+ 0.0,
316
+ 0.0,
317
+ 0.0,
318
+ 0.0,
319
+ 0.0,
320
+ 0.0,
321
+ 0.0,
322
+ 0.0,
323
+ 0.0,
324
+ 0.0,
325
+ 0.0,
326
+ 0.0,
327
+ 0.0,
328
+ 0.0,
329
+ 0.0,
330
+ 0.0,
331
+ 0.0,
332
+ 0.0,
333
+ 0.0,
334
+ 0.0,
335
+ 0.0,
336
+ 0.0,
337
+ 0.0,
338
+ 0.0,
339
+ 0.0,
340
+ 0.0,
341
+ 0.0,
342
+ 0.0,
343
+ 0.0,
344
+ 0.0,
345
+ 0.0,
346
+ 0.0,
347
+ 0.0,
348
+ 0.0,
349
+ 0.0,
350
+ 0.0,
351
+ 0.0,
352
+ 0.0,
353
+ 0.0,
354
+ 0.0,
355
+ 0.0,
356
+ 0.0,
357
+ 0.0,
358
+ 0.125,
359
+ 0.125,
360
+ 0.125,
361
+ 0.125,
362
+ 0.0,
363
+ 0.0,
364
+ 0.0,
365
+ 0.0,
366
+ 0.125,
367
+ 0.125,
368
+ 0.125,
369
+ 0.0,
370
+ 0.0,
371
+ 0.125
372
+ ]
373
+ ],
374
+ "clinical_envelope": true,
375
+ "temporal_pool": true,
376
+ "temporal_evidence": true,
377
+ "evidence_temperature": 0.25,
378
+ "random_fourier": true,
379
+ "fourier_features": 256,
380
+ "tangent_readout": true,
381
+ "codebrain_fusion": true
382
+ },
383
+ "initialization": {
384
+ "initialization": "continue joint training from a complete shared-model checkpoint",
385
+ "parent": "/workspace/research/runs/hybrid_biot_fusionshrink0100/epoch-001/weights.pt",
386
+ "parent_initialization": {
387
+ "initialization": "jointly trained parent plus audited pretrained BIOT in a single coupled backbone",
388
+ "parent": "/workspace/research/runs/hybrid_wide1/epoch-004/weights.pt",
389
+ "audited_biot": {
390
+ "initialization": "pretrained",
391
+ "repo": "braindecode/biot-pretrained-six-datasets-18chs",
392
+ "revision": "7e9aabf302870012f73773276803aab97993951c",
393
+ "sha256": "a218f4054ae29962c6fd9d23d94c446d354c4f53e805a6771c85749ccc20baaa",
394
+ "license": "BSD-3-Clause",
395
+ "source_braindecode": "1.3.0",
396
+ "loaded_core_tensors": 56,
397
+ "skipped_classifier_tensors": 3
398
+ },
399
+ "neural_channel_indices": {
400
+ "faced": [
401
+ 0,
402
+ 1,
403
+ 2,
404
+ 3,
405
+ 4,
406
+ 5,
407
+ 6,
408
+ 7,
409
+ 8,
410
+ 9,
411
+ 10,
412
+ 11,
413
+ 12,
414
+ 13,
415
+ 14,
416
+ 15,
417
+ 16,
418
+ 17
419
+ ],
420
+ "tuev": [
421
+ 0,
422
+ 1,
423
+ 2,
424
+ 3,
425
+ 4,
426
+ 5,
427
+ 6,
428
+ 7,
429
+ 8,
430
+ 9,
431
+ 10,
432
+ 11,
433
+ 12,
434
+ 13,
435
+ 14,
436
+ 15
437
+ ],
438
+ "ad65": [
439
+ 0,
440
+ 1,
441
+ 2,
442
+ 3,
443
+ 4,
444
+ 5,
445
+ 6,
446
+ 7,
447
+ 8,
448
+ 9,
449
+ 10,
450
+ 11,
451
+ 12,
452
+ 13,
453
+ 14,
454
+ 15,
455
+ 16,
456
+ 17
457
+ ],
458
+ "openbmi": [
459
+ 0,
460
+ 1,
461
+ 3,
462
+ 5,
463
+ 12,
464
+ 14,
465
+ 23,
466
+ 25,
467
+ 28,
468
+ 30,
469
+ 2,
470
+ 6,
471
+ 11,
472
+ 15,
473
+ 22,
474
+ 26,
475
+ 4,
476
+ 13
477
+ ],
478
+ "longitudinal": [
479
+ 0,
480
+ 2,
481
+ 7,
482
+ 11,
483
+ 23,
484
+ 27,
485
+ 41,
486
+ 45,
487
+ 55,
488
+ 57,
489
+ 5,
490
+ 13,
491
+ 21,
492
+ 29,
493
+ 39,
494
+ 47,
495
+ 9,
496
+ 25
497
+ ]
498
+ },
499
+ "rebase": "incumbent waveform, fusion and four heads; joint BIOT and TUEV head from readout epoch 9; zero initialized neural interaction",
500
+ "jointly_finetuned_neural_parent": "/workspace/research/runs/hybrid_biot_readout1/epoch-009/weights.pt",
501
+ "tuev_high_dimensional_spectral_projection_disabled": true,
502
+ "frozen_prior_representation": true,
503
+ "nonclinical_head_updates": "only the 256 added BIOT columns; original columns and biases fixed",
504
+ "faced_openbmi_neural_path": "common nonlinear fusion only; direct head columns masked",
505
+ "retention_teacher": "/workspace/research/runs/hybrid_wide1/epoch-004",
506
+ "retention_loss": {
507
+ "split": "train",
508
+ "temperature": 2.0,
509
+ "kl_weight": 1.0,
510
+ "tracks": [
511
+ "faced",
512
+ "ad65",
513
+ "openbmi",
514
+ "longitudinal"
515
+ ]
516
+ }
517
+ },
518
+ "joint_covariance_parent": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
519
+ "frozen_prior_representation": true,
520
+ "head_updates": "one linear head per track; added 128 shared covariance columns trainable; AD head initialized from the joint covariance parent",
521
+ "new_shared_representation": "one common covariance MLP inside the coupled backbone, trained by all five tasks; fixed spatial input adapters from the same jointly trained source",
522
+ "head_arithmetic": "one linear head evaluated in fixed feature blocks to preserve original bfloat16 accumulation dimensions",
523
+ "retention_teacher": {
524
+ "ad65": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
525
+ "other_tracks": "/workspace/research/runs/hybrid_wide1/epoch-004"
526
+ },
527
+ "retention_loss": {
528
+ "split": "train",
529
+ "temperature": 2.0,
530
+ "kl_weight": 1.0,
531
+ "tracks": [
532
+ "faced",
533
+ "ad65",
534
+ "openbmi",
535
+ "longitudinal"
536
+ ]
537
+ }
538
+ },
539
+ "loader_scale": 0.01,
540
+ "tracks": [
541
+ "faced",
542
+ "tuev",
543
+ "ad65",
544
+ "openbmi",
545
+ "longitudinal"
546
+ ],
547
+ "head_arithmetic": "same linear head in fixed feature blocks, sum in bfloat16 on GPU for non-AD tracks; AD remains float32",
548
+ "head_refinement": {
549
+ "source": "/workspace/research/runs/residual_heads1/epoch-018",
550
+ "source_weights_sha256": "e0b609137391b47f99438ccadaa22fc0bc10d2c10ead0ddf0a3c25be2c907c85",
551
+ "shared_backbone_unchanged": true,
552
+ "selected_head_epochs": {
553
+ "faced": 5,
554
+ "tuev": 24,
555
+ "ad65": 0,
556
+ "openbmi": 0,
557
+ "longitudinal": 0
558
+ }
559
+ },
560
+ "clinical_spectral_refinement": {
561
+ "source": "/workspace/research/runs/head_dropout1/epoch-016",
562
+ "zero_initialized_input_adapter": true,
563
+ "backbone_unchanged": true
564
+ },
565
+ "head_estimation": {
566
+ "method": "class/subject-balanced Gaussian linear discriminant; covariance augmented by class-conditional subject/session mean variation before shrinkage",
567
+ "selected_shrinkage": {
568
+ "faced": "inherited",
569
+ "tuev": "inherited",
570
+ "ad65": "inherited",
571
+ "openbmi": "inherited",
572
+ "longitudinal": {
573
+ "shrinkage": 0.9,
574
+ "domain_strength": 1.0
575
+ }
576
+ },
577
+ "feature_scaling": "fitted on training data and folded into linear coefficients"
578
+ },
579
+ "clinical_asymmetry_refinement": {
580
+ "source": "/workspace/research/runs/domain_lda_heads1/epoch-001",
581
+ "zero_initialized_input_adapter": true,
582
+ "backbone_unchanged": true
583
+ },
584
+ "alpha_rhythm_adapter": {
585
+ "training_normalization_only": true,
586
+ "regions": [
587
+ "occipital",
588
+ "parietal",
589
+ "central",
590
+ "frontal",
591
+ "left_posterior",
592
+ "right_posterior"
593
+ ],
594
+ "features": "per-window alpha prominence relative to adjacent frequencies",
595
+ "shared_backbone_unchanged": true
596
+ },
597
+ "clinical_envelope_refinement": {
598
+ "source": "/workspace/research/runs/clinical_asymmetry1/epoch-001",
599
+ "zero_initialized_input_adapter": true,
600
+ "backbone_unchanged": true
601
+ },
602
+ "independent_adapter_merge": {
603
+ "alpha_source": "/workspace/research/runs/alpha_calibrated1/epoch-003",
604
+ "clinical_source": "/workspace/research/runs/clinical_envelope1/epoch-002",
605
+ "all_shared_and_head_tensors_equal": true
606
+ },
607
+ "frequency_montage_refinement": {
608
+ "six_frequency_bands": true,
609
+ "shared_encoder_unchanged": true,
610
+ "selected_track_epochs": {
611
+ "faced": 0,
612
+ "tuev": 1,
613
+ "ad65": 0,
614
+ "openbmi": 10,
615
+ "longitudinal": 2
616
+ }
617
+ },
618
+ "private_track_selection": {
619
+ "track": "tuev",
620
+ "donor": "/workspace/research/replicates/frequency_head_control1/epoch-001"
621
+ },
622
+ "clinical_sampling_refinement": {
623
+ "subject_exponent": 0.0,
624
+ "class_balanced": true,
625
+ "only_clinical_head_updated": true
626
+ },
627
+ "temporal_statistics_readout": {
628
+ "statistics": [
629
+ "mean",
630
+ "standard deviation",
631
+ "maximum",
632
+ "minimum"
633
+ ],
634
+ "shared_encoder_and_prior_heads_unchanged": true,
635
+ "selected_pool_epochs": {
636
+ "faced": 2,
637
+ "tuev": 0,
638
+ "ad65": 0,
639
+ "openbmi": 33,
640
+ "longitudinal": 3
641
+ }
642
+ },
643
+ "temporal_evidence_readout": {
644
+ "pooling": "log mean exp of per-patch class evidence",
645
+ "temperature": 0.25,
646
+ "shared_encoder_and_prior_heads_unchanged": true,
647
+ "selected_evidence_epochs": {
648
+ "faced": 0,
649
+ "tuev": 0,
650
+ "ad65": 0,
651
+ "openbmi": 6,
652
+ "longitudinal": 8
653
+ }
654
+ },
655
+ "fourier_basis_readout": {
656
+ "basis_functions": 256,
657
+ "bandwidths": [
658
+ 0.5,
659
+ 1.0,
660
+ 2.0
661
+ ],
662
+ "shared_encoder_and_prior_heads_unchanged": true,
663
+ "selected_fourier_epochs": {
664
+ "faced": 21,
665
+ "tuev": 0,
666
+ "ad65": 0,
667
+ "openbmi": 0,
668
+ "longitudinal": 2
669
+ }
670
+ },
671
+ "shared_tangent_readout": {
672
+ "one_shared_tangent_module": true,
673
+ "original_and_corrected_shared_features_retained": true,
674
+ "private_head_scalar_gains": {
675
+ "faced": 0.0,
676
+ "tuev": 0.1,
677
+ "ad65": 0.0,
678
+ "openbmi": 1.0,
679
+ "longitudinal": 0.1
680
+ },
681
+ "all_common_weights_fixed_during_gain_refinement": true
682
+ },
683
+ "joint_codebrain_feature_fusion": {
684
+ "native_common_CodeBrain_branch": true,
685
+ "source": "/workspace/research/runs/codebrain_temporal1/epoch-027",
686
+ "common_token_and_covariance_fusion_trained_on_all_five_tracks": true,
687
+ "private_channel_projection_dimensions": 24,
688
+ "private_feature_gains": {
689
+ "faced": 0.3,
690
+ "tuev": 0.3,
691
+ "ad65": 0.0,
692
+ "openbmi": 1.0,
693
+ "longitudinal": 0.0
694
+ },
695
+ "zero_CodeBrain_feature_control": true
696
+ }
697
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/covariances.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared neural filter-bank covariance decoder with spatial input adapters."""
2
+ import torch
3
+ from torch import nn
4
+ SPECS={'faced':(32,10,9),'tuev':(16,5,6),'ad65':(19,10,3),'openbmi':(62,4,2),'longitudinal':(58,2,2)}
5
+ TRACKS=tuple(SPECS)
6
+ BANDS=[(1,4),(4,8),(8,12),(12,16),(16,20),(20,24),(24,28),(28,32),(32,40),(40,48)]
7
+
8
+ @torch.no_grad()
9
+ def extract_covariances(t,x):
10
+ x=torch.nan_to_num(x.float().flatten(2)).clamp(-1e5,1e5)
11
+ x=x-x.mean(-1,keepdim=True)
12
+ if t in ('faced','tuev'):
13
+ x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
14
+ else:x=x-x.mean(1,keepdim=True)
15
+ # Per-window normalization, preserving spatial and frequency power ratios.
16
+ x=x/x.square().mean((1,2),keepdim=True).clamp_min(1e-12).sqrt()
17
+ frames=x.unfold(-1,400,200);frames=frames-frames.mean(-1,keepdim=True)
18
+ z=torch.fft.rfft(frames*torch.hann_window(400,device=x.device),dim=-1)/200
19
+ covs=[]
20
+ for lo,hi in BANDS:
21
+ v=z[...,2*lo:2*hi].flatten(2)
22
+ cov=(v.real@v.real.transpose(-1,-2)+v.imag@v.imag.transpose(-1,-2))/v.shape[-1]
23
+ covs.append(cov)
24
+ return torch.stack(covs,1)
25
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/envelope_features.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Per-window burst-envelope regularity and bilateral synchrony, without fitting."""
2
+ import torch
3
+ import torch.nn.functional as F
4
+
5
+ BANDS=((1,4),(4,8),(8,13),(13,30),(30,45))
6
+ ENVELOPE_DIM=16*5*12+8*5*2
7
+
8
+ @torch.no_grad()
9
+ def extract_envelope_features(signal):
10
+ with torch.autocast(signal.device.type,enabled=False):
11
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
12
+ spectrum=torch.fft.fft(x,dim=-1)
13
+ frequency=torch.fft.fftfreq(x.shape[-1],1/200,device=x.device)
14
+ envelopes=[]
15
+ for lo,hi in BANDS:
16
+ mask=((frequency>=lo)&(frequency<hi)).to(x.dtype)*2
17
+ analytic=torch.fft.ifft(spectrum*mask,dim=-1)
18
+ energy=analytic.abs().square()
19
+ envelope=F.avg_pool1d(energy.flatten(0,1).unsqueeze(1),20,10).squeeze(1)
20
+ envelopes.append(envelope.reshape(len(x),16,-1))
21
+ e=torch.stack(envelopes,2)
22
+ mean=e.mean(-1,keepdim=True).clamp_min(1e-12)
23
+ relative=e/mean
24
+ centered=relative-relative.mean(-1,keepdim=True)
25
+ std=centered.square().mean(-1,keepdim=True).sqrt().clamp_min(1e-6)
26
+ normalized=centered/std
27
+ acf=torch.stack([(normalized[...,:-lag]*normalized[...,lag:]).mean(-1)
28
+ for lag in range(4,41)],-1).clamp(-1,1)
29
+ acf_peak,acf_index=acf.max(-1)
30
+ probability=(relative/relative.sum(-1,keepdim=True).clamp_min(1e-12)).clamp_min(1e-12)
31
+ entropy=-(probability*probability.log()).sum(-1)
32
+ summaries=[std.squeeze(-1).clamp_min(1e-6).log(),relative.amax(-1).clamp_min(1).log(),entropy,
33
+ (relative>2).float().mean(-1),(relative>4).float().mean(-1),
34
+ ((relative[...,1:]>2)&(relative[...,:-1]<=2)).float().mean(-1),
35
+ acf_peak,(acf_index.float()+4)/40,
36
+ acf[...,0],acf[...,6],acf[...,16],acf[...,36]]
37
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=x.device);right=left+4
38
+ synchrony=(normalized[:,left]*normalized[:,right]).mean(-1).clamp(-1,1)
39
+ imbalance=(std[:,left].squeeze(-1).log()-std[:,right].squeeze(-1).log()).abs()
40
+ return torch.cat([torch.stack(summaries,-1).flatten(1),synchrony.flatten(1),imbalance.flatten(1)],1)
41
+
42
+ def mirrored_features(features):
43
+ channels=torch.tensor([4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11],device=features.device)
44
+ return torch.cat([features[:,:16*5*12].reshape(-1,16,5,12)[:,channels].flatten(1),features[:,16*5*12:]],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/frequency_features.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed per-window frequency decomposition for a linear montage adapter."""
2
+ import torch
3
+
4
+ FREQUENCY_BANDS=((1,4),(4,8),(8,13),(13,20),(20,30),(30,45))
5
+
6
+ def frequency_components(signal):
7
+ with torch.autocast(signal.device.type,enabled=False):
8
+ x=signal.float();spectrum=torch.fft.rfft(x,dim=-1)
9
+ frequency=torch.fft.rfftfreq(x.shape[-1],d=1/200,device=x.device)
10
+ masks=torch.stack([((frequency>=lo)&(frequency<hi)).float() for lo,hi in FREQUENCY_BANDS])
11
+ return torch.fft.irfft(spectrum[:,None]*masks[None,:,None],n=x.shape[-1],dim=-1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/infer.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse,json
2
+ from pathlib import Path
3
+ import torch
4
+ from model import HybridModel,SPECS
5
+ from data import Dataset
6
+ from covariances import extract_covariances
7
+ p=argparse.ArgumentParser();p.add_argument('input',type=Path);p.add_argument('output',type=Path);a=p.parse_args()
8
+ root=Path(__file__).resolve().parent;c=json.loads((root/'config.json').read_text());t=json.loads((a.input/'manifest.json').read_text())['track']
9
+ if t not in SPECS:raise ValueError('unknown track')
10
+ torch.set_num_threads(4);device='cuda' if torch.cuda.is_available() else 'cpu'
11
+ m=HybridModel(**c['architecture']).to(device);m.load_state_dict(torch.load(root/'weights.pt',map_location=device,weights_only=True));m.eval()
12
+ a.output.mkdir(parents=True,exist_ok=True)
13
+ with torch.inference_mode(),(a.output/'predictions.jsonl').open('w') as f:
14
+ for x,_,ids in torch.utils.data.DataLoader(Dataset(a.input),batch_size=64,num_workers=0):
15
+ # FFT features stay float32; convolutions can use bfloat16 on CUDA.
16
+ x=x.to(device)
17
+ from features import extract_features
18
+ torch.backends.cuda.matmul.allow_tf32=False
19
+ features=extract_features(t,x)
20
+ covariances=extract_covariances(t,x)
21
+ torch.backends.cuda.matmul.allow_tf32=True
22
+ with torch.autocast(device,dtype=torch.bfloat16,enabled=device=='cuda'):pred=m(t,x,features,covariances=covariances)
23
+ pp=pred.float().softmax(-1).cpu().numpy()
24
+ for sid,pr in zip(ids,pp):f.write(json.dumps({'id':sid,'probabilities':pr.tolist()})+'\n')
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/infer.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ exec python "$(dirname -- "$0")/infer.py" "$1" "$2"
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/model.py ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One fused waveform/spectral backbone used identically by all five tasks."""
2
+ import torch
3
+ from torch import nn
4
+ from braindecode.models import BIOT,CodeBrain
5
+ from features import SPECS,TRACKS,feature_dim,extract_features,Standardize,Residual,EDGES,COV_BANDS
6
+ from covariances import BANDS,extract_covariances
7
+ from alpha_features import extract_alpha_features,ALPHA_DIM
8
+ from envelope_features import extract_envelope_features,ENVELOPE_DIM
9
+ from frequency_features import frequency_components,FREQUENCY_BANDS
10
+ from tangent_features import extract_tangent_features,TANGENT_DIM
11
+
12
+ def clinical_asymmetry_features(features):
13
+ """Bipolar homologous-channel amplitude and coherence, invariant to mirroring."""
14
+ bands=len(EDGES)-1;per_channel=4*bands+4
15
+ block=features[:,:16*per_channel].reshape(-1,16,per_channel)
16
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=features.device);right=left+4
17
+ pair_power=(block[:,left,:bands]-block[:,right,:bands]).abs().flatten(1)
18
+ pair_rms=(block[:,left,4*bands]-block[:,right,4*bands]).abs()
19
+ hemisphere=(block[:,left,:bands].mean(1)-block[:,right,:bands].mean(1)).abs()
20
+ index=left*(32-left-1)//2+(right-left-1)
21
+ correlations=features[:,16*per_channel:].reshape(-1,len(COV_BANDS),120)[:,:,index].flatten(1)
22
+ return torch.cat([pair_power,pair_rms,hemisphere,correlations],1)
23
+
24
+ class InputAdapter(nn.Module):
25
+ def __init__(self,c,width,channels,spectral_enabled=True,asymmetry=False,alpha_regions=None,envelope=False):
26
+ super().__init__()
27
+ self.codebrain_gain=nn.Parameter(torch.ones(1,c,1))
28
+ self.codebrain_bias=nn.Parameter(torch.zeros(1,c,1))
29
+ self.codebrain_channels=nn.Linear(c,24,bias=False)
30
+ self.signal=nn.Conv1d(c,channels,1,bias=False)
31
+ self.frequency_weight=nn.Parameter(torch.zeros(len(FREQUENCY_BANDS),channels,c))
32
+ self.neural=nn.Conv1d(c,18,1,bias=False)
33
+ self.normalizer=Standardize(feature_dim(c))
34
+ self.spectral=nn.Linear(feature_dim(c),width)
35
+ self.dropout=nn.Dropout(.1)
36
+ self.register_buffer("spectral_enabled",torch.tensor(float(spectral_enabled)))
37
+ self.spatial_weight=nn.Parameter(torch.randn(len(BANDS),24,c)/c**.5)
38
+ self.asymmetry_projection=nn.Linear(316,width,bias=False) if asymmetry else None
39
+ if asymmetry:
40
+ nn.init.zeros_(self.asymmetry_projection.weight)
41
+ self.asymmetry_normalizer=Standardize(316)
42
+ self.asymmetry_dropout=nn.Dropout(.1)
43
+ self.alpha_projection=None
44
+ if alpha_regions is not None:
45
+ self.register_buffer('alpha_regions',torch.tensor(alpha_regions,dtype=torch.float32))
46
+ self.alpha_normalizer=Standardize(ALPHA_DIM)
47
+ self.alpha_projection=nn.Linear(ALPHA_DIM,width,bias=False)
48
+ nn.init.zeros_(self.alpha_projection.weight)
49
+ self.alpha_dropout=nn.Dropout(.3)
50
+ self.envelope_projection=None
51
+ if envelope:
52
+ self.envelope_normalizer=Standardize(ENVELOPE_DIM)
53
+ self.envelope_projection=nn.Linear(ENVELOPE_DIM,width,bias=False)
54
+ nn.init.zeros_(self.envelope_projection.weight)
55
+ self.envelope_dropout=nn.Dropout(.3)
56
+ def codebrain_signal(self,x):
57
+ return x*self.codebrain_gain+self.codebrain_bias
58
+ def codebrain_tokens(self,tokens):
59
+ return self.codebrain_channels(tokens.permute(0,2,3,1)).transpose(-1,-2).flatten(-2)
60
+ def spectral_features(self,features,signal=None,alpha_features=None,envelope_features=None):
61
+ value=self.spectral_enabled*self.spectral(self.dropout(self.normalizer(features)))
62
+ if self.asymmetry_projection is not None:
63
+ extra=self.asymmetry_dropout(self.asymmetry_normalizer(clinical_asymmetry_features(features)))
64
+ value=value+self.asymmetry_projection(extra)
65
+ if self.alpha_projection is not None:
66
+ if alpha_features is None:alpha_features=extract_alpha_features(signal,self.alpha_regions)
67
+ value=value+self.alpha_projection(self.alpha_dropout(self.alpha_normalizer(alpha_features)))
68
+ if self.envelope_projection is not None:
69
+ if envelope_features is None:envelope_features=extract_envelope_features(signal)
70
+ value=value+self.envelope_projection(self.envelope_dropout(self.envelope_normalizer(envelope_features)))
71
+ return value
72
+ def spatial_features(self,covariances):
73
+ with torch.autocast(covariances.device.type,enabled=False):
74
+ w=self.spatial_weight.float()/self.spatial_weight.float().norm(dim=-1,keepdim=True).clamp_min(1e-6)
75
+ power=torch.einsum('bfc,nbcd,bfd->nbf',w,covariances.float(),w).clamp_min(1e-8).log()
76
+ return torch.cat([power,power-power.mean(1,keepdim=True)],1).flatten(1)
77
+ def wave_signal(self,x,components=None):
78
+ if components is None:components=frequency_components(x)
79
+ correction=torch.einsum('blc,nbct->nlt',self.frequency_weight,components.to(self.frequency_weight.dtype))
80
+ return (self.signal(x)+correction.to(x.dtype)).unsqueeze(1)
81
+ def forward(self,x,features,covariance_features):
82
+ return self.wave_signal(x),self.spectral_features(features,signal=x),self.neural(x),covariance_features
83
+
84
+ class SharedBackbone(nn.Module):
85
+ def __init__(self,channels,width,depth,dropout,wave_filters):
86
+ super().__init__()
87
+ self.waveform=nn.Sequential(
88
+ nn.Conv2d(1,wave_filters,(1,64),padding=(0,32),bias=False),nn.GroupNorm(1,wave_filters),
89
+ nn.Conv2d(wave_filters,2*wave_filters,(channels,1),groups=wave_filters,bias=False),nn.GroupNorm(1,2*wave_filters),nn.ELU(),
90
+ nn.AvgPool2d((1,4)),nn.Dropout(.35),
91
+ nn.Conv2d(2*wave_filters,2*wave_filters,(1,16),padding=(0,8),groups=2*wave_filters,bias=False),nn.Conv2d(2*wave_filters,2*wave_filters,1,bias=False),
92
+ nn.GroupNorm(1,2*wave_filters),nn.ELU(),nn.AvgPool2d((1,8)),nn.Dropout(.35))
93
+ self.wave_summary=nn.Sequential(nn.AdaptiveAvgPool2d((1,8)),nn.Flatten(),nn.Linear(2*wave_filters*8,width))
94
+ self.fusion=nn.Sequential(nn.LayerNorm(width),nn.GELU(),nn.Dropout(dropout),
95
+ *[Residual(width,dropout) for _ in range(depth)],nn.LayerNorm(width))
96
+ # Both representations interact before the shared residual stack.
97
+ self.wave_gain=nn.Parameter(torch.tensor(.1))
98
+ self.biot=BIOT(n_chans=18,n_outputs=2,n_times=400,sfreq=200)
99
+ self.biot.final_layer=nn.Identity()
100
+ self.biot_projection=nn.Sequential(nn.LayerNorm(256),nn.Linear(256,width),nn.Dropout(.2))
101
+ nn.init.normal_(self.biot_projection[1].weight,std=.001);nn.init.zeros_(self.biot_projection[1].bias)
102
+ self.covariance_encoder=nn.Sequential(nn.LayerNorm(len(BANDS)*24*2),nn.Linear(len(BANDS)*24*2,width),nn.GELU(),nn.Dropout(.4),
103
+ *[Residual(width,.4) for _ in range(2)],nn.LayerNorm(width))
104
+ self.covariance_projection=nn.Linear(width,width)
105
+ nn.init.zeros_(self.covariance_projection.weight);nn.init.zeros_(self.covariance_projection.bias)
106
+ self.tangent_encoder=nn.Sequential(nn.LayerNorm(TANGENT_DIM),nn.Linear(TANGENT_DIM,width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width),nn.Linear(width,width))
107
+ self.register_buffer('codebrain_enabled',torch.ones(()))
108
+ self.codebrain=CodeBrain(n_chans=19,n_outputs=2,n_times=400,sfreq=200)
109
+ self.codebrain.final_layer=nn.Identity()
110
+ self.codebrain_projection=nn.Sequential(nn.LayerNorm(200),nn.Linear(200,64),nn.GELU())
111
+ self.codebrain_patch_encoder=nn.Sequential(nn.LayerNorm(24*64),nn.Linear(24*64,width),nn.GELU(),nn.Dropout(.3))
112
+ self.codebrain_context=nn.Sequential(nn.LayerNorm(width*4),nn.Linear(width*4,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width))
113
+ nn.init.zeros_(self.codebrain_context[-1].weight);nn.init.zeros_(self.codebrain_context[-1].bias)
114
+ def codebrain_tokens(self,signal):
115
+ return torch.cat([self.codebrain_projection(self.codebrain(x)) for x in signal.split(32)],0)
116
+ def codebrain_correction(self,tokens,representation,fusion_input):
117
+ with torch.autocast(tokens.device.type,enabled=False):
118
+ encoded=self.codebrain_patch_encoder(self.codebrain_enabled*tokens.float())
119
+ pooled=torch.cat([encoded.mean(1),encoded.std(1,correction=0),representation[:,-512:-384].float(),representation[:,-128:].float()],-1)
120
+ delta=self.codebrain_context(pooled)
121
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
122
+ corrected=self.fusion(fusion_input+added.to(fusion_input.dtype))
123
+ return corrected-representation[:,-512:-384],delta
124
+ def forward(self,signal,spectral,neural_signal,covariance_features,tangent_features):
125
+ wave=self.waveform(signal)
126
+ neural=self.biot(neural_signal.float())
127
+ neural=self.biot_projection[0](neural)
128
+ projected=self.biot_projection[2](self.biot_projection[1](neural))
129
+ with torch.autocast(signal.device.type,enabled=False):
130
+ covariance_embedding=self.covariance_encoder(covariance_features.float())
131
+ original=spectral+self.wave_gain*self.wave_summary(wave)+.01*projected
132
+ coupled=.001*self.covariance_projection(covariance_embedding).to(original.dtype)
133
+ fused=self.fusion(original+coupled)
134
+ with torch.autocast(signal.device.type,enabled=False):delta=self.tangent_encoder(tangent_features.float())
135
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
136
+ corrected=self.fusion((original+coupled)+added.to(original.dtype))
137
+ return torch.cat([wave.flatten(1),fused,neural,covariance_embedding],-1),corrected-fused,delta,original+coupled
138
+
139
+ class ResidualHead(nn.Module):
140
+ """A small nonlinear classifier correction around an inherited linear readout."""
141
+ def __init__(self,features,classes,width=64,dropout=.3,full_precision=False):
142
+ super().__init__();self.full_precision=full_precision
143
+ self.base=nn.Linear(features,classes)
144
+ self.delta=nn.Sequential(nn.LayerNorm(features),nn.Linear(features,width),nn.GELU(),nn.Dropout(dropout),nn.Linear(width,classes))
145
+ nn.init.zeros_(self.delta[-1].weight);nn.init.zeros_(self.delta[-1].bias)
146
+ def forward(self,x):
147
+ if self.full_precision:
148
+ with torch.autocast(x.device.type,enabled=False):return self.base(x.float())+self.delta(x.float())
149
+ prior=nn.functional.linear(x[:,:-128].contiguous(),self.base.weight[:,:-128].contiguous(),self.base.bias)
150
+ added=nn.functional.linear(x[:,-128:].contiguous(),self.base.weight[:,-128:].contiguous())
151
+ value=prior+added
152
+ return value+self.delta(x).to(value.dtype)
153
+
154
+ class TemporalPoolHead(nn.Module):
155
+ def __init__(self,prior,channels=64):
156
+ super().__init__();self.prior=prior;self.channels=channels
157
+ self.register_buffer('pool_output_scale',torch.ones(()));self.register_buffer('pool_mean',torch.zeros(channels*4));self.register_buffer('pool_scale',torch.ones(channels*4))
158
+ self.pool_projection=nn.Linear(channels*4,prior.base.out_features)
159
+ nn.init.zeros_(self.pool_projection.weight);nn.init.zeros_(self.pool_projection.bias)
160
+ def statistics(self,x):
161
+ with torch.autocast(x.device.type,enabled=False):
162
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1)
163
+ return torch.cat([wave.mean(-1),wave.std(-1,correction=0),wave.amax(-1),wave.amin(-1)],-1)
164
+ def forward(self,x):
165
+ prior=self.prior(x)
166
+ with torch.autocast(x.device.type,enabled=False):
167
+ values=((self.statistics(x)-self.pool_mean)/self.pool_scale).clamp(-8,8)
168
+ added=self.pool_output_scale*self.pool_projection(values)
169
+ return prior+added.to(prior.dtype)
170
+
171
+ class TemporalEvidenceHead(nn.Module):
172
+ """Pool class evidence over the shared waveform time axis."""
173
+ def __init__(self,prior,channels=64,temperature=.25):
174
+ super().__init__();self.prior=prior;self.channels=channels;self.temperature=temperature
175
+ self.register_buffer('evidence_output_scale',torch.ones(()))
176
+ self.register_buffer('evidence_mean',torch.zeros(channels))
177
+ self.register_buffer('evidence_scale',torch.ones(channels))
178
+ self.evidence_projection=nn.Linear(channels,prior.prior.base.out_features,bias=False)
179
+ nn.init.zeros_(self.evidence_projection.weight)
180
+ def patches(self,x):
181
+ with torch.autocast(x.device.type,enabled=False):
182
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1).transpose(1,2)
183
+ return ((wave-self.evidence_mean)/self.evidence_scale).clamp(-8,8)
184
+ def evidence(self,patches):
185
+ with torch.autocast(patches.device.type,enabled=False):
186
+ values=self.evidence_projection(patches.float())/self.temperature
187
+ maximum=values.amax(1,keepdim=True)
188
+ pooled=self.temperature*((values-maximum).exp().mean(1).log()+maximum.squeeze(1))
189
+ return self.evidence_output_scale*pooled
190
+ def forward(self,x):
191
+ prior=self.prior(x)
192
+ return prior+self.evidence(self.patches(x)).to(prior.dtype)
193
+
194
+ class FourierResidualHead(nn.Module):
195
+ """A fixed random Fourier basis and trainable linear classifier correction."""
196
+ def __init__(self,prior,features,classes,basis=256):
197
+ super().__init__();self.prior=prior
198
+ self.register_buffer('rff_mean',torch.zeros(features));self.register_buffer('rff_scale',torch.ones(features))
199
+ self.register_buffer('rff_frequency',torch.randn(features,basis)/features**.5)
200
+ self.register_buffer('rff_phase',torch.rand(basis)*2*torch.pi)
201
+ self.register_buffer('rff_output_scale',torch.ones(()))
202
+ self.rff_projection=nn.Linear(3*basis,classes);nn.init.zeros_(self.rff_projection.weight);nn.init.zeros_(self.rff_projection.bias)
203
+ def basis(self,x):
204
+ with torch.autocast(x.device.type,enabled=False):
205
+ values=((x.float()-self.rff_mean)/self.rff_scale).clamp(-8,8)@self.rff_frequency
206
+ return 2**.5*torch.cat([(values/sigma+self.rff_phase).cos() for sigma in (.5,1.,2.)],-1)
207
+ def forward(self,x):
208
+ prior=self.prior(x)
209
+ with torch.autocast(x.device.type,enabled=False):added=self.rff_output_scale*self.rff_projection(self.basis(x))
210
+ return prior+added.to(prior.dtype)
211
+
212
+ class TangentFeatureHead(nn.Module):
213
+ """Select a shared feature correction before the inherited classifier."""
214
+ def __init__(self,prior):
215
+ super().__init__();self.prior=prior;self.feature_gain=nn.Parameter(torch.zeros(()))
216
+ def forward(self,values):
217
+ old=values[:,:-256];fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
218
+ adjusted=torch.cat([old[:,:-512],old[:,-512:-384]+self.feature_gain*fusion_delta,old[:,-384:-128],old[:,-128:]+self.feature_gain*covariance_delta],-1)
219
+ return self.prior(adjusted)
220
+
221
+ class CodeBrainFeatureHead(nn.Module):
222
+ """Private use of a jointly trained common feature correction."""
223
+ def __init__(self,prior):
224
+ super().__init__();self.prior=prior;self.codebrain_gain=nn.Parameter(torch.ones(()))
225
+ def forward(self,values):
226
+ previous=values[:,:-256];native=previous[:,:-256]
227
+ fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
228
+ adjusted=torch.cat([native[:,:-512],native[:,-512:-384]+self.codebrain_gain*fusion_delta,native[:,-384:-128],native[:,-128:]+self.codebrain_gain*covariance_delta],-1)
229
+ return self.prior(torch.cat([adjusted,previous[:,-256:]],-1))
230
+
231
+ class HybridModel(nn.Module):
232
+ def __init__(self,channels=32,width=128,depth=2,dropout=.5,wave_filters=32,head_width=64,head_dropout=.3,clinical_asymmetry=True,alpha_regions=None,clinical_envelope=False,temporal_pool=True,temporal_evidence=False,evidence_temperature=.25,random_fourier=False,fourier_features=256,tangent_readout=True,codebrain_fusion=True):
233
+ super().__init__()
234
+ self.adapters=nn.ModuleDict({t:InputAdapter(c,width,channels,spectral_enabled=t not in ("faced","tuev","openbmi"),asymmetry=clinical_asymmetry and t=="tuev",alpha_regions=alpha_regions if t=="longitudinal" else None,envelope=clinical_envelope and t=="tuev") for t,(c,s,k) in SPECS.items()})
235
+ self.backbone=SharedBackbone(channels,width,depth,dropout,wave_filters)
236
+ self.heads=nn.ModuleDict({t:ResidualHead(2*wave_filters*(((s*200+1)//4+1)//8)+width+256+width,k,head_width,head_dropout,full_precision=t=='ad65') for t,(c,s,k) in SPECS.items()})
237
+ if temporal_pool:self.heads=nn.ModuleDict({t:TemporalPoolHead(head,wave_filters*2) for t,head in self.heads.items()})
238
+ if temporal_evidence:self.heads=nn.ModuleDict({t:TemporalEvidenceHead(head,wave_filters*2,evidence_temperature) for t,head in self.heads.items()})
239
+ if random_fourier:self.heads=nn.ModuleDict({t:FourierResidualHead(head,2*wave_filters*(((SPECS[t][1]*200+1)//4+1)//8)+width+256+width,SPECS[t][2],fourier_features) for t,head in self.heads.items()})
240
+ self.heads=nn.ModuleDict({t:TangentFeatureHead(head) for t,head in self.heads.items()})
241
+ self.heads=nn.ModuleDict({t:CodeBrainFeatureHead(head) for t,head in self.heads.items()})
242
+ def forward(self,t,x,features=None,covariances=None,covariance_features=None):
243
+ if features is None:features=extract_features(t,x)
244
+ if covariance_features is None:
245
+ if covariances is None:covariances=extract_covariances(t,x)
246
+ covariance_features=self.adapters[t].spatial_features(covariances)
247
+ signal=x.flatten(2);signal=signal-signal.mean(-1,keepdim=True)
248
+ if t in ('faced','tuev'):signal=signal/signal.std(-1,keepdim=True,correction=0).clamp_min(1e-6)
249
+ else:signal=signal-signal.mean(1,keepdim=True)
250
+ signal=signal.clamp(-20,20)
251
+ adapted=self.adapters[t](signal,features,covariance_features)
252
+ if covariances is None:covariances=extract_covariances(t,x)
253
+ tangent=extract_tangent_features(covariances,self.adapters[t].spatial_weight)
254
+ representation,fusion_delta,covariance_delta,fusion_input=self.backbone(*adapted,tangent_features=tangent)
255
+ if t in ('faced','openbmi'):
256
+ representation=torch.cat([representation[:,:-384],torch.zeros_like(representation[:,-384:-128]),representation[:,-128:]],-1)
257
+ native_tokens=self.backbone.codebrain_tokens(self.adapters[t].codebrain_signal(signal))
258
+ tokens=self.adapters[t].codebrain_tokens(native_tokens)
259
+ code_fusion,code_covariance=self.backbone.codebrain_correction(tokens,representation,fusion_input)
260
+ return self.heads[t](torch.cat([representation,fusion_delta,covariance_delta,code_fusion,code_covariance],-1))
261
+
262
+ def widen_state_dict(state,multiplier=2):
263
+ """Duplicate temporal features and divide downstream sums to preserve outputs."""
264
+ result={}
265
+ for key,value in state.items():
266
+ if key.startswith('backbone.waveform.'):
267
+ layer=int(key.split('.')[2])
268
+ if layer in (0,2,7):value=value.repeat(multiplier,1,1,1)
269
+ elif layer in (1,3,9):value=value.repeat(multiplier)
270
+ elif layer==8:value=value.repeat(multiplier,multiplier,1,1)/multiplier
271
+ elif key=='backbone.wave_summary.2.weight':value=value.repeat(1,multiplier)/multiplier
272
+ elif key.startswith('heads.') and key.endswith('.weight'):
273
+ raw=value[:,:-128]/multiplier
274
+ value=torch.cat([raw]*multiplier+[value[:,-128:]],1)
275
+ result[key]=value
276
+ return result
277
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S039/tangent_features.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Window-local log-correlation geometry in the existing spatial-filter basis."""
2
+ import torch
3
+
4
+ TANGENT_DIM=10*24*25//2
5
+
6
+ @torch.no_grad()
7
+ def extract_tangent_features(covariances,spatial_weight):
8
+ old_tf32=torch.backends.cuda.matmul.allow_tf32
9
+ torch.backends.cuda.matmul.allow_tf32=False
10
+ try:
11
+ with torch.autocast(covariances.device.type,enabled=False):
12
+ w=spatial_weight.float()
13
+ w=w/w.norm(dim=-1,keepdim=True).clamp_min(1e-6)
14
+ projected=torch.einsum('bfc,nbcd,bgd->nbfg',w,covariances.float(),w)
15
+ d=projected.diagonal(dim1=-2,dim2=-1).clamp_min(1e-10).sqrt()
16
+ correlation=(projected/(d.unsqueeze(-1)*d.unsqueeze(-2))).clamp(-1,1)
17
+ correlation=(correlation+correlation.transpose(-1,-2))/2
18
+ correlation=.95*correlation+.05*torch.eye(24,device=correlation.device)
19
+ values,vectors=torch.linalg.eigh(correlation)
20
+ logarithm=(vectors*values.clamp_min(1e-6).log().unsqueeze(-2))@vectors.transpose(-1,-2)
21
+ i,j=torch.triu_indices(24,24,device=correlation.device)
22
+ scale=torch.where(i==j,1.,2.**.5)
23
+ return (logarithm[...,i,j]*scale).flatten(1)
24
+ finally:
25
+ torch.backends.cuda.matmul.allow_tf32=old_tf32
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/MODEL_CARD.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Shared EEG decoder
2
+
3
+ This package contains one coupled backbone used by all five tracks, with private input adapters and classifiers. Every trainable common component was trained with all five training splits. It is a single model; inference performs no parameter updates or dataset-level fitting.
4
+
5
+ The common backbone combines waveform convolutions, an audited pretrained BIOT feature path, covariance and log-correlation encoders, and shared feature corrections. The waveform coactivation extension encodes 64 within-window log variances and 2,016 correlations between common waveform channels. A matched experimental control removes the correlation inputs. `config.json` identifies the packaged variant and its five fixed correction gains. All original backbone parameters are fixed during this extension's joint training.
6
+
7
+ Weights originate only from the supplied training data and audited initialization checkpoints. Training details, parent provenance, raw/cache checks, shared-gradient checks and the five separate validation metrics are recorded in `training.json`. Validation selects checkpoints and fixed gains; it does not fit normalization or update parameters. Reported validation results belong to selected checkpoints, not to private test evaluation or five-seed means.
8
+
9
+ Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. The input manifest specifies a track and opaque sample IDs, shard paths and indices. Signals are in microvolts and are scaled by 1/100. The package writes one probability vector per input ID to `OUTPUT_DIR/predictions.jsonl`. It needs only the packaged files and the contract's installed Python dependencies, works after relocation, and does not need labels, subject IDs, training caches or network access.
10
+
11
+ FACED and TUEV use window balanced accuracy. AD65 uses mean window probabilities per patient before balanced accuracy. OpenBMI averages within-subject balanced accuracy. Longitudinal averages within-session balanced accuracy within each subject, then over subjects. These five metrics remain separate.
12
+
13
+ This checkpoint adds fixed within-window ordinal pattern probabilities, permutation entropy and statistical complexity at five delays. Training-only normalization and five input projections feed one common correction MLP trained by all five tracks. The common correction enters the existing covariance and fusion representations; fixed per-track gains select its strength. All earlier model tensors remain unchanged.
14
+
15
+ Fixed real and imaginary spectral coherence between the inherited 24 spatial filters is normalized using training windows only and encoded by one new common network. Five private linear heads add class evidence. All five training splits update the new common encoder; all earlier model tensors remain unchanged.
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/alpha_features.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed alpha prominence features from each individual two-second window."""
2
+ import torch
3
+
4
+ REGION_NAMES=('occipital','parietal','central','frontal','left_posterior','right_posterior')
5
+ REGIONS=(('PO7','PO5','PO3','POZ','PO4','PO6','PO8','O1','OZ','O2'),
6
+ ('P7','P5','P3','P1','PZ','P2','P4','P6','P8'),
7
+ ('FC5','FC3','FC1','FCZ','FC2','FC4','FC6','C5','C3','C1','CZ','C2','C4','C6'),
8
+ ('FP1','FPZ','FP2','AF3','AF4','F7','F5','F3','F1','FZ','F2','F4','F6','F8'),
9
+ ('P7','P5','P3','P1','PO7','PO5','PO3','O1'),
10
+ ('P2','P4','P6','P8','PO4','PO6','PO8','O2'))
11
+ ALPHA_DIM=58*7+6*22
12
+
13
+ def region_matrix(channels):
14
+ result=torch.zeros(len(REGIONS),len(channels))
15
+ for i,names in enumerate(REGIONS):
16
+ for name in names:result[i,channels.index(name)]=1/len(names)
17
+ return result.tolist()
18
+
19
+ @torch.no_grad()
20
+ def extract_alpha_features(signal,regions):
21
+ with torch.autocast(signal.device.type,enabled=False):
22
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
23
+ spectrum=torch.fft.rfft(x*torch.hann_window(400,device=x.device),dim=-1)/200
24
+ power=spectrum.abs().square().clamp_min(1e-12)
25
+ lp=power.log()
26
+ # Geometric regional means resist domination by one high-amplitude channel.
27
+ regional=torch.einsum('rc,ncf->nrf',regions.float(),lp)
28
+ lp=torch.cat([lp,regional],1)
29
+ low=lp[...,8:13].mean(-1,keepdim=True)
30
+ high=lp[...,36:49].mean(-1,keepdim=True)
31
+ freq=torch.arange(7.,14.5,.5,device=x.device)
32
+ alpha=lp[...,14:29]
33
+ baseline=low+(high-low)*((freq-5)/16)
34
+ prominence=alpha-baseline
35
+ normalized=alpha.softmax(-1)
36
+ center=(normalized*freq).sum(-1)
37
+ entropy=-(normalized*normalized.clamp_min(1e-12).log()).sum(-1)
38
+ alpha_mean=torch.logsumexp(alpha,-1)-torch.log(torch.tensor(15.,device=x.device))
39
+ def log_band(lo,hi):
40
+ return torch.logsumexp(lp[...,lo:hi],-1)-torch.log(torch.tensor(float(hi-lo),device=x.device))
41
+ summaries=torch.stack([alpha_mean-log_band(2,81),alpha_mean-log_band(8,14),
42
+ alpha_mean-log_band(30,61),prominence.max(-1).values,
43
+ prominence.mean(-1),center,entropy],-1)
44
+ return torch.cat([summaries[:,:58].flatten(1),summaries[:,58:].flatten(1),
45
+ prominence[:,58:].flatten(1)],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/config.json ADDED
@@ -0,0 +1,742 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "bci-shared-biot-covariance-bf16head-v1",
3
+ "architecture": {
4
+ "channels": 32,
5
+ "width": 128,
6
+ "depth": 2,
7
+ "dropout": 0.5,
8
+ "wave_filters": 32,
9
+ "head_width": 64,
10
+ "head_dropout": 0.3,
11
+ "clinical_asymmetry": true,
12
+ "alpha_regions": [
13
+ [
14
+ 0.0,
15
+ 0.0,
16
+ 0.0,
17
+ 0.0,
18
+ 0.0,
19
+ 0.0,
20
+ 0.0,
21
+ 0.0,
22
+ 0.0,
23
+ 0.0,
24
+ 0.0,
25
+ 0.0,
26
+ 0.0,
27
+ 0.0,
28
+ 0.0,
29
+ 0.0,
30
+ 0.0,
31
+ 0.0,
32
+ 0.0,
33
+ 0.0,
34
+ 0.0,
35
+ 0.0,
36
+ 0.0,
37
+ 0.0,
38
+ 0.0,
39
+ 0.0,
40
+ 0.0,
41
+ 0.0,
42
+ 0.0,
43
+ 0.0,
44
+ 0.0,
45
+ 0.0,
46
+ 0.0,
47
+ 0.0,
48
+ 0.0,
49
+ 0.0,
50
+ 0.0,
51
+ 0.0,
52
+ 0.0,
53
+ 0.0,
54
+ 0.0,
55
+ 0.0,
56
+ 0.0,
57
+ 0.0,
58
+ 0.0,
59
+ 0.0,
60
+ 0.0,
61
+ 0.0,
62
+ 0.10000000149011612,
63
+ 0.10000000149011612,
64
+ 0.10000000149011612,
65
+ 0.10000000149011612,
66
+ 0.10000000149011612,
67
+ 0.10000000149011612,
68
+ 0.10000000149011612,
69
+ 0.10000000149011612,
70
+ 0.10000000149011612,
71
+ 0.10000000149011612
72
+ ],
73
+ [
74
+ 0.0,
75
+ 0.0,
76
+ 0.0,
77
+ 0.0,
78
+ 0.0,
79
+ 0.0,
80
+ 0.0,
81
+ 0.0,
82
+ 0.0,
83
+ 0.0,
84
+ 0.0,
85
+ 0.0,
86
+ 0.0,
87
+ 0.0,
88
+ 0.0,
89
+ 0.0,
90
+ 0.0,
91
+ 0.0,
92
+ 0.0,
93
+ 0.0,
94
+ 0.0,
95
+ 0.0,
96
+ 0.0,
97
+ 0.0,
98
+ 0.0,
99
+ 0.0,
100
+ 0.0,
101
+ 0.0,
102
+ 0.0,
103
+ 0.0,
104
+ 0.0,
105
+ 0.0,
106
+ 0.0,
107
+ 0.0,
108
+ 0.0,
109
+ 0.0,
110
+ 0.0,
111
+ 0.0,
112
+ 0.0,
113
+ 0.1111111119389534,
114
+ 0.1111111119389534,
115
+ 0.1111111119389534,
116
+ 0.1111111119389534,
117
+ 0.1111111119389534,
118
+ 0.1111111119389534,
119
+ 0.1111111119389534,
120
+ 0.1111111119389534,
121
+ 0.1111111119389534,
122
+ 0.0,
123
+ 0.0,
124
+ 0.0,
125
+ 0.0,
126
+ 0.0,
127
+ 0.0,
128
+ 0.0,
129
+ 0.0,
130
+ 0.0,
131
+ 0.0
132
+ ],
133
+ [
134
+ 0.0,
135
+ 0.0,
136
+ 0.0,
137
+ 0.0,
138
+ 0.0,
139
+ 0.0,
140
+ 0.0,
141
+ 0.0,
142
+ 0.0,
143
+ 0.0,
144
+ 0.0,
145
+ 0.0,
146
+ 0.0,
147
+ 0.0,
148
+ 0.0714285746216774,
149
+ 0.0714285746216774,
150
+ 0.0714285746216774,
151
+ 0.0714285746216774,
152
+ 0.0714285746216774,
153
+ 0.0714285746216774,
154
+ 0.0714285746216774,
155
+ 0.0,
156
+ 0.0714285746216774,
157
+ 0.0714285746216774,
158
+ 0.0714285746216774,
159
+ 0.0714285746216774,
160
+ 0.0714285746216774,
161
+ 0.0714285746216774,
162
+ 0.0714285746216774,
163
+ 0.0,
164
+ 0.0,
165
+ 0.0,
166
+ 0.0,
167
+ 0.0,
168
+ 0.0,
169
+ 0.0,
170
+ 0.0,
171
+ 0.0,
172
+ 0.0,
173
+ 0.0,
174
+ 0.0,
175
+ 0.0,
176
+ 0.0,
177
+ 0.0,
178
+ 0.0,
179
+ 0.0,
180
+ 0.0,
181
+ 0.0,
182
+ 0.0,
183
+ 0.0,
184
+ 0.0,
185
+ 0.0,
186
+ 0.0,
187
+ 0.0,
188
+ 0.0,
189
+ 0.0,
190
+ 0.0,
191
+ 0.0
192
+ ],
193
+ [
194
+ 0.0714285746216774,
195
+ 0.0714285746216774,
196
+ 0.0714285746216774,
197
+ 0.0714285746216774,
198
+ 0.0714285746216774,
199
+ 0.0714285746216774,
200
+ 0.0714285746216774,
201
+ 0.0714285746216774,
202
+ 0.0714285746216774,
203
+ 0.0714285746216774,
204
+ 0.0714285746216774,
205
+ 0.0714285746216774,
206
+ 0.0714285746216774,
207
+ 0.0714285746216774,
208
+ 0.0,
209
+ 0.0,
210
+ 0.0,
211
+ 0.0,
212
+ 0.0,
213
+ 0.0,
214
+ 0.0,
215
+ 0.0,
216
+ 0.0,
217
+ 0.0,
218
+ 0.0,
219
+ 0.0,
220
+ 0.0,
221
+ 0.0,
222
+ 0.0,
223
+ 0.0,
224
+ 0.0,
225
+ 0.0,
226
+ 0.0,
227
+ 0.0,
228
+ 0.0,
229
+ 0.0,
230
+ 0.0,
231
+ 0.0,
232
+ 0.0,
233
+ 0.0,
234
+ 0.0,
235
+ 0.0,
236
+ 0.0,
237
+ 0.0,
238
+ 0.0,
239
+ 0.0,
240
+ 0.0,
241
+ 0.0,
242
+ 0.0,
243
+ 0.0,
244
+ 0.0,
245
+ 0.0,
246
+ 0.0,
247
+ 0.0,
248
+ 0.0,
249
+ 0.0,
250
+ 0.0,
251
+ 0.0
252
+ ],
253
+ [
254
+ 0.0,
255
+ 0.0,
256
+ 0.0,
257
+ 0.0,
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 0.0,
262
+ 0.0,
263
+ 0.0,
264
+ 0.0,
265
+ 0.0,
266
+ 0.0,
267
+ 0.0,
268
+ 0.0,
269
+ 0.0,
270
+ 0.0,
271
+ 0.0,
272
+ 0.0,
273
+ 0.0,
274
+ 0.0,
275
+ 0.0,
276
+ 0.0,
277
+ 0.0,
278
+ 0.0,
279
+ 0.0,
280
+ 0.0,
281
+ 0.0,
282
+ 0.0,
283
+ 0.0,
284
+ 0.0,
285
+ 0.0,
286
+ 0.0,
287
+ 0.0,
288
+ 0.0,
289
+ 0.0,
290
+ 0.0,
291
+ 0.0,
292
+ 0.0,
293
+ 0.125,
294
+ 0.125,
295
+ 0.125,
296
+ 0.125,
297
+ 0.0,
298
+ 0.0,
299
+ 0.0,
300
+ 0.0,
301
+ 0.0,
302
+ 0.125,
303
+ 0.125,
304
+ 0.125,
305
+ 0.0,
306
+ 0.0,
307
+ 0.0,
308
+ 0.0,
309
+ 0.125,
310
+ 0.0,
311
+ 0.0
312
+ ],
313
+ [
314
+ 0.0,
315
+ 0.0,
316
+ 0.0,
317
+ 0.0,
318
+ 0.0,
319
+ 0.0,
320
+ 0.0,
321
+ 0.0,
322
+ 0.0,
323
+ 0.0,
324
+ 0.0,
325
+ 0.0,
326
+ 0.0,
327
+ 0.0,
328
+ 0.0,
329
+ 0.0,
330
+ 0.0,
331
+ 0.0,
332
+ 0.0,
333
+ 0.0,
334
+ 0.0,
335
+ 0.0,
336
+ 0.0,
337
+ 0.0,
338
+ 0.0,
339
+ 0.0,
340
+ 0.0,
341
+ 0.0,
342
+ 0.0,
343
+ 0.0,
344
+ 0.0,
345
+ 0.0,
346
+ 0.0,
347
+ 0.0,
348
+ 0.0,
349
+ 0.0,
350
+ 0.0,
351
+ 0.0,
352
+ 0.0,
353
+ 0.0,
354
+ 0.0,
355
+ 0.0,
356
+ 0.0,
357
+ 0.0,
358
+ 0.125,
359
+ 0.125,
360
+ 0.125,
361
+ 0.125,
362
+ 0.0,
363
+ 0.0,
364
+ 0.0,
365
+ 0.0,
366
+ 0.125,
367
+ 0.125,
368
+ 0.125,
369
+ 0.0,
370
+ 0.0,
371
+ 0.125
372
+ ]
373
+ ],
374
+ "clinical_envelope": true,
375
+ "temporal_pool": true,
376
+ "temporal_evidence": true,
377
+ "evidence_temperature": 0.25,
378
+ "random_fourier": true,
379
+ "fourier_features": 256,
380
+ "tangent_readout": true,
381
+ "shared_context_correction": true,
382
+ "wave_coactivation": true,
383
+ "ordinal_context": true,
384
+ "phase_coherence": true
385
+ },
386
+ "initialization": {
387
+ "initialization": "continue joint training from a complete shared-model checkpoint",
388
+ "parent": "/workspace/research/runs/hybrid_biot_fusionshrink0100/epoch-001/weights.pt",
389
+ "parent_initialization": {
390
+ "initialization": "jointly trained parent plus audited pretrained BIOT in a single coupled backbone",
391
+ "parent": "/workspace/research/runs/hybrid_wide1/epoch-004/weights.pt",
392
+ "audited_biot": {
393
+ "initialization": "pretrained",
394
+ "repo": "braindecode/biot-pretrained-six-datasets-18chs",
395
+ "revision": "7e9aabf302870012f73773276803aab97993951c",
396
+ "sha256": "a218f4054ae29962c6fd9d23d94c446d354c4f53e805a6771c85749ccc20baaa",
397
+ "license": "BSD-3-Clause",
398
+ "source_braindecode": "1.3.0",
399
+ "loaded_core_tensors": 56,
400
+ "skipped_classifier_tensors": 3
401
+ },
402
+ "neural_channel_indices": {
403
+ "faced": [
404
+ 0,
405
+ 1,
406
+ 2,
407
+ 3,
408
+ 4,
409
+ 5,
410
+ 6,
411
+ 7,
412
+ 8,
413
+ 9,
414
+ 10,
415
+ 11,
416
+ 12,
417
+ 13,
418
+ 14,
419
+ 15,
420
+ 16,
421
+ 17
422
+ ],
423
+ "tuev": [
424
+ 0,
425
+ 1,
426
+ 2,
427
+ 3,
428
+ 4,
429
+ 5,
430
+ 6,
431
+ 7,
432
+ 8,
433
+ 9,
434
+ 10,
435
+ 11,
436
+ 12,
437
+ 13,
438
+ 14,
439
+ 15
440
+ ],
441
+ "ad65": [
442
+ 0,
443
+ 1,
444
+ 2,
445
+ 3,
446
+ 4,
447
+ 5,
448
+ 6,
449
+ 7,
450
+ 8,
451
+ 9,
452
+ 10,
453
+ 11,
454
+ 12,
455
+ 13,
456
+ 14,
457
+ 15,
458
+ 16,
459
+ 17
460
+ ],
461
+ "openbmi": [
462
+ 0,
463
+ 1,
464
+ 3,
465
+ 5,
466
+ 12,
467
+ 14,
468
+ 23,
469
+ 25,
470
+ 28,
471
+ 30,
472
+ 2,
473
+ 6,
474
+ 11,
475
+ 15,
476
+ 22,
477
+ 26,
478
+ 4,
479
+ 13
480
+ ],
481
+ "longitudinal": [
482
+ 0,
483
+ 2,
484
+ 7,
485
+ 11,
486
+ 23,
487
+ 27,
488
+ 41,
489
+ 45,
490
+ 55,
491
+ 57,
492
+ 5,
493
+ 13,
494
+ 21,
495
+ 29,
496
+ 39,
497
+ 47,
498
+ 9,
499
+ 25
500
+ ]
501
+ },
502
+ "rebase": "incumbent waveform, fusion and four heads; joint BIOT and TUEV head from readout epoch 9; zero initialized neural interaction",
503
+ "jointly_finetuned_neural_parent": "/workspace/research/runs/hybrid_biot_readout1/epoch-009/weights.pt",
504
+ "tuev_high_dimensional_spectral_projection_disabled": true,
505
+ "frozen_prior_representation": true,
506
+ "nonclinical_head_updates": "only the 256 added BIOT columns; original columns and biases fixed",
507
+ "faced_openbmi_neural_path": "common nonlinear fusion only; direct head columns masked",
508
+ "retention_teacher": "/workspace/research/runs/hybrid_wide1/epoch-004",
509
+ "retention_loss": {
510
+ "split": "train",
511
+ "temperature": 2.0,
512
+ "kl_weight": 1.0,
513
+ "tracks": [
514
+ "faced",
515
+ "ad65",
516
+ "openbmi",
517
+ "longitudinal"
518
+ ]
519
+ }
520
+ },
521
+ "joint_covariance_parent": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
522
+ "frozen_prior_representation": true,
523
+ "head_updates": "one linear head per track; added 128 shared covariance columns trainable; AD head initialized from the joint covariance parent",
524
+ "new_shared_representation": "one common covariance MLP inside the coupled backbone, trained by all five tasks; fixed spatial input adapters from the same jointly trained source",
525
+ "head_arithmetic": "one linear head evaluated in fixed feature blocks to preserve original bfloat16 accumulation dimensions",
526
+ "retention_teacher": {
527
+ "ad65": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
528
+ "other_tracks": "/workspace/research/runs/hybrid_wide1/epoch-004"
529
+ },
530
+ "retention_loss": {
531
+ "split": "train",
532
+ "temperature": 2.0,
533
+ "kl_weight": 1.0,
534
+ "tracks": [
535
+ "faced",
536
+ "ad65",
537
+ "openbmi",
538
+ "longitudinal"
539
+ ]
540
+ }
541
+ },
542
+ "loader_scale": 0.01,
543
+ "tracks": [
544
+ "faced",
545
+ "tuev",
546
+ "ad65",
547
+ "openbmi",
548
+ "longitudinal"
549
+ ],
550
+ "head_arithmetic": "same linear head in fixed feature blocks, sum in bfloat16 on GPU for non-AD tracks; AD remains float32",
551
+ "head_refinement": {
552
+ "source": "/workspace/research/runs/residual_heads1/epoch-018",
553
+ "source_weights_sha256": "e0b609137391b47f99438ccadaa22fc0bc10d2c10ead0ddf0a3c25be2c907c85",
554
+ "shared_backbone_unchanged": true,
555
+ "selected_head_epochs": {
556
+ "faced": 5,
557
+ "tuev": 24,
558
+ "ad65": 0,
559
+ "openbmi": 0,
560
+ "longitudinal": 0
561
+ }
562
+ },
563
+ "clinical_spectral_refinement": {
564
+ "source": "/workspace/research/runs/head_dropout1/epoch-016",
565
+ "zero_initialized_input_adapter": true,
566
+ "backbone_unchanged": true
567
+ },
568
+ "head_estimation": {
569
+ "method": "class/subject-balanced Gaussian linear discriminant; covariance augmented by class-conditional subject/session mean variation before shrinkage",
570
+ "selected_shrinkage": {
571
+ "faced": "inherited",
572
+ "tuev": "inherited",
573
+ "ad65": "inherited",
574
+ "openbmi": "inherited",
575
+ "longitudinal": {
576
+ "shrinkage": 0.9,
577
+ "domain_strength": 1.0
578
+ }
579
+ },
580
+ "feature_scaling": "fitted on training data and folded into linear coefficients"
581
+ },
582
+ "clinical_asymmetry_refinement": {
583
+ "source": "/workspace/research/runs/domain_lda_heads1/epoch-001",
584
+ "zero_initialized_input_adapter": true,
585
+ "backbone_unchanged": true
586
+ },
587
+ "alpha_rhythm_adapter": {
588
+ "training_normalization_only": true,
589
+ "regions": [
590
+ "occipital",
591
+ "parietal",
592
+ "central",
593
+ "frontal",
594
+ "left_posterior",
595
+ "right_posterior"
596
+ ],
597
+ "features": "per-window alpha prominence relative to adjacent frequencies",
598
+ "shared_backbone_unchanged": true
599
+ },
600
+ "clinical_envelope_refinement": {
601
+ "source": "/workspace/research/runs/clinical_asymmetry1/epoch-001",
602
+ "zero_initialized_input_adapter": true,
603
+ "backbone_unchanged": true
604
+ },
605
+ "independent_adapter_merge": {
606
+ "alpha_source": "/workspace/research/runs/alpha_calibrated1/epoch-003",
607
+ "clinical_source": "/workspace/research/runs/clinical_envelope1/epoch-002",
608
+ "all_shared_and_head_tensors_equal": true
609
+ },
610
+ "frequency_montage_refinement": {
611
+ "six_frequency_bands": true,
612
+ "shared_encoder_unchanged": true,
613
+ "selected_track_epochs": {
614
+ "faced": 0,
615
+ "tuev": 1,
616
+ "ad65": 0,
617
+ "openbmi": 10,
618
+ "longitudinal": 2
619
+ }
620
+ },
621
+ "private_track_selection": {
622
+ "track": "tuev",
623
+ "donor": "/workspace/research/replicates/frequency_head_control1/epoch-001"
624
+ },
625
+ "clinical_sampling_refinement": {
626
+ "subject_exponent": 0.0,
627
+ "class_balanced": true,
628
+ "only_clinical_head_updated": true
629
+ },
630
+ "temporal_statistics_readout": {
631
+ "statistics": [
632
+ "mean",
633
+ "standard deviation",
634
+ "maximum",
635
+ "minimum"
636
+ ],
637
+ "shared_encoder_and_prior_heads_unchanged": true,
638
+ "selected_pool_epochs": {
639
+ "faced": 2,
640
+ "tuev": 0,
641
+ "ad65": 0,
642
+ "openbmi": 33,
643
+ "longitudinal": 3
644
+ }
645
+ },
646
+ "temporal_evidence_readout": {
647
+ "pooling": "log mean exp of per-patch class evidence",
648
+ "temperature": 0.25,
649
+ "shared_encoder_and_prior_heads_unchanged": true,
650
+ "selected_evidence_epochs": {
651
+ "faced": 0,
652
+ "tuev": 0,
653
+ "ad65": 0,
654
+ "openbmi": 6,
655
+ "longitudinal": 8
656
+ }
657
+ },
658
+ "fourier_basis_readout": {
659
+ "basis_functions": 256,
660
+ "bandwidths": [
661
+ 0.5,
662
+ 1.0,
663
+ 2.0
664
+ ],
665
+ "shared_encoder_and_prior_heads_unchanged": true,
666
+ "selected_fourier_epochs": {
667
+ "faced": 21,
668
+ "tuev": 0,
669
+ "ad65": 0,
670
+ "openbmi": 0,
671
+ "longitudinal": 2
672
+ }
673
+ },
674
+ "shared_tangent_readout": {
675
+ "one_shared_tangent_module": true,
676
+ "original_and_corrected_shared_features_retained": true,
677
+ "private_head_scalar_gains": {
678
+ "faced": 0.0,
679
+ "tuev": 0.1,
680
+ "ad65": 0.0,
681
+ "openbmi": 1.0,
682
+ "longitudinal": 0.1
683
+ },
684
+ "all_common_weights_fixed_during_gain_refinement": true
685
+ },
686
+ "shared_context_correction": {
687
+ "source": "/workspace/research/runs/hybrid_codebrain_fusion_control1/epoch-002",
688
+ "zero_token_input_preserved": true,
689
+ "unused_native_CodeBrain_core_and_input_parameters_removed": true,
690
+ "common_patch_and_context_layers_retained": true,
691
+ "same_one_shared_backbone_and_five_classifiers": true
692
+ },
693
+ "shared_wave_coactivation": {
694
+ "channels": 64,
695
+ "statistics": 2080,
696
+ "diagonal_only_control": false,
697
+ "common_encoder_updated_by_all_five_tracks": true,
698
+ "gain_selection_within_one_common_checkpoint": {
699
+ "faced": 1.0,
700
+ "tuev": 0.0,
701
+ "ad65": 0.0,
702
+ "openbmi": 1.0,
703
+ "longitudinal": 1.0
704
+ }
705
+ },
706
+ "fixed_common_coactivation_readouts": {
707
+ "all_common_weights_exactly_unchanged": true,
708
+ "selected_private_epochs": {
709
+ "faced": 25,
710
+ "tuev": 0,
711
+ "ad65": 0,
712
+ "openbmi": 8,
713
+ "longitudinal": 2
714
+ }
715
+ },
716
+ "shared_ordinal_context": {
717
+ "per_channel_features": 130,
718
+ "normalization_fit_on_training_only": true,
719
+ "entropy_only_control": false,
720
+ "new_common_layers_trained_on_all_five_tracks": true,
721
+ "gains_within_one_common_checkpoint": {
722
+ "faced": 1.0,
723
+ "tuev": 0.0,
724
+ "ad65": 0.0,
725
+ "openbmi": 1.0,
726
+ "longitudinal": 0.0
727
+ }
728
+ },
729
+ "shared_complex_coherence": {
730
+ "features": 5520,
731
+ "normalization_fit_on_training_only": true,
732
+ "real_only_control": false,
733
+ "all_five_tracks_update_common_encoder": true,
734
+ "gains_within_one_common_checkpoint": {
735
+ "faced": 0.3,
736
+ "tuev": 0.0,
737
+ "ad65": 0.0,
738
+ "openbmi": 0.0,
739
+ "longitudinal": 0.0
740
+ }
741
+ }
742
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/covariances.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared neural filter-bank covariance decoder with spatial input adapters."""
2
+ import torch
3
+ from torch import nn
4
+ SPECS={'faced':(32,10,9),'tuev':(16,5,6),'ad65':(19,10,3),'openbmi':(62,4,2),'longitudinal':(58,2,2)}
5
+ TRACKS=tuple(SPECS)
6
+ BANDS=[(1,4),(4,8),(8,12),(12,16),(16,20),(20,24),(24,28),(28,32),(32,40),(40,48)]
7
+
8
+ @torch.no_grad()
9
+ def extract_covariances(t,x):
10
+ x=torch.nan_to_num(x.float().flatten(2)).clamp(-1e5,1e5)
11
+ x=x-x.mean(-1,keepdim=True)
12
+ if t in ('faced','tuev'):
13
+ x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
14
+ else:x=x-x.mean(1,keepdim=True)
15
+ # Per-window normalization, preserving spatial and frequency power ratios.
16
+ x=x/x.square().mean((1,2),keepdim=True).clamp_min(1e-12).sqrt()
17
+ frames=x.unfold(-1,400,200);frames=frames-frames.mean(-1,keepdim=True)
18
+ z=torch.fft.rfft(frames*torch.hann_window(400,device=x.device),dim=-1)/200
19
+ covs=[]
20
+ for lo,hi in BANDS:
21
+ v=z[...,2*lo:2*hi].flatten(2)
22
+ cov=(v.real@v.real.transpose(-1,-2)+v.imag@v.imag.transpose(-1,-2))/v.shape[-1]
23
+ covs.append(cov)
24
+ return torch.stack(covs,1)
25
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/data.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from functools import lru_cache
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ @lru_cache(maxsize=8)
7
+ def array(path):return np.load(path,mmap_mode='r',allow_pickle=False)
8
+ class Dataset(torch.utils.data.Dataset):
9
+ def __init__(self,root,limit=None,cache=False):
10
+ self.root=Path(root)
11
+ self.rows=json.loads((self.root/'manifest.json').read_text())['samples']
12
+ if limit:self.rows=self.rows[:limit]
13
+ self.cached=None
14
+ if cache and self.rows:
15
+ from collections import defaultdict
16
+ groups=defaultdict(list)
17
+ for i,r in enumerate(self.rows):groups[r['path']].append((i,r['index']))
18
+ for name,indices in groups.items():
19
+ path=(self.root/name).resolve()
20
+ if not path.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
21
+ source=np.load(path,mmap_mode='r',allow_pickle=False)
22
+ if self.cached is None:self.cached=torch.empty((len(self.rows),*source.shape[1:]),dtype=torch.float32)
23
+ dst,src=zip(*indices)
24
+ self.cached[list(dst)]=torch.as_tensor(source[list(src)]/100,dtype=torch.float32)
25
+ def __len__(self):return len(self.rows)
26
+ def __getitem__(self,i):
27
+ r=self.rows[i]
28
+ if self.cached is not None:return self.cached[i],r.get('label',-1),r['id']
29
+ p=(self.root/r['path']).resolve()
30
+ if not p.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
31
+ # Division precedes float32 conversion, matching official FACED/TUEV collate.
32
+ x=np.asarray(array(str(p))[r['index']])/100
33
+ return torch.as_tensor(x,dtype=torch.float32),r.get('label',-1),r['id']
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/envelope_features.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Per-window burst-envelope regularity and bilateral synchrony, without fitting."""
2
+ import torch
3
+ import torch.nn.functional as F
4
+
5
+ BANDS=((1,4),(4,8),(8,13),(13,30),(30,45))
6
+ ENVELOPE_DIM=16*5*12+8*5*2
7
+
8
+ @torch.no_grad()
9
+ def extract_envelope_features(signal):
10
+ with torch.autocast(signal.device.type,enabled=False):
11
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
12
+ spectrum=torch.fft.fft(x,dim=-1)
13
+ frequency=torch.fft.fftfreq(x.shape[-1],1/200,device=x.device)
14
+ envelopes=[]
15
+ for lo,hi in BANDS:
16
+ mask=((frequency>=lo)&(frequency<hi)).to(x.dtype)*2
17
+ analytic=torch.fft.ifft(spectrum*mask,dim=-1)
18
+ energy=analytic.abs().square()
19
+ envelope=F.avg_pool1d(energy.flatten(0,1).unsqueeze(1),20,10).squeeze(1)
20
+ envelopes.append(envelope.reshape(len(x),16,-1))
21
+ e=torch.stack(envelopes,2)
22
+ mean=e.mean(-1,keepdim=True).clamp_min(1e-12)
23
+ relative=e/mean
24
+ centered=relative-relative.mean(-1,keepdim=True)
25
+ std=centered.square().mean(-1,keepdim=True).sqrt().clamp_min(1e-6)
26
+ normalized=centered/std
27
+ acf=torch.stack([(normalized[...,:-lag]*normalized[...,lag:]).mean(-1)
28
+ for lag in range(4,41)],-1).clamp(-1,1)
29
+ acf_peak,acf_index=acf.max(-1)
30
+ probability=(relative/relative.sum(-1,keepdim=True).clamp_min(1e-12)).clamp_min(1e-12)
31
+ entropy=-(probability*probability.log()).sum(-1)
32
+ summaries=[std.squeeze(-1).clamp_min(1e-6).log(),relative.amax(-1).clamp_min(1).log(),entropy,
33
+ (relative>2).float().mean(-1),(relative>4).float().mean(-1),
34
+ ((relative[...,1:]>2)&(relative[...,:-1]<=2)).float().mean(-1),
35
+ acf_peak,(acf_index.float()+4)/40,
36
+ acf[...,0],acf[...,6],acf[...,16],acf[...,36]]
37
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=x.device);right=left+4
38
+ synchrony=(normalized[:,left]*normalized[:,right]).mean(-1).clamp(-1,1)
39
+ imbalance=(std[:,left].squeeze(-1).log()-std[:,right].squeeze(-1).log()).abs()
40
+ return torch.cat([torch.stack(summaries,-1).flatten(1),synchrony.flatten(1),imbalance.flatten(1)],1)
41
+
42
+ def mirrored_features(features):
43
+ channels=torch.tensor([4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11],device=features.device)
44
+ return torch.cat([features[:,:16*5*12].reshape(-1,16,5,12)[:,channels].flatten(1),features[:,16*5*12:]],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/features.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One shared residual backbone, five linear input adapters and output heads."""
2
+ import torch
3
+ from torch import nn
4
+
5
+ SPECS = {'faced': (32, 10, 9), 'tuev': (16, 5, 6), 'ad65': (19, 10, 3),
6
+ 'openbmi': (62, 4, 2), 'longitudinal': (58, 2, 2)}
7
+ TRACKS = tuple(SPECS)
8
+ EDGES = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,22,25,28,32,36,40,45,50,60,70,80,95]
9
+ COV_BANDS = [(1,4),(4,8),(8,12),(12,16),(16,20),(20,28),(28,40)]
10
+
11
+ def feature_dim(channels):
12
+ return channels * (4*(len(EDGES)-1)+4) + len(COV_BANDS)*channels*(channels-1)//2
13
+
14
+ @torch.no_grad()
15
+ def extract_features(track, x):
16
+ """Fixed features; no batch statistics or fitted inference transformations."""
17
+ x = x.float().flatten(2)
18
+ x = torch.nan_to_num(x, nan=0., posinf=1e5, neginf=-1e5).clamp(-1e5,1e5)
19
+ x = x - x.mean(-1,keepdim=True)
20
+ if track in ('ad65','openbmi','longitudinal'):
21
+ x = x - x.mean(1,keepdim=True)
22
+ rms = x.square().mean(-1).clamp_min(1e-12).sqrt()
23
+ norm = x / rms.unsqueeze(-1)
24
+ moments = torch.stack([rms.log(), norm.abs().amax(-1).clamp_min(1).log(),
25
+ norm.pow(4).mean(-1).clamp_min(1).log(),
26
+ (norm[...,1:]-norm[...,:-1]).square().mean(-1).clamp_min(1e-10).log()],-1)
27
+ frames = x.unfold(-1,400,200)
28
+ frames = frames - frames.mean(-1,keepdim=True)
29
+ window = torch.hann_window(400,device=x.device)
30
+ z = torch.fft.rfft(frames*window,dim=-1)/200
31
+ power = z.abs().square()
32
+ bands = torch.stack([power[...,2*lo:2*hi].mean(-1) for lo,hi in zip(EDGES[:-1],EDGES[1:])],-1)
33
+ lp = bands.mean(-2).clamp_min(1e-12).log()
34
+ variation = bands.clamp_min(1e-12).log().std(-2,correction=0)
35
+ relative_frequency = lp - lp.mean(-1,keepdim=True)
36
+ relative_channel = lp - lp.mean(1,keepdim=True)
37
+ parts = [torch.cat([lp, relative_frequency, relative_channel, variation, moments],-1).flatten(1)]
38
+ ii,jj = torch.triu_indices(x.shape[1],x.shape[1],offset=1,device=x.device)
39
+ for lo,hi in COV_BANDS:
40
+ v = z[...,2*lo:2*hi].flatten(2)
41
+ cov = v.real @ v.real.transpose(-1,-2) + v.imag @ v.imag.transpose(-1,-2)
42
+ d = cov.diagonal(dim1=-2,dim2=-1).clamp_min(1e-12).sqrt()
43
+ cor = cov / (d.unsqueeze(1)*d.unsqueeze(2)).clamp_min(1e-12)
44
+ parts.append(cor[:,ii,jj].clamp(-1,1))
45
+ result = torch.cat(parts,-1)
46
+ return torch.nan_to_num(result).clamp(-40,40)
47
+
48
+ class Standardize(nn.Module):
49
+ def __init__(self, dim):
50
+ super().__init__()
51
+ self.register_buffer('mean',torch.zeros(dim))
52
+ self.register_buffer('scale',torch.ones(dim))
53
+ def forward(self,x):
54
+ return ((x-self.mean)/self.scale).clamp(-8,8)
55
+
56
+ class Residual(nn.Module):
57
+ def __init__(self,width,dropout):
58
+ super().__init__()
59
+ self.net=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),
60
+ nn.Dropout(dropout),nn.Linear(width*2,width),nn.Dropout(dropout))
61
+ def forward(self,x):
62
+ return x+self.net(x)
63
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/frequency_features.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed per-window frequency decomposition for a linear montage adapter."""
2
+ import torch
3
+
4
+ FREQUENCY_BANDS=((1,4),(4,8),(8,13),(13,20),(20,30),(30,45))
5
+
6
+ def frequency_components(signal):
7
+ with torch.autocast(signal.device.type,enabled=False):
8
+ x=signal.float();spectrum=torch.fft.rfft(x,dim=-1)
9
+ frequency=torch.fft.rfftfreq(x.shape[-1],d=1/200,device=x.device)
10
+ masks=torch.stack([((frequency>=lo)&(frequency<hi)).float() for lo,hi in FREQUENCY_BANDS])
11
+ return torch.fft.irfft(spectrum[:,None]*masks[None,:,None],n=x.shape[-1],dim=-1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/infer.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse,json
2
+ from pathlib import Path
3
+ import torch
4
+ from model import HybridModel,SPECS
5
+ from data import Dataset
6
+ from covariances import extract_covariances
7
+ p=argparse.ArgumentParser();p.add_argument('input',type=Path);p.add_argument('output',type=Path);a=p.parse_args()
8
+ root=Path(__file__).resolve().parent;c=json.loads((root/'config.json').read_text());t=json.loads((a.input/'manifest.json').read_text())['track']
9
+ if t not in SPECS:raise ValueError('unknown track')
10
+ torch.set_num_threads(4);device='cuda' if torch.cuda.is_available() else 'cpu'
11
+ m=HybridModel(**c['architecture']).to(device);m.load_state_dict(torch.load(root/'weights.pt',map_location=device,weights_only=True));m.eval()
12
+ a.output.mkdir(parents=True,exist_ok=True)
13
+ with torch.inference_mode(),(a.output/'predictions.jsonl').open('w') as f:
14
+ for x,_,ids in torch.utils.data.DataLoader(Dataset(a.input),batch_size=64,num_workers=0):
15
+ # FFT features stay float32; convolutions can use bfloat16 on CUDA.
16
+ x=x.to(device)
17
+ from features import extract_features
18
+ torch.backends.cuda.matmul.allow_tf32=False
19
+ features=extract_features(t,x)
20
+ covariances=extract_covariances(t,x)
21
+ torch.backends.cuda.matmul.allow_tf32=True
22
+ with torch.autocast(device,dtype=torch.bfloat16,enabled=device=='cuda'):pred=m(t,x,features,covariances=covariances)
23
+ pp=pred.float().softmax(-1).cpu().numpy()
24
+ for sid,pr in zip(ids,pp):f.write(json.dumps({'id':sid,'probabilities':pr.tolist()})+'\n')
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/infer.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ exec python "$(dirname -- "$0")/infer.py" "$1" "$2"
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/model.py ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One fused waveform/spectral backbone used identically by all five tasks."""
2
+ import torch
3
+ from torch import nn
4
+ from braindecode.models import BIOT
5
+ from features import SPECS,TRACKS,feature_dim,extract_features,Standardize,Residual,EDGES,COV_BANDS
6
+ from covariances import BANDS,extract_covariances
7
+ from alpha_features import extract_alpha_features,ALPHA_DIM
8
+ from envelope_features import extract_envelope_features,ENVELOPE_DIM
9
+ from frequency_features import frequency_components,FREQUENCY_BANDS
10
+ from tangent_features import extract_tangent_features,TANGENT_DIM
11
+ from phase_features import phase_features,PHASE_DIM,PHASE_HALF
12
+ from ordinal_features import ordinal_features,PER_CHANNEL as ORDINAL_PER_CHANNEL
13
+
14
+ def clinical_asymmetry_features(features):
15
+ """Bipolar homologous-channel amplitude and coherence, invariant to mirroring."""
16
+ bands=len(EDGES)-1;per_channel=4*bands+4
17
+ block=features[:,:16*per_channel].reshape(-1,16,per_channel)
18
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=features.device);right=left+4
19
+ pair_power=(block[:,left,:bands]-block[:,right,:bands]).abs().flatten(1)
20
+ pair_rms=(block[:,left,4*bands]-block[:,right,4*bands]).abs()
21
+ hemisphere=(block[:,left,:bands].mean(1)-block[:,right,:bands].mean(1)).abs()
22
+ index=left*(32-left-1)//2+(right-left-1)
23
+ correlations=features[:,16*per_channel:].reshape(-1,len(COV_BANDS),120)[:,:,index].flatten(1)
24
+ return torch.cat([pair_power,pair_rms,hemisphere,correlations],1)
25
+
26
+ class InputAdapter(nn.Module):
27
+ def __init__(self,c,width,channels,spectral_enabled=True,asymmetry=False,alpha_regions=None,envelope=False):
28
+ super().__init__()
29
+ self.ordinal_normalizer=Standardize(c*ORDINAL_PER_CHANNEL)
30
+ self.ordinal_projection=nn.Linear(c*ORDINAL_PER_CHANNEL,width)
31
+ self.ordinal_dropout=nn.Dropout(.3)
32
+ self.register_buffer('ordinal_probabilities_enabled',torch.ones(()))
33
+ self.phase_normalizer=Standardize(PHASE_DIM)
34
+ self.signal=nn.Conv1d(c,channels,1,bias=False)
35
+ self.frequency_weight=nn.Parameter(torch.zeros(len(FREQUENCY_BANDS),channels,c))
36
+ self.neural=nn.Conv1d(c,18,1,bias=False)
37
+ self.normalizer=Standardize(feature_dim(c))
38
+ self.spectral=nn.Linear(feature_dim(c),width)
39
+ self.dropout=nn.Dropout(.1)
40
+ self.register_buffer("spectral_enabled",torch.tensor(float(spectral_enabled)))
41
+ self.spatial_weight=nn.Parameter(torch.randn(len(BANDS),24,c)/c**.5)
42
+ self.asymmetry_projection=nn.Linear(316,width,bias=False) if asymmetry else None
43
+ if asymmetry:
44
+ nn.init.zeros_(self.asymmetry_projection.weight)
45
+ self.asymmetry_normalizer=Standardize(316)
46
+ self.asymmetry_dropout=nn.Dropout(.1)
47
+ self.alpha_projection=None
48
+ if alpha_regions is not None:
49
+ self.register_buffer('alpha_regions',torch.tensor(alpha_regions,dtype=torch.float32))
50
+ self.alpha_normalizer=Standardize(ALPHA_DIM)
51
+ self.alpha_projection=nn.Linear(ALPHA_DIM,width,bias=False)
52
+ nn.init.zeros_(self.alpha_projection.weight)
53
+ self.alpha_dropout=nn.Dropout(.3)
54
+ self.envelope_projection=None
55
+ if envelope:
56
+ self.envelope_normalizer=Standardize(ENVELOPE_DIM)
57
+ self.envelope_projection=nn.Linear(ENVELOPE_DIM,width,bias=False)
58
+ nn.init.zeros_(self.envelope_projection.weight)
59
+ self.envelope_dropout=nn.Dropout(.3)
60
+ def ordinal_embedding(self,features):
61
+ values=self.ordinal_normalizer(features).reshape(len(features),-1,5,26)
62
+ values=torch.cat([self.ordinal_probabilities_enabled*values[...,:24],values[...,24:]],-1).flatten(1)
63
+ return self.ordinal_projection(self.ordinal_dropout(values))
64
+ def spectral_features(self,features,signal=None,alpha_features=None,envelope_features=None):
65
+ value=self.spectral_enabled*self.spectral(self.dropout(self.normalizer(features)))
66
+ if self.asymmetry_projection is not None:
67
+ extra=self.asymmetry_dropout(self.asymmetry_normalizer(clinical_asymmetry_features(features)))
68
+ value=value+self.asymmetry_projection(extra)
69
+ if self.alpha_projection is not None:
70
+ if alpha_features is None:alpha_features=extract_alpha_features(signal,self.alpha_regions)
71
+ value=value+self.alpha_projection(self.alpha_dropout(self.alpha_normalizer(alpha_features)))
72
+ if self.envelope_projection is not None:
73
+ if envelope_features is None:envelope_features=extract_envelope_features(signal)
74
+ value=value+self.envelope_projection(self.envelope_dropout(self.envelope_normalizer(envelope_features)))
75
+ return value
76
+ def spatial_features(self,covariances):
77
+ with torch.autocast(covariances.device.type,enabled=False):
78
+ w=self.spatial_weight.float()/self.spatial_weight.float().norm(dim=-1,keepdim=True).clamp_min(1e-6)
79
+ power=torch.einsum('bfc,nbcd,bfd->nbf',w,covariances.float(),w).clamp_min(1e-8).log()
80
+ return torch.cat([power,power-power.mean(1,keepdim=True)],1).flatten(1)
81
+ def wave_signal(self,x,components=None):
82
+ if components is None:components=frequency_components(x)
83
+ correction=torch.einsum('blc,nbct->nlt',self.frequency_weight,components.to(self.frequency_weight.dtype))
84
+ return (self.signal(x)+correction.to(x.dtype)).unsqueeze(1)
85
+ def forward(self,x,features,covariance_features):
86
+ return self.wave_signal(x),self.spectral_features(features,signal=x),self.neural(x),covariance_features
87
+
88
+ class SharedBackbone(nn.Module):
89
+ def __init__(self,channels,width,depth,dropout,wave_filters):
90
+ super().__init__()
91
+ self.waveform=nn.Sequential(
92
+ nn.Conv2d(1,wave_filters,(1,64),padding=(0,32),bias=False),nn.GroupNorm(1,wave_filters),
93
+ nn.Conv2d(wave_filters,2*wave_filters,(channels,1),groups=wave_filters,bias=False),nn.GroupNorm(1,2*wave_filters),nn.ELU(),
94
+ nn.AvgPool2d((1,4)),nn.Dropout(.35),
95
+ nn.Conv2d(2*wave_filters,2*wave_filters,(1,16),padding=(0,8),groups=2*wave_filters,bias=False),nn.Conv2d(2*wave_filters,2*wave_filters,1,bias=False),
96
+ nn.GroupNorm(1,2*wave_filters),nn.ELU(),nn.AvgPool2d((1,8)),nn.Dropout(.35))
97
+ self.wave_summary=nn.Sequential(nn.AdaptiveAvgPool2d((1,8)),nn.Flatten(),nn.Linear(2*wave_filters*8,width))
98
+ self.fusion=nn.Sequential(nn.LayerNorm(width),nn.GELU(),nn.Dropout(dropout),
99
+ *[Residual(width,dropout) for _ in range(depth)],nn.LayerNorm(width))
100
+ # Both representations interact before the shared residual stack.
101
+ self.phase_encoder=nn.Sequential(nn.LayerNorm(PHASE_DIM),nn.Linear(PHASE_DIM,width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width))
102
+ self.register_buffer('phase_imaginary_enabled',torch.ones(()))
103
+ self.wave_gain=nn.Parameter(torch.tensor(.1))
104
+ self.biot=BIOT(n_chans=18,n_outputs=2,n_times=400,sfreq=200)
105
+ self.biot.final_layer=nn.Identity()
106
+ self.biot_projection=nn.Sequential(nn.LayerNorm(256),nn.Linear(256,width),nn.Dropout(.2))
107
+ nn.init.normal_(self.biot_projection[1].weight,std=.001);nn.init.zeros_(self.biot_projection[1].bias)
108
+ self.covariance_encoder=nn.Sequential(nn.LayerNorm(len(BANDS)*24*2),nn.Linear(len(BANDS)*24*2,width),nn.GELU(),nn.Dropout(.4),
109
+ *[Residual(width,.4) for _ in range(2)],nn.LayerNorm(width))
110
+ self.covariance_projection=nn.Linear(width,width)
111
+ nn.init.zeros_(self.covariance_projection.weight);nn.init.zeros_(self.covariance_projection.bias)
112
+ self.tangent_encoder=nn.Sequential(nn.LayerNorm(TANGENT_DIM),nn.Linear(TANGENT_DIM,width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width),nn.Linear(width,width))
113
+ self.ordinal_context=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width))
114
+ nn.init.zeros_(self.ordinal_context[-1].weight);nn.init.zeros_(self.ordinal_context[-1].bias)
115
+ self.register_buffer('codebrain_enabled',torch.ones(()))
116
+ self.codebrain_patch_encoder=nn.Sequential(nn.LayerNorm(24*64),nn.Linear(24*64,width),nn.GELU(),nn.Dropout(.3))
117
+ self.codebrain_context=nn.Sequential(nn.LayerNorm(width*4),nn.Linear(width*4,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width))
118
+ nn.init.zeros_(self.codebrain_context[-1].weight);nn.init.zeros_(self.codebrain_context[-1].bias)
119
+ def codebrain_correction(self,tokens,representation,fusion_input):
120
+ with torch.autocast(tokens.device.type,enabled=False):
121
+ encoded=self.codebrain_patch_encoder(self.codebrain_enabled*tokens.float())
122
+ pooled=torch.cat([encoded.mean(1),encoded.std(1,correction=0),representation[:,-512:-384].float(),representation[:,-128:].float()],-1)
123
+ delta=self.codebrain_context(pooled)
124
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
125
+ corrected=self.fusion(fusion_input+added.to(fusion_input.dtype))
126
+ return corrected-representation[:,-512:-384],delta
127
+ def forward(self,signal,spectral,neural_signal,covariance_features,tangent_features):
128
+ wave=self.waveform(signal)
129
+ neural=self.biot(neural_signal.float())
130
+ neural=self.biot_projection[0](neural)
131
+ projected=self.biot_projection[2](self.biot_projection[1](neural))
132
+ with torch.autocast(signal.device.type,enabled=False):
133
+ covariance_embedding=self.covariance_encoder(covariance_features.float())
134
+ original=spectral+self.wave_gain*self.wave_summary(wave)+.01*projected
135
+ coupled=.001*self.covariance_projection(covariance_embedding).to(original.dtype)
136
+ fused=self.fusion(original+coupled)
137
+ with torch.autocast(signal.device.type,enabled=False):delta=self.tangent_encoder(tangent_features.float())
138
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
139
+ corrected=self.fusion((original+coupled)+added.to(original.dtype))
140
+ return torch.cat([wave.flatten(1),fused,neural,covariance_embedding],-1),corrected-fused,delta,original+coupled
141
+
142
+ class ResidualHead(nn.Module):
143
+ """A small nonlinear classifier correction around an inherited linear readout."""
144
+ def __init__(self,features,classes,width=64,dropout=.3,full_precision=False):
145
+ super().__init__();self.full_precision=full_precision
146
+ self.base=nn.Linear(features,classes)
147
+ self.delta=nn.Sequential(nn.LayerNorm(features),nn.Linear(features,width),nn.GELU(),nn.Dropout(dropout),nn.Linear(width,classes))
148
+ nn.init.zeros_(self.delta[-1].weight);nn.init.zeros_(self.delta[-1].bias)
149
+ def forward(self,x):
150
+ if self.full_precision:
151
+ with torch.autocast(x.device.type,enabled=False):return self.base(x.float())+self.delta(x.float())
152
+ prior=nn.functional.linear(x[:,:-128].contiguous(),self.base.weight[:,:-128].contiguous(),self.base.bias)
153
+ added=nn.functional.linear(x[:,-128:].contiguous(),self.base.weight[:,-128:].contiguous())
154
+ value=prior+added
155
+ return value+self.delta(x).to(value.dtype)
156
+
157
+ class TemporalPoolHead(nn.Module):
158
+ def __init__(self,prior,channels=64):
159
+ super().__init__();self.prior=prior;self.channels=channels
160
+ self.register_buffer('pool_output_scale',torch.ones(()));self.register_buffer('pool_mean',torch.zeros(channels*4));self.register_buffer('pool_scale',torch.ones(channels*4))
161
+ self.pool_projection=nn.Linear(channels*4,prior.base.out_features)
162
+ nn.init.zeros_(self.pool_projection.weight);nn.init.zeros_(self.pool_projection.bias)
163
+ def statistics(self,x):
164
+ with torch.autocast(x.device.type,enabled=False):
165
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1)
166
+ return torch.cat([wave.mean(-1),wave.std(-1,correction=0),wave.amax(-1),wave.amin(-1)],-1)
167
+ def forward(self,x):
168
+ prior=self.prior(x)
169
+ with torch.autocast(x.device.type,enabled=False):
170
+ values=((self.statistics(x)-self.pool_mean)/self.pool_scale).clamp(-8,8)
171
+ added=self.pool_output_scale*self.pool_projection(values)
172
+ return prior+added.to(prior.dtype)
173
+
174
+ class TemporalEvidenceHead(nn.Module):
175
+ """Pool class evidence over the shared waveform time axis."""
176
+ def __init__(self,prior,channels=64,temperature=.25):
177
+ super().__init__();self.prior=prior;self.channels=channels;self.temperature=temperature
178
+ self.register_buffer('evidence_output_scale',torch.ones(()))
179
+ self.register_buffer('evidence_mean',torch.zeros(channels))
180
+ self.register_buffer('evidence_scale',torch.ones(channels))
181
+ self.evidence_projection=nn.Linear(channels,prior.prior.base.out_features,bias=False)
182
+ nn.init.zeros_(self.evidence_projection.weight)
183
+ def patches(self,x):
184
+ with torch.autocast(x.device.type,enabled=False):
185
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1).transpose(1,2)
186
+ return ((wave-self.evidence_mean)/self.evidence_scale).clamp(-8,8)
187
+ def evidence(self,patches):
188
+ with torch.autocast(patches.device.type,enabled=False):
189
+ values=self.evidence_projection(patches.float())/self.temperature
190
+ maximum=values.amax(1,keepdim=True)
191
+ pooled=self.temperature*((values-maximum).exp().mean(1).log()+maximum.squeeze(1))
192
+ return self.evidence_output_scale*pooled
193
+ def forward(self,x):
194
+ prior=self.prior(x)
195
+ return prior+self.evidence(self.patches(x)).to(prior.dtype)
196
+
197
+ class FourierResidualHead(nn.Module):
198
+ """A fixed random Fourier basis and trainable linear classifier correction."""
199
+ def __init__(self,prior,features,classes,basis=256):
200
+ super().__init__();self.prior=prior
201
+ self.register_buffer('rff_mean',torch.zeros(features));self.register_buffer('rff_scale',torch.ones(features))
202
+ self.register_buffer('rff_frequency',torch.randn(features,basis)/features**.5)
203
+ self.register_buffer('rff_phase',torch.rand(basis)*2*torch.pi)
204
+ self.register_buffer('rff_output_scale',torch.ones(()))
205
+ self.rff_projection=nn.Linear(3*basis,classes);nn.init.zeros_(self.rff_projection.weight);nn.init.zeros_(self.rff_projection.bias)
206
+ def basis(self,x):
207
+ with torch.autocast(x.device.type,enabled=False):
208
+ values=((x.float()-self.rff_mean)/self.rff_scale).clamp(-8,8)@self.rff_frequency
209
+ return 2**.5*torch.cat([(values/sigma+self.rff_phase).cos() for sigma in (.5,1.,2.)],-1)
210
+ def forward(self,x):
211
+ prior=self.prior(x)
212
+ with torch.autocast(x.device.type,enabled=False):added=self.rff_output_scale*self.rff_projection(self.basis(x))
213
+ return prior+added.to(prior.dtype)
214
+
215
+ class TangentFeatureHead(nn.Module):
216
+ """Select a shared feature correction before the inherited classifier."""
217
+ def __init__(self,prior):
218
+ super().__init__();self.prior=prior;self.feature_gain=nn.Parameter(torch.zeros(()))
219
+ def forward(self,values):
220
+ old=values[:,:-256];fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
221
+ adjusted=torch.cat([old[:,:-512],old[:,-512:-384]+self.feature_gain*fusion_delta,old[:,-384:-128],old[:,-128:]+self.feature_gain*covariance_delta],-1)
222
+ return self.prior(adjusted)
223
+
224
+ class CodeBrainFeatureHead(nn.Module):
225
+ """Private use of a jointly trained common feature correction."""
226
+ def __init__(self,prior):
227
+ super().__init__();self.prior=prior;self.codebrain_gain=nn.Parameter(torch.ones(()))
228
+ def forward(self,values):
229
+ previous=values[:,:-256];native=previous[:,:-256]
230
+ fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
231
+ adjusted=torch.cat([native[:,:-512],native[:,-512:-384]+self.codebrain_gain*fusion_delta,native[:,-384:-128],native[:,-128:]+self.codebrain_gain*covariance_delta],-1)
232
+ return self.prior(torch.cat([adjusted,previous[:,-256:]],-1))
233
+
234
+ class WaveCoactivationContext(nn.Module):
235
+ """One common encoder of coactivation among the learned waveform channels."""
236
+ def __init__(self,channels=64,width=128):
237
+ super().__init__();self.channels=channels
238
+ ii,jj=torch.triu_indices(channels,channels,offset=1)
239
+ self.register_buffer('pair_i',ii);self.register_buffer('pair_j',jj)
240
+ self.register_buffer('offdiagonal_enabled',torch.ones(()))
241
+ self.encoder=nn.Sequential(nn.LayerNorm(channels+len(ii)),nn.Linear(channels+len(ii),width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width))
242
+ def statistics(self,native):
243
+ with torch.autocast(native.device.type,enabled=False):
244
+ wave=native[:,:-512].float().reshape(len(native),self.channels,-1)
245
+ centered=wave-wave.mean(-1,keepdim=True)
246
+ previous_tf32=torch.backends.cuda.matmul.allow_tf32
247
+ torch.backends.cuda.matmul.allow_tf32=False
248
+ covariance=centered@centered.transpose(-1,-2)/wave.shape[-1]
249
+ torch.backends.cuda.matmul.allow_tf32=previous_tf32
250
+ variance=covariance.diagonal(dim1=-2,dim2=-1).clamp_min(1e-8)
251
+ correlation=covariance/(variance.sqrt()[:,:,None]*variance.sqrt()[:,None,:])
252
+ return torch.cat([variance.log(),correlation[:,self.pair_i,self.pair_j].clamp(-1,1)],-1)
253
+ def encode_statistics(self,values):
254
+ with torch.autocast(values.device.type,enabled=False):
255
+ value=torch.cat([values[:,:self.channels],self.offdiagonal_enabled*values[:,self.channels:]],-1)
256
+ return self.encoder(value.float())
257
+ def forward(self,native):return self.encode_statistics(self.statistics(native))
258
+
259
+ class WaveCoactivationHead(nn.Module):
260
+ def __init__(self,prior,classes,width=128):
261
+ super().__init__();self.prior=prior;self.projection=nn.Linear(width,classes)
262
+ nn.init.zeros_(self.projection.weight);nn.init.zeros_(self.projection.bias)
263
+ self.register_buffer('output_scale',torch.ones(()));self.register_buffer('correction_gain',torch.ones(()))
264
+ def forward(self,values):
265
+ prior=self.prior(values[:,:-128])
266
+ with torch.autocast(values.device.type,enabled=False):delta=self.correction_gain*self.output_scale*self.projection(values[:,-128:].float())
267
+ return prior+delta.to(prior.dtype)
268
+
269
+ class OrdinalFeatureHead(nn.Module):
270
+ """Private strength of one common ordinal-dynamics feature correction."""
271
+ def __init__(self,prior):
272
+ super().__init__();self.prior=prior;self.ordinal_gain=nn.Parameter(torch.ones(()))
273
+ def forward(self,values):
274
+ previous=values[:,:-256];native=previous[:,:-640]
275
+ adjusted=torch.cat([native[:,:-512],native[:,-512:-384]+self.ordinal_gain*values[:,-256:-128],native[:,-384:-128],native[:,-128:]+self.ordinal_gain*values[:,-128:],previous[:,-640:]],-1)
276
+ return self.prior(adjusted)
277
+
278
+ class PhaseReadoutHead(nn.Module):
279
+ """Private class evidence from the common complex-coherence encoder."""
280
+ def __init__(self,prior,classes,width=128):
281
+ super().__init__();self.prior=prior;self.projection=nn.Linear(width,classes)
282
+ nn.init.zeros_(self.projection.weight);nn.init.zeros_(self.projection.bias)
283
+ self.register_buffer('output_scale',torch.ones(()));self.register_buffer('correction_gain',torch.ones(()))
284
+ def forward(self,values):
285
+ prior=self.prior(values[:,:-128])
286
+ with torch.autocast(values.device.type,enabled=False):delta=(self.correction_gain*self.output_scale)*self.projection(values[:,-128:].float())
287
+ return prior+delta.to(prior.dtype)
288
+
289
+ class HybridModel(nn.Module):
290
+ def __init__(self,channels=32,width=128,depth=2,dropout=.5,wave_filters=32,head_width=64,head_dropout=.3,clinical_asymmetry=True,alpha_regions=None,clinical_envelope=False,temporal_pool=True,temporal_evidence=False,evidence_temperature=.25,random_fourier=False,fourier_features=256,tangent_readout=True,shared_context_correction=True,wave_coactivation=True,ordinal_context=True,phase_coherence=True):
291
+ super().__init__()
292
+ self.adapters=nn.ModuleDict({t:InputAdapter(c,width,channels,spectral_enabled=t not in ("faced","tuev","openbmi"),asymmetry=clinical_asymmetry and t=="tuev",alpha_regions=alpha_regions if t=="longitudinal" else None,envelope=clinical_envelope and t=="tuev") for t,(c,s,k) in SPECS.items()})
293
+ self.backbone=SharedBackbone(channels,width,depth,dropout,wave_filters)
294
+ self.backbone.wave_coactivation=WaveCoactivationContext(2*wave_filters,width)
295
+ self.heads=nn.ModuleDict({t:ResidualHead(2*wave_filters*(((s*200+1)//4+1)//8)+width+256+width,k,head_width,head_dropout,full_precision=t=='ad65') for t,(c,s,k) in SPECS.items()})
296
+ if temporal_pool:self.heads=nn.ModuleDict({t:TemporalPoolHead(head,wave_filters*2) for t,head in self.heads.items()})
297
+ if temporal_evidence:self.heads=nn.ModuleDict({t:TemporalEvidenceHead(head,wave_filters*2,evidence_temperature) for t,head in self.heads.items()})
298
+ if random_fourier:self.heads=nn.ModuleDict({t:FourierResidualHead(head,2*wave_filters*(((SPECS[t][1]*200+1)//4+1)//8)+width+256+width,SPECS[t][2],fourier_features) for t,head in self.heads.items()})
299
+ self.heads=nn.ModuleDict({t:TangentFeatureHead(head) for t,head in self.heads.items()})
300
+ self.heads=nn.ModuleDict({t:CodeBrainFeatureHead(head) for t,head in self.heads.items()})
301
+ self.heads=nn.ModuleDict({t:WaveCoactivationHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
302
+ self.heads=nn.ModuleDict({t:OrdinalFeatureHead(head) for t,head in self.heads.items()})
303
+ self.heads=nn.ModuleDict({t:PhaseReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
304
+ def phase_embedding(self,t,values):
305
+ with torch.autocast(values.device.type,enabled=False):
306
+ normalized=self.adapters[t].phase_normalizer(values.float())
307
+ normalized=torch.cat([normalized[:,:PHASE_HALF],self.backbone.phase_imaginary_enabled*normalized[:,PHASE_HALF:]],-1)
308
+ return self.backbone.phase_encoder(normalized)
309
+ def forward(self,t,x,features=None,covariances=None,covariance_features=None):
310
+ if features is None:features=extract_features(t,x)
311
+ if covariance_features is None:
312
+ if covariances is None:covariances=extract_covariances(t,x)
313
+ covariance_features=self.adapters[t].spatial_features(covariances)
314
+ signal=x.flatten(2);signal=signal-signal.mean(-1,keepdim=True)
315
+ if t in ('faced','tuev'):signal=signal/signal.std(-1,keepdim=True,correction=0).clamp_min(1e-6)
316
+ else:signal=signal-signal.mean(1,keepdim=True)
317
+ signal=signal.clamp(-20,20)
318
+ adapted=self.adapters[t](signal,features,covariance_features)
319
+ if covariances is None:covariances=extract_covariances(t,x)
320
+ tangent=extract_tangent_features(covariances,self.adapters[t].spatial_weight)
321
+ representation,fusion_delta,covariance_delta,fusion_input=self.backbone(*adapted,tangent_features=tangent)
322
+ if t in ('faced','openbmi'):
323
+ representation=torch.cat([representation[:,:-384],torch.zeros_like(representation[:,-384:-128]),representation[:,-128:]],-1)
324
+ tokens=torch.zeros(len(signal),signal.shape[-1]//200,24*64,device=signal.device,dtype=torch.bfloat16)
325
+ code_fusion,code_covariance=self.backbone.codebrain_correction(tokens,representation,fusion_input)
326
+ coactivation=self.backbone.wave_coactivation(representation)
327
+ with torch.autocast(signal.device.type,enabled=False):
328
+ ordinal=self.adapters[t].ordinal_embedding(ordinal_features(t,x))
329
+ ordinal_covariance=self.backbone.ordinal_context(ordinal.float())
330
+ added=.001*nn.functional.linear(ordinal_covariance,self.backbone.covariance_projection.weight,None)
331
+ ordinal_fusion=self.backbone.fusion(fusion_input+added.to(fusion_input.dtype))-representation[:,-512:-384]
332
+ phase=self.phase_embedding(t,phase_features(t,x,self.adapters[t].spatial_weight))
333
+ return self.heads[t](torch.cat([representation,fusion_delta,covariance_delta,code_fusion,code_covariance,coactivation,ordinal_fusion,ordinal_covariance,phase],-1))
334
+
335
+ def widen_state_dict(state,multiplier=2):
336
+ """Duplicate temporal features and divide downstream sums to preserve outputs."""
337
+ result={}
338
+ for key,value in state.items():
339
+ if key.startswith('backbone.waveform.'):
340
+ layer=int(key.split('.')[2])
341
+ if layer in (0,2,7):value=value.repeat(multiplier,1,1,1)
342
+ elif layer in (1,3,9):value=value.repeat(multiplier)
343
+ elif layer==8:value=value.repeat(multiplier,multiplier,1,1)/multiplier
344
+ elif key=='backbone.wave_summary.2.weight':value=value.repeat(1,multiplier)/multiplier
345
+ elif key.startswith('heads.') and key.endswith('.weight'):
346
+ raw=value[:,:-128]/multiplier
347
+ value=torch.cat([raw]*multiplier+[value[:,-128:]],1)
348
+ result[key]=value
349
+ return result
350
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/ordinal_features.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed within-window ordinal dynamics, independent of amplitude scaling."""
2
+ import math
3
+ import torch
4
+ LAGS=(1,2,4,8,16)
5
+ PATTERNS=24
6
+ PER_CHANNEL=len(LAGS)*(PATTERNS+2)
7
+
8
+ def ordinal_features(track,x):
9
+ with torch.autocast(x.device.type,enabled=False):
10
+ x=torch.nan_to_num(x.float().flatten(2),nan=0.,posinf=1e5,neginf=-1e5).clamp(-1e5,1e5)
11
+ if track in ('ad65','openbmi','longitudinal'):x=x-x.mean(1,keepdim=True)
12
+ parts=[];uniform=1/PATTERNS;maximum_entropy=math.log(PATTERNS);m0=(1+uniform)/2;mr=uniform/2;maximum_js=-m0*math.log(m0)-(PATTERNS-1)*mr*math.log(mr)-maximum_entropy/2
13
+ for lag in LAGS:
14
+ length=x.shape[-1]-3*lag
15
+ if length<=0:raise ValueError('window too short for ordinal dynamics')
16
+ samples=torch.stack([x[...,i*lag:i*lag+length] for i in range(4)],-1)
17
+ order=samples.argsort(dim=-1,stable=True)
18
+ code=6*((order[...,0,None]>order[...,1:]).sum(-1))+2*((order[...,1,None]>order[...,2:]).sum(-1))+(order[...,2]>order[...,3]).long()
19
+ histogram=torch.zeros(*x.shape[:2],PATTERNS,device=x.device,dtype=torch.float32)
20
+ histogram.scatter_add_(-1,code,torch.ones_like(code,dtype=torch.float32));probability=histogram/length
21
+ entropy=-(probability*probability.clamp_min(1e-12).log()).sum(-1)
22
+ mixture=(probability+uniform)/2;mixture_entropy=-(mixture*mixture.log()).sum(-1)
23
+ complexity=((mixture_entropy-.5*entropy-.5*maximum_entropy)/maximum_js).clamp(0,1)*(entropy/maximum_entropy)
24
+ parts.append(torch.cat([probability,(entropy/maximum_entropy)[...,None],complexity[...,None]],-1))
25
+ return torch.cat(parts,-1).flatten(1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/phase_features.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Complex spectral coherence of the existing 24 spatial filters in ten bands."""
2
+ import torch
3
+ from covariances import BANDS
4
+ CHANNELS=24
5
+ PHASE_HALF=len(BANDS)*CHANNELS*(CHANNELS-1)//2
6
+ PHASE_DIM=2*PHASE_HALF
7
+
8
+ @torch.no_grad()
9
+ def phase_features(track,x,spatial_weight):
10
+ previous_tf32=torch.backends.cuda.matmul.allow_tf32
11
+ try:
12
+ torch.backends.cuda.matmul.allow_tf32=False
13
+ with torch.autocast(x.device.type,enabled=False):
14
+ x=torch.nan_to_num(x.float().flatten(2),nan=0.,posinf=1e5,neginf=-1e5).clamp(-1e5,1e5)
15
+ x=x-x.mean(-1,keepdim=True)
16
+ if track in ('faced','tuev'):x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
17
+ else:x=x-x.mean(1,keepdim=True)
18
+ x=x/x.square().mean((1,2),keepdim=True).clamp_min(1e-12).sqrt()
19
+ frames=x.unfold(-1,400,200);frames=frames-frames.mean(-1,keepdim=True)
20
+ z=torch.fft.rfft(frames*torch.hann_window(400,device=x.device),dim=-1)/200
21
+ w=spatial_weight.float()/spatial_weight.float().norm(dim=-1,keepdim=True).clamp_min(1e-6)
22
+ index=torch.triu_indices(CHANNELS,CHANNELS,1,device=x.device)
23
+ real_parts=[];imaginary_parts=[]
24
+ for band,(lo,hi) in enumerate(BANDS):
25
+ v=z[...,2*lo:2*hi].flatten(2)
26
+ vr=w[band][None]@v.real;vi=w[band][None]@v.imag
27
+ real=(vr@vr.transpose(-1,-2)+vi@vi.transpose(-1,-2))/v.shape[-1]
28
+ imaginary=(vi@vr.transpose(-1,-2)-vr@vi.transpose(-1,-2))/v.shape[-1]
29
+ # Signals have unit global RMS; this floor suppresses phase of numerical silence.
30
+ power=real.diagonal(dim1=-2,dim2=-1).clamp_min(1e-6)
31
+ denominator=(power[:,:,None]*power[:,None,:]).sqrt().clamp_min(1e-12)
32
+ real=(real/denominator).clamp(-.999,.999)
33
+ imaginary=(imaginary/denominator).clamp(-.999,.999)
34
+ real_parts.append(torch.atanh(real[:,index[0],index[1]]))
35
+ imaginary_parts.append(torch.atanh(imaginary[:,index[0],index[1]]))
36
+ return torch.cat(real_parts+imaginary_parts,-1)
37
+ finally:torch.backends.cuda.matmul.allow_tf32=previous_tf32
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S050/tangent_features.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Window-local log-correlation geometry in the existing spatial-filter basis."""
2
+ import torch
3
+
4
+ TANGENT_DIM=10*24*25//2
5
+
6
+ @torch.no_grad()
7
+ def extract_tangent_features(covariances,spatial_weight):
8
+ old_tf32=torch.backends.cuda.matmul.allow_tf32
9
+ torch.backends.cuda.matmul.allow_tf32=False
10
+ try:
11
+ with torch.autocast(covariances.device.type,enabled=False):
12
+ w=spatial_weight.float()
13
+ w=w/w.norm(dim=-1,keepdim=True).clamp_min(1e-6)
14
+ projected=torch.einsum('bfc,nbcd,bgd->nbfg',w,covariances.float(),w)
15
+ d=projected.diagonal(dim1=-2,dim2=-1).clamp_min(1e-10).sqrt()
16
+ correlation=(projected/(d.unsqueeze(-1)*d.unsqueeze(-2))).clamp(-1,1)
17
+ correlation=(correlation+correlation.transpose(-1,-2))/2
18
+ correlation=.95*correlation+.05*torch.eye(24,device=correlation.device)
19
+ values,vectors=torch.linalg.eigh(correlation)
20
+ logarithm=(vectors*values.clamp_min(1e-6).log().unsqueeze(-2))@vectors.transpose(-1,-2)
21
+ i,j=torch.triu_indices(24,24,device=correlation.device)
22
+ scale=torch.where(i==j,1.,2.**.5)
23
+ return (logarithm[...,i,j]*scale).flatten(1)
24
+ finally:
25
+ torch.backends.cuda.matmul.allow_tf32=old_tf32
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S091/student_features.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One audited CBraMod core with full-window shared and ordered representations."""
2
+ import torch
3
+ from torch import nn
4
+ from braindecode.models import CBraMod
5
+ from frequency_features import frequency_components,FREQUENCY_BANDS
6
+ SPECS={'faced':(32,10,9),'tuev':(16,5,6),'ad65':(19,10,3),'openbmi':(62,4,2),'longitudinal':(58,2,2)}
7
+ TRACKS=tuple(SPECS)
8
+
9
+ class FrequencyAdapter(nn.Module):
10
+ def __init__(self,channels,virtual_channels=32):
11
+ super().__init__();self.signal=nn.Conv1d(channels,virtual_channels,1,bias=False)
12
+ self.frequency_weight=nn.Parameter(torch.zeros(len(FREQUENCY_BANDS),virtual_channels,channels))
13
+ def forward(self,x):
14
+ components=frequency_components(x)
15
+ correction=torch.einsum('blc,nbct->nlt',self.frequency_weight,components.to(self.frequency_weight.dtype))
16
+ return self.signal(x)+correction.to(x.dtype)
17
+
18
+ class CBraModFeatures(nn.Module):
19
+ def __init__(self,virtual_channels=32,token_width=64,summary_width=256,head_width=128,dropout=.3):
20
+ super().__init__();self.virtual_channels=virtual_channels;self.output_dim=summary_width+virtual_channels*token_width*4
21
+ self.backbone=CBraMod(n_chans=virtual_channels,n_outputs=2,n_times=400,sfreq=200)
22
+ self.backbone.final_layer=nn.Identity()
23
+ self.token_projection=nn.Sequential(nn.LayerNorm(200),nn.Linear(200,token_width),nn.GELU())
24
+ self.summary_projection=nn.Sequential(nn.LayerNorm(virtual_channels*token_width*2),nn.Linear(virtual_channels*token_width*2,summary_width),nn.GELU(),nn.Dropout(dropout))
25
+ def forward(self,signal):
26
+ tokens=self.token_projection(self.backbone(signal))
27
+ moments=torch.cat([tokens.mean(2),tokens.float().std(2,correction=0).to(tokens.dtype)],-1).flatten(1)
28
+ summary=self.summary_projection(moments)
29
+ ordered=torch.nn.functional.adaptive_avg_pool1d(tokens.permute(0,1,3,2).flatten(1,2),4).flatten(1)
30
+ return torch.cat([summary,ordered],-1)
31
+
32
+ def named_shared_parameters(self):
33
+ for prefix,module in [('backbone',self.backbone),('token_projection',self.token_projection),('summary_projection',self.summary_projection)]:
34
+ for name,p in module.named_parameters():yield f'{prefix}.{name}',p
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/MODEL_CARD.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Shared EEG decoder
2
+
3
+ This package contains one coupled backbone used by all five tracks, with private input adapters and classifiers. Every trainable common component was trained with all five training splits. It is a single model; inference performs no parameter updates or dataset-level fitting.
4
+
5
+ The common backbone combines waveform convolutions, an audited pretrained BIOT feature path, covariance and log-correlation encoders, and shared feature corrections. The waveform coactivation extension encodes 64 within-window log variances and 2,016 correlations between common waveform channels. A matched experimental control removes the correlation inputs. `config.json` identifies the packaged variant and its five fixed correction gains. All original backbone parameters are fixed during this extension's joint training.
6
+
7
+ Weights originate only from the supplied training data and audited initialization checkpoints. Training details, parent provenance, raw/cache checks, shared-gradient checks and the five separate validation metrics are recorded in `training.json`. Validation selects checkpoints and fixed gains; it does not fit normalization or update parameters. Reported validation results belong to selected checkpoints, not to private test evaluation or five-seed means.
8
+
9
+ Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. The input manifest specifies a track and opaque sample IDs, shard paths and indices. Signals are in microvolts and are scaled by 1/100. The package writes one probability vector per input ID to `OUTPUT_DIR/predictions.jsonl`. It needs only the packaged files and the contract's installed Python dependencies, works after relocation, and does not need labels, subject IDs, training caches or network access.
10
+
11
+ FACED and TUEV use window balanced accuracy. AD65 uses mean window probabilities per patient before balanced accuracy. OpenBMI averages within-subject balanced accuracy. Longitudinal averages within-session balanced accuracy within each subject, then over subjects. These five metrics remain separate.
12
+
13
+ This checkpoint adds fixed within-window ordinal pattern probabilities, permutation entropy and statistical complexity at five delays. Training-only normalization and five input projections feed one common correction MLP trained by all five tracks. The common correction enters the existing covariance and fusion representations; fixed per-track gains select its strength. All earlier model tensors remain unchanged.
14
+
15
+ Fixed real and imaginary spectral coherence between the inherited 24 spatial filters is normalized using training windows only and encoded by one new common network. Five private linear heads add class evidence. All five training splits update the new common encoder; all earlier model tensors remain unchanged.
16
+
17
+ Fixed per-window relative band powers, envelope variability, envelope correlations and phase-amplitude coupling feed training-normalized private input projections and one new shared encoder. Five linear heads add class evidence. All five training splits update the new common encoder; all prior model tensors remain unchanged. AD65 updates use all windows from six class-balanced training patients; objective: mean-probability.
18
+
19
+ The inherited OpenBMI phase-classifier projection was refreshed from a separately validated private-readout fit. Every common tensor and input adapter of this jointly trained model is unchanged. Exact ancestor checks confirm that all common tensors used by this inherited readout are identical; the new cross-frequency correction remains disabled for OpenBMI. No shared checkpoints or predictions are ensembled.
20
+
21
+ A common CBraMod feature encoder, itself jointly trained on all five training splits, supplies its shared summary and tokens pooled into four ordered time bins. Its classifiers are discarded. A new common feature MLP and five zero-initialized private linear projections learn residual class evidence jointly on all five training splits. Training may randomly remove the earlier decoder logits for half of training groups, using one mask per AD patient and one per other window; labels and teacher targets remain unchanged. Validation and inference always retain the complete earlier decoder. The same new class projection also receives an auxiliary standalone classification loss when configured, with the same patient-pooled AD objective; this adds no inference module. The complete earlier decoder and feature extractor remain tensor-identical; selecting zero residual gain preserves its predictions exactly. The summary-only control masks the 8192 ordered features after training-fitted per-feature normalization. One feature backbone and one classifier per track run at inference, with no prediction ensemble or external runtime cache.
22
+
23
+ The five outer private student-feature class projections are refined on all five training splits while every common/input/prior-head tensor remains exactly fixed. AD uses the exact patient-mean probability objective. Private checkpoints may be selected independently only because the common representation is identical; all five metrics are evaluated for every exported package.
24
+
25
+ The longitudinal private outer projection is selected from another training-only readout fit using exactly the same common/input/prior-head tensors. All other private heads are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
26
+
27
+ The complete stronger parent is retained, including its common CBraMod feature encoder, common readout and all private classifiers. The CBraMod features and existing common128-dimensional embedding are computed once and reused. An additional common128-to256-to128 MLP with the configured GELU or identity activation and five zero-initialized private linear projections learn residual class evidence jointly on all five training splits. Training may randomly remove the earlier decoder logits for half of training groups, using one mask per AD patient and one per other window; labels and teacher targets remain unchanged. Validation and inference always retain the complete earlier decoder. The same new class projection also receives an auxiliary standalone classification loss when configured, with the same patient-pooled AD objective; this adds no inference module. The complete earlier decoder and feature extractor remain tensor-identical; selecting zero residual gain preserves its predictions exactly. One feature backbone and one classifier per track run at inference, with no prediction ensemble or external runtime cache.
28
+
29
+ The five outer private student-feature class projections are refined on all five training splits while every common/input/prior-head tensor remains exactly fixed. AD uses the exact patient-mean probability objective. Private checkpoints may be selected independently only because the common representation is identical; all five metrics are evaluated for every exported package.
30
+
31
+ The openbmi private outer projection is selected from another training-only readout fit using exactly the same common/input/prior-head tensors. All other private heads are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
32
+
33
+ A fixed two-second crop supplies spectral and cross-frequency coupling features, with no short-window envelope autocorrelation. The crop is configured as center or first. Each track has a training-fitted normalizer and linear input adapter to128 dimensions; one common128-to256-to128 GELU/LayerNorm block and five zero-initialized class projections are jointly trained on all five training splits. All complete-parent tensors are preserved exactly. Normalization statistics use training windows only. The parent is randomly removed from the training loss at the configured probability; it is always present at inference. AD uses mean patient probabilities over all sampled patient windows. Auxiliary classification uses the same class projection. There is one composed feature backbone and head per track; no prediction ensemble, external runtime cache, test adaptation, or evaluation-metadata features. Zero residual gain exactly retains the complete parent.
34
+
35
+ The five outer private center-context class projections are refined on all five training splits while every common/input/prior-head tensor remains exactly fixed. AD uses the exact patient-mean probability objective. Private checkpoints may be selected independently only because the common representation is identical; all five metrics are evaluated for every exported package.
36
+
37
+ The tuev private outer projection is selected from another training-only readout fit using exactly the same common/input/prior-head tensors. All other private heads are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
38
+
39
+ The faced private context input and outer class projections are selected from another training-only readout fit using exactly the same common/oldinput/normalizer/prior-head tensors. All other private input/head pairs are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
40
+
41
+ A fixed one-second crop supplies spectral and cross-frequency coupling features, with no short-window envelope autocorrelation. The crop is configured as center or first. Each track has a training-fitted normalizer and linear input adapter to128 dimensions; one common128-to256-to128 GELU/LayerNorm block and five zero-initialized class projections are jointly trained on all five training splits. All complete-parent tensors are preserved exactly. Normalization statistics use training windows only. The parent is randomly removed from the training loss at the configured probability; it is always present at inference. AD uses mean patient probabilities over all sampled patient windows. Auxiliary classification uses the same class projection. There is one composed feature backbone and head per track; no prediction ensemble, external runtime cache, test adaptation, or evaluation-metadata features. Zero residual gain exactly retains the complete parent.
42
+
43
+ The five outer private short-context class projections are refined on all five training splits while every common/input/prior-head tensor remains exactly fixed. AD uses the exact patient-mean probability objective. Private checkpoints may be selected independently only because the common representation is identical; all five metrics are evaluated for every exported package.
44
+
45
+ The tuev private outer projection is selected from another training-only readout fit using exactly the same common/input/prior-head tensors. All other private heads are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
46
+
47
+ An additional common context block preserves every existing short-context parent tensor and correction. A fixed one-second crop supplies spectral and cross-frequency coupling features, with no short-window envelope autocorrelation. TUEV concatenates first and center one-second descriptors; the parameter-matched control repeats first descriptors. Other tracks use first one-second descriptors. Each track has a training-fitted normalizer and linear input adapter to128 dimensions; one common128-to256-to128 GELU/LayerNorm block and five zero-initialized class projections are jointly trained on all five training splits. All complete-parent tensors are preserved exactly. Normalization statistics use training windows only. The parent is randomly removed from the training loss at the configured probability; it is always present at inference. AD uses mean patient probabilities over all sampled patient windows. Auxiliary classification uses the same class projection. There is one composed feature backbone and head per track; no prediction ensemble, external runtime cache, test adaptation, or evaluation-metadata features. Zero residual gain exactly retains the complete parent.
48
+
49
+ An additional shared128-to256-to128 GELU/LayerNorm block is jointly trained by all five tracks. OpenBMI uses seven native-channel trace-normalized covariance matrices with fixed5percent identity shrinkage: matrix-log upper triangles in the main arm, covariance-minus-identity in the matched control. Other four new inputs are first-one-second spectral/coupling descriptors. Every complete-parent tensor is preserved exactly. Input normalization uses training windows only; zero outer gain retains the parent. Five private adapters and class projections, one composed shared backbone, no evaluation adaptation or external runtime cache.
50
+
51
+ The five outer private geometry-block input adapters and class projections are refined on all five training splits. Every common backbone, fitted normalizer and earlier input/prior-head tensor remains exactly fixed. Common parameters are excluded from optimization; differentiable evaluation of the fixed common block permits gradients to the private input maps. AD uses the exact patient-mean probability objective. Private input/head checkpoints may be selected independently only because the common parameter state is identical and every track uses its own private adapter/head; all five metrics are evaluated for every exported package.
52
+
53
+ An additional shared128-to256-to128 GELU/LayerNorm block is jointly trained by all five tracks. FACED uses seven native-channel trace-normalized covariance matrices with fixed5percent identity shrinkage: matrix-log upper triangles in the main arm, covariance-minus-identity in the matched control. Other four new inputs are first-one-second spectral/coupling descriptors. Every complete-parent tensor is preserved exactly. Input normalization uses training windows only; zero outer gain retains the parent. Five private adapters and class projections, one composed shared backbone, no evaluation adaptation or external runtime cache.
54
+
55
+ The longitudinal private context input and outer class projections are selected from another training-only readout fit using exactly the same common/oldinput/normalizer/prior-head tensors. All other private input/head pairs are retained. Exact equality of every common tensor and executable runtime is audited; this package has one common checkpoint and one head per track.
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/alpha_features.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed alpha prominence features from each individual two-second window."""
2
+ import torch
3
+
4
+ REGION_NAMES=('occipital','parietal','central','frontal','left_posterior','right_posterior')
5
+ REGIONS=(('PO7','PO5','PO3','POZ','PO4','PO6','PO8','O1','OZ','O2'),
6
+ ('P7','P5','P3','P1','PZ','P2','P4','P6','P8'),
7
+ ('FC5','FC3','FC1','FCZ','FC2','FC4','FC6','C5','C3','C1','CZ','C2','C4','C6'),
8
+ ('FP1','FPZ','FP2','AF3','AF4','F7','F5','F3','F1','FZ','F2','F4','F6','F8'),
9
+ ('P7','P5','P3','P1','PO7','PO5','PO3','O1'),
10
+ ('P2','P4','P6','P8','PO4','PO6','PO8','O2'))
11
+ ALPHA_DIM=58*7+6*22
12
+
13
+ def region_matrix(channels):
14
+ result=torch.zeros(len(REGIONS),len(channels))
15
+ for i,names in enumerate(REGIONS):
16
+ for name in names:result[i,channels.index(name)]=1/len(names)
17
+ return result.tolist()
18
+
19
+ @torch.no_grad()
20
+ def extract_alpha_features(signal,regions):
21
+ with torch.autocast(signal.device.type,enabled=False):
22
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
23
+ spectrum=torch.fft.rfft(x*torch.hann_window(400,device=x.device),dim=-1)/200
24
+ power=spectrum.abs().square().clamp_min(1e-12)
25
+ lp=power.log()
26
+ # Geometric regional means resist domination by one high-amplitude channel.
27
+ regional=torch.einsum('rc,ncf->nrf',regions.float(),lp)
28
+ lp=torch.cat([lp,regional],1)
29
+ low=lp[...,8:13].mean(-1,keepdim=True)
30
+ high=lp[...,36:49].mean(-1,keepdim=True)
31
+ freq=torch.arange(7.,14.5,.5,device=x.device)
32
+ alpha=lp[...,14:29]
33
+ baseline=low+(high-low)*((freq-5)/16)
34
+ prominence=alpha-baseline
35
+ normalized=alpha.softmax(-1)
36
+ center=(normalized*freq).sum(-1)
37
+ entropy=-(normalized*normalized.clamp_min(1e-12).log()).sum(-1)
38
+ alpha_mean=torch.logsumexp(alpha,-1)-torch.log(torch.tensor(15.,device=x.device))
39
+ def log_band(lo,hi):
40
+ return torch.logsumexp(lp[...,lo:hi],-1)-torch.log(torch.tensor(float(hi-lo),device=x.device))
41
+ summaries=torch.stack([alpha_mean-log_band(2,81),alpha_mean-log_band(8,14),
42
+ alpha_mean-log_band(30,61),prominence.max(-1).values,
43
+ prominence.mean(-1),center,entropy],-1)
44
+ return torch.cat([summaries[:,:58].flatten(1),summaries[:,58:].flatten(1),
45
+ prominence[:,58:].flatten(1)],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/config.json ADDED
@@ -0,0 +1,1033 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "bci-shared-biot-covariance-bf16head-v1",
3
+ "architecture": {
4
+ "channels": 32,
5
+ "width": 128,
6
+ "depth": 2,
7
+ "dropout": 0.5,
8
+ "wave_filters": 32,
9
+ "head_width": 64,
10
+ "head_dropout": 0.3,
11
+ "clinical_asymmetry": true,
12
+ "alpha_regions": [
13
+ [
14
+ 0.0,
15
+ 0.0,
16
+ 0.0,
17
+ 0.0,
18
+ 0.0,
19
+ 0.0,
20
+ 0.0,
21
+ 0.0,
22
+ 0.0,
23
+ 0.0,
24
+ 0.0,
25
+ 0.0,
26
+ 0.0,
27
+ 0.0,
28
+ 0.0,
29
+ 0.0,
30
+ 0.0,
31
+ 0.0,
32
+ 0.0,
33
+ 0.0,
34
+ 0.0,
35
+ 0.0,
36
+ 0.0,
37
+ 0.0,
38
+ 0.0,
39
+ 0.0,
40
+ 0.0,
41
+ 0.0,
42
+ 0.0,
43
+ 0.0,
44
+ 0.0,
45
+ 0.0,
46
+ 0.0,
47
+ 0.0,
48
+ 0.0,
49
+ 0.0,
50
+ 0.0,
51
+ 0.0,
52
+ 0.0,
53
+ 0.0,
54
+ 0.0,
55
+ 0.0,
56
+ 0.0,
57
+ 0.0,
58
+ 0.0,
59
+ 0.0,
60
+ 0.0,
61
+ 0.0,
62
+ 0.10000000149011612,
63
+ 0.10000000149011612,
64
+ 0.10000000149011612,
65
+ 0.10000000149011612,
66
+ 0.10000000149011612,
67
+ 0.10000000149011612,
68
+ 0.10000000149011612,
69
+ 0.10000000149011612,
70
+ 0.10000000149011612,
71
+ 0.10000000149011612
72
+ ],
73
+ [
74
+ 0.0,
75
+ 0.0,
76
+ 0.0,
77
+ 0.0,
78
+ 0.0,
79
+ 0.0,
80
+ 0.0,
81
+ 0.0,
82
+ 0.0,
83
+ 0.0,
84
+ 0.0,
85
+ 0.0,
86
+ 0.0,
87
+ 0.0,
88
+ 0.0,
89
+ 0.0,
90
+ 0.0,
91
+ 0.0,
92
+ 0.0,
93
+ 0.0,
94
+ 0.0,
95
+ 0.0,
96
+ 0.0,
97
+ 0.0,
98
+ 0.0,
99
+ 0.0,
100
+ 0.0,
101
+ 0.0,
102
+ 0.0,
103
+ 0.0,
104
+ 0.0,
105
+ 0.0,
106
+ 0.0,
107
+ 0.0,
108
+ 0.0,
109
+ 0.0,
110
+ 0.0,
111
+ 0.0,
112
+ 0.0,
113
+ 0.1111111119389534,
114
+ 0.1111111119389534,
115
+ 0.1111111119389534,
116
+ 0.1111111119389534,
117
+ 0.1111111119389534,
118
+ 0.1111111119389534,
119
+ 0.1111111119389534,
120
+ 0.1111111119389534,
121
+ 0.1111111119389534,
122
+ 0.0,
123
+ 0.0,
124
+ 0.0,
125
+ 0.0,
126
+ 0.0,
127
+ 0.0,
128
+ 0.0,
129
+ 0.0,
130
+ 0.0,
131
+ 0.0
132
+ ],
133
+ [
134
+ 0.0,
135
+ 0.0,
136
+ 0.0,
137
+ 0.0,
138
+ 0.0,
139
+ 0.0,
140
+ 0.0,
141
+ 0.0,
142
+ 0.0,
143
+ 0.0,
144
+ 0.0,
145
+ 0.0,
146
+ 0.0,
147
+ 0.0,
148
+ 0.0714285746216774,
149
+ 0.0714285746216774,
150
+ 0.0714285746216774,
151
+ 0.0714285746216774,
152
+ 0.0714285746216774,
153
+ 0.0714285746216774,
154
+ 0.0714285746216774,
155
+ 0.0,
156
+ 0.0714285746216774,
157
+ 0.0714285746216774,
158
+ 0.0714285746216774,
159
+ 0.0714285746216774,
160
+ 0.0714285746216774,
161
+ 0.0714285746216774,
162
+ 0.0714285746216774,
163
+ 0.0,
164
+ 0.0,
165
+ 0.0,
166
+ 0.0,
167
+ 0.0,
168
+ 0.0,
169
+ 0.0,
170
+ 0.0,
171
+ 0.0,
172
+ 0.0,
173
+ 0.0,
174
+ 0.0,
175
+ 0.0,
176
+ 0.0,
177
+ 0.0,
178
+ 0.0,
179
+ 0.0,
180
+ 0.0,
181
+ 0.0,
182
+ 0.0,
183
+ 0.0,
184
+ 0.0,
185
+ 0.0,
186
+ 0.0,
187
+ 0.0,
188
+ 0.0,
189
+ 0.0,
190
+ 0.0,
191
+ 0.0
192
+ ],
193
+ [
194
+ 0.0714285746216774,
195
+ 0.0714285746216774,
196
+ 0.0714285746216774,
197
+ 0.0714285746216774,
198
+ 0.0714285746216774,
199
+ 0.0714285746216774,
200
+ 0.0714285746216774,
201
+ 0.0714285746216774,
202
+ 0.0714285746216774,
203
+ 0.0714285746216774,
204
+ 0.0714285746216774,
205
+ 0.0714285746216774,
206
+ 0.0714285746216774,
207
+ 0.0714285746216774,
208
+ 0.0,
209
+ 0.0,
210
+ 0.0,
211
+ 0.0,
212
+ 0.0,
213
+ 0.0,
214
+ 0.0,
215
+ 0.0,
216
+ 0.0,
217
+ 0.0,
218
+ 0.0,
219
+ 0.0,
220
+ 0.0,
221
+ 0.0,
222
+ 0.0,
223
+ 0.0,
224
+ 0.0,
225
+ 0.0,
226
+ 0.0,
227
+ 0.0,
228
+ 0.0,
229
+ 0.0,
230
+ 0.0,
231
+ 0.0,
232
+ 0.0,
233
+ 0.0,
234
+ 0.0,
235
+ 0.0,
236
+ 0.0,
237
+ 0.0,
238
+ 0.0,
239
+ 0.0,
240
+ 0.0,
241
+ 0.0,
242
+ 0.0,
243
+ 0.0,
244
+ 0.0,
245
+ 0.0,
246
+ 0.0,
247
+ 0.0,
248
+ 0.0,
249
+ 0.0,
250
+ 0.0,
251
+ 0.0
252
+ ],
253
+ [
254
+ 0.0,
255
+ 0.0,
256
+ 0.0,
257
+ 0.0,
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 0.0,
262
+ 0.0,
263
+ 0.0,
264
+ 0.0,
265
+ 0.0,
266
+ 0.0,
267
+ 0.0,
268
+ 0.0,
269
+ 0.0,
270
+ 0.0,
271
+ 0.0,
272
+ 0.0,
273
+ 0.0,
274
+ 0.0,
275
+ 0.0,
276
+ 0.0,
277
+ 0.0,
278
+ 0.0,
279
+ 0.0,
280
+ 0.0,
281
+ 0.0,
282
+ 0.0,
283
+ 0.0,
284
+ 0.0,
285
+ 0.0,
286
+ 0.0,
287
+ 0.0,
288
+ 0.0,
289
+ 0.0,
290
+ 0.0,
291
+ 0.0,
292
+ 0.0,
293
+ 0.125,
294
+ 0.125,
295
+ 0.125,
296
+ 0.125,
297
+ 0.0,
298
+ 0.0,
299
+ 0.0,
300
+ 0.0,
301
+ 0.0,
302
+ 0.125,
303
+ 0.125,
304
+ 0.125,
305
+ 0.0,
306
+ 0.0,
307
+ 0.0,
308
+ 0.0,
309
+ 0.125,
310
+ 0.0,
311
+ 0.0
312
+ ],
313
+ [
314
+ 0.0,
315
+ 0.0,
316
+ 0.0,
317
+ 0.0,
318
+ 0.0,
319
+ 0.0,
320
+ 0.0,
321
+ 0.0,
322
+ 0.0,
323
+ 0.0,
324
+ 0.0,
325
+ 0.0,
326
+ 0.0,
327
+ 0.0,
328
+ 0.0,
329
+ 0.0,
330
+ 0.0,
331
+ 0.0,
332
+ 0.0,
333
+ 0.0,
334
+ 0.0,
335
+ 0.0,
336
+ 0.0,
337
+ 0.0,
338
+ 0.0,
339
+ 0.0,
340
+ 0.0,
341
+ 0.0,
342
+ 0.0,
343
+ 0.0,
344
+ 0.0,
345
+ 0.0,
346
+ 0.0,
347
+ 0.0,
348
+ 0.0,
349
+ 0.0,
350
+ 0.0,
351
+ 0.0,
352
+ 0.0,
353
+ 0.0,
354
+ 0.0,
355
+ 0.0,
356
+ 0.0,
357
+ 0.0,
358
+ 0.125,
359
+ 0.125,
360
+ 0.125,
361
+ 0.125,
362
+ 0.0,
363
+ 0.0,
364
+ 0.0,
365
+ 0.0,
366
+ 0.125,
367
+ 0.125,
368
+ 0.125,
369
+ 0.0,
370
+ 0.0,
371
+ 0.125
372
+ ]
373
+ ],
374
+ "clinical_envelope": true,
375
+ "temporal_pool": true,
376
+ "temporal_evidence": true,
377
+ "evidence_temperature": 0.25,
378
+ "random_fourier": true,
379
+ "fourier_features": 256,
380
+ "tangent_readout": true,
381
+ "shared_context_correction": true,
382
+ "wave_coactivation": true,
383
+ "ordinal_context": true,
384
+ "phase_coherence": true,
385
+ "cross_frequency": true,
386
+ "cbramod_feature_transfer": true,
387
+ "student_architecture": {
388
+ "virtual_channels": 32,
389
+ "token_width": 64,
390
+ "summary_width": 256,
391
+ "head_width": 128,
392
+ "dropout": 0.3
393
+ },
394
+ "student_extension": true,
395
+ "post_embedding_extension": true,
396
+ "extension_activation": "identity",
397
+ "center_context_extension": true,
398
+ "context_crop": "center",
399
+ "short_context_extension": true,
400
+ "short_crop": "first",
401
+ "dual_context_extension": true,
402
+ "dual_crop": "clinical-dual",
403
+ "geometry_extension": true,
404
+ "geometry_mode": "mi-linear",
405
+ "emotion_extension": true,
406
+ "emotion_mode": "faced-log"
407
+ },
408
+ "initialization": {
409
+ "initialization": "continue joint training from a complete shared-model checkpoint",
410
+ "parent": "/workspace/research/runs/hybrid_biot_fusionshrink0100/epoch-001/weights.pt",
411
+ "parent_initialization": {
412
+ "initialization": "jointly trained parent plus audited pretrained BIOT in a single coupled backbone",
413
+ "parent": "/workspace/research/runs/hybrid_wide1/epoch-004/weights.pt",
414
+ "audited_biot": {
415
+ "initialization": "pretrained",
416
+ "repo": "braindecode/biot-pretrained-six-datasets-18chs",
417
+ "revision": "7e9aabf302870012f73773276803aab97993951c",
418
+ "sha256": "a218f4054ae29962c6fd9d23d94c446d354c4f53e805a6771c85749ccc20baaa",
419
+ "license": "BSD-3-Clause",
420
+ "source_braindecode": "1.3.0",
421
+ "loaded_core_tensors": 56,
422
+ "skipped_classifier_tensors": 3
423
+ },
424
+ "neural_channel_indices": {
425
+ "faced": [
426
+ 0,
427
+ 1,
428
+ 2,
429
+ 3,
430
+ 4,
431
+ 5,
432
+ 6,
433
+ 7,
434
+ 8,
435
+ 9,
436
+ 10,
437
+ 11,
438
+ 12,
439
+ 13,
440
+ 14,
441
+ 15,
442
+ 16,
443
+ 17
444
+ ],
445
+ "tuev": [
446
+ 0,
447
+ 1,
448
+ 2,
449
+ 3,
450
+ 4,
451
+ 5,
452
+ 6,
453
+ 7,
454
+ 8,
455
+ 9,
456
+ 10,
457
+ 11,
458
+ 12,
459
+ 13,
460
+ 14,
461
+ 15
462
+ ],
463
+ "ad65": [
464
+ 0,
465
+ 1,
466
+ 2,
467
+ 3,
468
+ 4,
469
+ 5,
470
+ 6,
471
+ 7,
472
+ 8,
473
+ 9,
474
+ 10,
475
+ 11,
476
+ 12,
477
+ 13,
478
+ 14,
479
+ 15,
480
+ 16,
481
+ 17
482
+ ],
483
+ "openbmi": [
484
+ 0,
485
+ 1,
486
+ 3,
487
+ 5,
488
+ 12,
489
+ 14,
490
+ 23,
491
+ 25,
492
+ 28,
493
+ 30,
494
+ 2,
495
+ 6,
496
+ 11,
497
+ 15,
498
+ 22,
499
+ 26,
500
+ 4,
501
+ 13
502
+ ],
503
+ "longitudinal": [
504
+ 0,
505
+ 2,
506
+ 7,
507
+ 11,
508
+ 23,
509
+ 27,
510
+ 41,
511
+ 45,
512
+ 55,
513
+ 57,
514
+ 5,
515
+ 13,
516
+ 21,
517
+ 29,
518
+ 39,
519
+ 47,
520
+ 9,
521
+ 25
522
+ ]
523
+ },
524
+ "rebase": "incumbent waveform, fusion and four heads; joint BIOT and TUEV head from readout epoch 9; zero initialized neural interaction",
525
+ "jointly_finetuned_neural_parent": "/workspace/research/runs/hybrid_biot_readout1/epoch-009/weights.pt",
526
+ "tuev_high_dimensional_spectral_projection_disabled": true,
527
+ "frozen_prior_representation": true,
528
+ "nonclinical_head_updates": "only the 256 added BIOT columns; original columns and biases fixed",
529
+ "faced_openbmi_neural_path": "common nonlinear fusion only; direct head columns masked",
530
+ "retention_teacher": "/workspace/research/runs/hybrid_wide1/epoch-004",
531
+ "retention_loss": {
532
+ "split": "train",
533
+ "temperature": 2.0,
534
+ "kl_weight": 1.0,
535
+ "tracks": [
536
+ "faced",
537
+ "ad65",
538
+ "openbmi",
539
+ "longitudinal"
540
+ ]
541
+ }
542
+ },
543
+ "joint_covariance_parent": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
544
+ "frozen_prior_representation": true,
545
+ "head_updates": "one linear head per track; added 128 shared covariance columns trainable; AD head initialized from the joint covariance parent",
546
+ "new_shared_representation": "one common covariance MLP inside the coupled backbone, trained by all five tasks; fixed spatial input adapters from the same jointly trained source",
547
+ "head_arithmetic": "one linear head evaluated in fixed feature blocks to preserve original bfloat16 accumulation dimensions",
548
+ "retention_teacher": {
549
+ "ad65": "/workspace/research/runs/filterbank1/epoch-002/weights.pt",
550
+ "other_tracks": "/workspace/research/runs/hybrid_wide1/epoch-004"
551
+ },
552
+ "retention_loss": {
553
+ "split": "train",
554
+ "temperature": 2.0,
555
+ "kl_weight": 1.0,
556
+ "tracks": [
557
+ "faced",
558
+ "ad65",
559
+ "openbmi",
560
+ "longitudinal"
561
+ ]
562
+ }
563
+ },
564
+ "loader_scale": 0.01,
565
+ "tracks": [
566
+ "faced",
567
+ "tuev",
568
+ "ad65",
569
+ "openbmi",
570
+ "longitudinal"
571
+ ],
572
+ "head_arithmetic": "same linear head in fixed feature blocks, sum in bfloat16 on GPU for non-AD tracks; AD remains float32",
573
+ "head_refinement": {
574
+ "source": "/workspace/research/runs/residual_heads1/epoch-018",
575
+ "source_weights_sha256": "e0b609137391b47f99438ccadaa22fc0bc10d2c10ead0ddf0a3c25be2c907c85",
576
+ "shared_backbone_unchanged": true,
577
+ "selected_head_epochs": {
578
+ "faced": 5,
579
+ "tuev": 24,
580
+ "ad65": 0,
581
+ "openbmi": 0,
582
+ "longitudinal": 0
583
+ }
584
+ },
585
+ "clinical_spectral_refinement": {
586
+ "source": "/workspace/research/runs/head_dropout1/epoch-016",
587
+ "zero_initialized_input_adapter": true,
588
+ "backbone_unchanged": true
589
+ },
590
+ "head_estimation": {
591
+ "method": "class/subject-balanced Gaussian linear discriminant; covariance augmented by class-conditional subject/session mean variation before shrinkage",
592
+ "selected_shrinkage": {
593
+ "faced": "inherited",
594
+ "tuev": "inherited",
595
+ "ad65": "inherited",
596
+ "openbmi": "inherited",
597
+ "longitudinal": {
598
+ "shrinkage": 0.9,
599
+ "domain_strength": 1.0
600
+ }
601
+ },
602
+ "feature_scaling": "fitted on training data and folded into linear coefficients"
603
+ },
604
+ "clinical_asymmetry_refinement": {
605
+ "source": "/workspace/research/runs/domain_lda_heads1/epoch-001",
606
+ "zero_initialized_input_adapter": true,
607
+ "backbone_unchanged": true
608
+ },
609
+ "alpha_rhythm_adapter": {
610
+ "training_normalization_only": true,
611
+ "regions": [
612
+ "occipital",
613
+ "parietal",
614
+ "central",
615
+ "frontal",
616
+ "left_posterior",
617
+ "right_posterior"
618
+ ],
619
+ "features": "per-window alpha prominence relative to adjacent frequencies",
620
+ "shared_backbone_unchanged": true
621
+ },
622
+ "clinical_envelope_refinement": {
623
+ "source": "/workspace/research/runs/clinical_asymmetry1/epoch-001",
624
+ "zero_initialized_input_adapter": true,
625
+ "backbone_unchanged": true
626
+ },
627
+ "independent_adapter_merge": {
628
+ "alpha_source": "/workspace/research/runs/alpha_calibrated1/epoch-003",
629
+ "clinical_source": "/workspace/research/runs/clinical_envelope1/epoch-002",
630
+ "all_shared_and_head_tensors_equal": true
631
+ },
632
+ "frequency_montage_refinement": {
633
+ "six_frequency_bands": true,
634
+ "shared_encoder_unchanged": true,
635
+ "selected_track_epochs": {
636
+ "faced": 0,
637
+ "tuev": 1,
638
+ "ad65": 0,
639
+ "openbmi": 10,
640
+ "longitudinal": 2
641
+ }
642
+ },
643
+ "private_track_selection": {
644
+ "track": "tuev",
645
+ "donor": "/workspace/research/replicates/frequency_head_control1/epoch-001"
646
+ },
647
+ "clinical_sampling_refinement": {
648
+ "subject_exponent": 0.0,
649
+ "class_balanced": true,
650
+ "only_clinical_head_updated": true
651
+ },
652
+ "temporal_statistics_readout": {
653
+ "statistics": [
654
+ "mean",
655
+ "standard deviation",
656
+ "maximum",
657
+ "minimum"
658
+ ],
659
+ "shared_encoder_and_prior_heads_unchanged": true,
660
+ "selected_pool_epochs": {
661
+ "faced": 2,
662
+ "tuev": 0,
663
+ "ad65": 0,
664
+ "openbmi": 33,
665
+ "longitudinal": 3
666
+ }
667
+ },
668
+ "temporal_evidence_readout": {
669
+ "pooling": "log mean exp of per-patch class evidence",
670
+ "temperature": 0.25,
671
+ "shared_encoder_and_prior_heads_unchanged": true,
672
+ "selected_evidence_epochs": {
673
+ "faced": 0,
674
+ "tuev": 0,
675
+ "ad65": 0,
676
+ "openbmi": 6,
677
+ "longitudinal": 8
678
+ }
679
+ },
680
+ "fourier_basis_readout": {
681
+ "basis_functions": 256,
682
+ "bandwidths": [
683
+ 0.5,
684
+ 1.0,
685
+ 2.0
686
+ ],
687
+ "shared_encoder_and_prior_heads_unchanged": true,
688
+ "selected_fourier_epochs": {
689
+ "faced": 21,
690
+ "tuev": 0,
691
+ "ad65": 0,
692
+ "openbmi": 0,
693
+ "longitudinal": 2
694
+ }
695
+ },
696
+ "shared_tangent_readout": {
697
+ "one_shared_tangent_module": true,
698
+ "original_and_corrected_shared_features_retained": true,
699
+ "private_head_scalar_gains": {
700
+ "faced": 0.0,
701
+ "tuev": 0.1,
702
+ "ad65": 0.0,
703
+ "openbmi": 1.0,
704
+ "longitudinal": 0.1
705
+ },
706
+ "all_common_weights_fixed_during_gain_refinement": true
707
+ },
708
+ "shared_context_correction": {
709
+ "source": "/workspace/research/runs/hybrid_codebrain_fusion_control1/epoch-002",
710
+ "zero_token_input_preserved": true,
711
+ "unused_native_CodeBrain_core_and_input_parameters_removed": true,
712
+ "common_patch_and_context_layers_retained": true,
713
+ "same_one_shared_backbone_and_five_classifiers": true
714
+ },
715
+ "shared_wave_coactivation": {
716
+ "channels": 64,
717
+ "statistics": 2080,
718
+ "diagonal_only_control": false,
719
+ "common_encoder_updated_by_all_five_tracks": true,
720
+ "gain_selection_within_one_common_checkpoint": {
721
+ "faced": 1.0,
722
+ "tuev": 0.0,
723
+ "ad65": 0.0,
724
+ "openbmi": 1.0,
725
+ "longitudinal": 1.0
726
+ }
727
+ },
728
+ "fixed_common_coactivation_readouts": {
729
+ "all_common_weights_exactly_unchanged": true,
730
+ "selected_private_epochs": {
731
+ "faced": 25,
732
+ "tuev": 0,
733
+ "ad65": 0,
734
+ "openbmi": 8,
735
+ "longitudinal": 2
736
+ }
737
+ },
738
+ "shared_ordinal_context": {
739
+ "per_channel_features": 130,
740
+ "normalization_fit_on_training_only": true,
741
+ "entropy_only_control": false,
742
+ "new_common_layers_trained_on_all_five_tracks": true,
743
+ "gains_within_one_common_checkpoint": {
744
+ "faced": 1.0,
745
+ "tuev": 0.0,
746
+ "ad65": 0.0,
747
+ "openbmi": 1.0,
748
+ "longitudinal": 0.0
749
+ }
750
+ },
751
+ "shared_complex_coherence": {
752
+ "features": 5520,
753
+ "normalization_fit_on_training_only": true,
754
+ "real_only_control": false,
755
+ "all_five_tracks_update_common_encoder": true,
756
+ "gains_within_one_common_checkpoint": {
757
+ "faced": 0.1,
758
+ "tuev": 1.0,
759
+ "ad65": 0.0,
760
+ "openbmi": 0.3,
761
+ "longitudinal": 0.0
762
+ }
763
+ },
764
+ "shared_cross_frequency": {
765
+ "per_channel_features": 30,
766
+ "normalization_fit_on_training_only": true,
767
+ "amplitude_only_control": false,
768
+ "all_five_tracks_update_common_encoder": true,
769
+ "gains_within_one_common_checkpoint": {
770
+ "faced": 0.3,
771
+ "tuev": 0.1,
772
+ "ad65": 0.0,
773
+ "openbmi": 0.0,
774
+ "longitudinal": 0.0
775
+ }
776
+ },
777
+ "inherited_private_readout_refresh": {
778
+ "child": "/workspace/research/runs/coupling_patient1/epoch-007",
779
+ "donor": "/workspace/research/runs/phase_readout1/epoch-016",
780
+ "common_ancestor": "/workspace/research/runs/phase_coherence1/epoch-007",
781
+ "source_weight_sha256": {
782
+ "child": "f8466c6838ff01e54d1619f55668c1a4af26a243b54c67a956a3422d9604632a",
783
+ "donor": "ffd219d1480b81720b5aa4014cb2ed2b9cd31b7c92ad4717abc2a9625d30dc1a",
784
+ "ancestor": "e53ede409be523d8f4746251f7d46353621049f0378a88d4f7cfe2ba71a57d95"
785
+ },
786
+ "changed_private_tensors": [
787
+ "heads.openbmi.prior.projection.weight",
788
+ "heads.openbmi.prior.projection.bias"
789
+ ],
790
+ "all_ancestor_common_and_input_tensors_equal": true,
791
+ "all_child_common_and_input_tensors_unchanged": true,
792
+ "new_branch_gain_for_refreshed_track": 0.0,
793
+ "donor_changes_only_requested_private_projection": true,
794
+ "prediction_sources": {
795
+ "faced": {
796
+ "source": "/workspace/research/runs/coupling_patient1/faced-e007.npy",
797
+ "sha256": "68b617c8ecf347c79b23c20b70f6b4981c2f26b7b8c71dc7cd5fa0d7f4285ea6"
798
+ },
799
+ "tuev": {
800
+ "source": "/workspace/research/runs/coupling_patient1/tuev-e007.npy",
801
+ "sha256": "9f0743450f1104d395e9daac0600aaf20755b5590b9f5c3e3137732c479dd647"
802
+ },
803
+ "ad65": {
804
+ "source": "/workspace/research/runs/coupling_patient1/ad65-e007.npy",
805
+ "sha256": "7a3b74c58580b7ba952322bf6d527ebc9a40a6e04c7cdbbaea14e84a7a298d54"
806
+ },
807
+ "openbmi": {
808
+ "source": "/workspace/research/runs/phase_readout1/openbmi-e016.npy",
809
+ "sha256": "14f630543e1df88c88d8f3e0effb4506ba33f533b3484de3c7aaf6554507341c"
810
+ },
811
+ "longitudinal": {
812
+ "source": "/workspace/research/runs/coupling_patient1/longitudinal-e007.npy",
813
+ "sha256": "e93b0a319eaa3ddca9d71b0e786b808ba1630c1d3ce125f8e08036e517741b74"
814
+ }
815
+ }
816
+ },
817
+ "shared_student_residual": {
818
+ "dimension": 8448,
819
+ "summary_dimension": 256,
820
+ "ordered_time_bins": 4,
821
+ "student_weights_sha256": "19dfe912cceed997699b5b526c8c2ece55945c5f9bd111c4c13704d0fc460e8b",
822
+ "summary_only_control": false,
823
+ "normalization_fit_on_training_only": true,
824
+ "new_common_readout_jointly_trained_on_all_five": true,
825
+ "class_projection_initialized_zero": true,
826
+ "student_classifiers_discarded": true,
827
+ "gains_within_one_common_checkpoint": {
828
+ "faced": 1.0,
829
+ "tuev": 0.0,
830
+ "ad65": 0.0,
831
+ "openbmi": 1.0,
832
+ "longitudinal": 1.0
833
+ },
834
+ "zero_gain_preserves_complete_parent": true
835
+ },
836
+ "private_head_refresh": {
837
+ "reference": "/workspace/research/pilots/short_private_pilot1/epoch-001",
838
+ "donor": "/workspace/research/runs/short_private1/epoch-030",
839
+ "track": "tuev",
840
+ "source_sha256": {
841
+ "reference": "afacd7c1a4f7329c01148a17a7a2ca15b8db3c6b38446f40fb92e58eb7d64ef2",
842
+ "donor": "f060de6d5bf41c8e332ae8cc58cdf7dfa5ea98ab610ef2b4fdc3d00eae4929e6"
843
+ },
844
+ "changed_private_tensors": [
845
+ "heads.tuev.correction_gain",
846
+ "heads.tuev.projection.weight",
847
+ "heads.tuev.projection.bias"
848
+ ],
849
+ "all_common_input_and_prior_head_tensors_exactly_equal": true,
850
+ "executable_code_and_architecture_exactly_equal": true,
851
+ "one_common_checkpoint": true,
852
+ "prediction_sources": {
853
+ "faced": "/workspace/research/pilots/short_private_pilot1/faced-e001.npy",
854
+ "tuev": "/workspace/research/runs/short_private1/tuev-e030.npy",
855
+ "ad65": "/workspace/research/pilots/short_private_pilot1/ad65-e001.npy",
856
+ "openbmi": "/workspace/research/pilots/short_private_pilot1/openbmi-e001.npy",
857
+ "longitudinal": "/workspace/research/pilots/short_private_pilot1/longitudinal-e001.npy"
858
+ }
859
+ },
860
+ "shared_student_extension_residual": {
861
+ "dimension": 128,
862
+ "input_representation": "fixed jointly trained common student embedding",
863
+ "activation": "identity",
864
+ "student_weights_sha256": "19dfe912cceed997699b5b526c8c2ece55945c5f9bd111c4c13704d0fc460e8b",
865
+ "summary_only_control": false,
866
+ "normalization_fit_on_training_only": true,
867
+ "new_common_readout_jointly_trained_on_all_five": true,
868
+ "class_projection_initialized_zero": true,
869
+ "student_classifiers_discarded": true,
870
+ "gains_within_one_common_checkpoint": {
871
+ "faced": 0.30000001192092896,
872
+ "tuev": 0.0,
873
+ "ad65": 0.0,
874
+ "openbmi": 0.30000001192092896,
875
+ "longitudinal": 0.30000001192092896
876
+ },
877
+ "zero_gain_preserves_complete_parent": true
878
+ },
879
+ "fixed_common_embedding_readouts": {
880
+ "all_common_weights_exactly_unchanged": true,
881
+ "selected_private_epochs": {
882
+ "faced": 0,
883
+ "tuev": 0,
884
+ "ad65": 0,
885
+ "openbmi": 0,
886
+ "longitudinal": 1
887
+ }
888
+ },
889
+ "shared_center_context_residual": {
890
+ "dimension": 128,
891
+ "crop": "center",
892
+ "samples": 400,
893
+ "sample_rate": 200,
894
+ "feature_types": [
895
+ "spectral",
896
+ "cross_frequency_coupling"
897
+ ],
898
+ "normalization_fit_on_training_only": true,
899
+ "new_common_block_jointly_trained_on_all_five": true,
900
+ "class_projection_initialized_zero": true,
901
+ "gains_within_one_common_checkpoint": {
902
+ "faced": 0.10000000149011612,
903
+ "tuev": 0.30000001192092896,
904
+ "ad65": 0.0,
905
+ "openbmi": 0.0,
906
+ "longitudinal": 1.0
907
+ },
908
+ "zero_gain_preserves_complete_parent": true
909
+ },
910
+ "private_input_head_refresh": {
911
+ "reference": "/workspace/research/sources/emotion_private_input_source",
912
+ "donor": "/workspace/research/runs/emotion_input_adapt_full1/epoch-001",
913
+ "track": "longitudinal",
914
+ "source_sha256": {
915
+ "reference": "90904cd9b33d59b1ed531dcda90f95b9dce3e59661187242b6b26a06daba6d04",
916
+ "donor": "b4a858b3dab746a6600aa1fd194e7cc42b277fd11eb07d8561aff980f3a26b9d"
917
+ },
918
+ "changed_private_tensors": [
919
+ "adapters.longitudinal.emotion_projection.weight",
920
+ "adapters.longitudinal.emotion_projection.bias",
921
+ "heads.longitudinal.correction_gain",
922
+ "heads.longitudinal.projection.weight",
923
+ "heads.longitudinal.projection.bias"
924
+ ],
925
+ "all_common_old_input_normalizer_and_prior_head_tensors_exactly_equal": true,
926
+ "executable_code_and_architecture_exactly_equal": true,
927
+ "one_common_checkpoint": true,
928
+ "prediction_sources": {
929
+ "faced": "/workspace/research/runs/emotion_geometry_log_full1/faced-e002.npy",
930
+ "tuev": "/workspace/research/runs/emotion_geometry_log_full1/tuev-e002.npy",
931
+ "ad65": "/workspace/research/runs/emotion_geometry_log_full1/ad65-e002.npy",
932
+ "openbmi": "/workspace/research/runs/emotion_geometry_log_full1/openbmi-e002.npy",
933
+ "longitudinal": "/workspace/research/runs/emotion_input_adapt_full1/longitudinal-e001.npy"
934
+ }
935
+ },
936
+ "shared_short_context_residual": {
937
+ "dimension": 128,
938
+ "crop": "first",
939
+ "samples": 200,
940
+ "sample_rate": 200,
941
+ "feature_types": [
942
+ "spectral",
943
+ "cross_frequency_coupling"
944
+ ],
945
+ "normalization_fit_on_training_only": true,
946
+ "new_common_block_jointly_trained_on_all_five": true,
947
+ "class_projection_initialized_zero": true,
948
+ "gains_within_one_common_checkpoint": {
949
+ "faced": 0.30000001192092896,
950
+ "tuev": 0.30000001192092896,
951
+ "ad65": 0.0,
952
+ "openbmi": 0.0,
953
+ "longitudinal": 0.30000001192092896
954
+ },
955
+ "zero_gain_preserves_complete_parent": true
956
+ },
957
+ "shared_dual_context_residual": {
958
+ "dimension": 128,
959
+ "crop": "clinical-dual",
960
+ "samples_per_view": 200,
961
+ "clinical_views": 2,
962
+ "other_track_views": 1,
963
+ "sample_rate": 200,
964
+ "feature_types": [
965
+ "spectral",
966
+ "cross_frequency_coupling"
967
+ ],
968
+ "normalization_fit_on_training_only": true,
969
+ "new_common_block_jointly_trained_on_all_five": true,
970
+ "class_projection_initialized_zero": true,
971
+ "gains_within_one_common_checkpoint": {
972
+ "faced": 0.0,
973
+ "tuev": 0.0,
974
+ "ad65": 0.0,
975
+ "openbmi": 0.0,
976
+ "longitudinal": 1.0
977
+ },
978
+ "zero_gain_preserves_complete_parent": true
979
+ },
980
+ "shared_geometry_residual": {
981
+ "dimension": 128,
982
+ "mode": "mi-linear",
983
+ "motor_native_covariance_bands": 7,
984
+ "motor_channels": 62,
985
+ "motor_input_dimension": 13671,
986
+ "motor_covariance_shrinkage": 0.05,
987
+ "other_track_crop": "first1s",
988
+ "normalization_fit_on_training_only": true,
989
+ "new_common_block_jointly_trained_on_all_five": true,
990
+ "class_projection_initialized_zero": true,
991
+ "gains_within_one_common_checkpoint": {
992
+ "faced": 0.0,
993
+ "tuev": 0.0,
994
+ "ad65": 0.0,
995
+ "openbmi": 0.0,
996
+ "longitudinal": 1.0
997
+ },
998
+ "zero_gain_preserves_complete_parent": true
999
+ },
1000
+ "fixed_common_geometry_input_readouts": {
1001
+ "all_common_weights_exactly_unchanged": true,
1002
+ "input_lr": 1e-05,
1003
+ "class_projection_lr": 0.0003,
1004
+ "selected_private_epochs": {
1005
+ "faced": 0,
1006
+ "tuev": 0,
1007
+ "ad65": 0,
1008
+ "openbmi": 0,
1009
+ "longitudinal": 1
1010
+ },
1011
+ "separate_input_and_class_gradient_clipping": 1.0
1012
+ },
1013
+ "shared_emotion_residual": {
1014
+ "dimension": 128,
1015
+ "mode": "faced-log",
1016
+ "emotion_native_covariance_bands": 7,
1017
+ "emotion_channels": 32,
1018
+ "emotion_input_dimension": 3696,
1019
+ "emotion_covariance_shrinkage": 0.05,
1020
+ "other_track_crop": "first1s",
1021
+ "normalization_fit_on_training_only": true,
1022
+ "new_common_block_jointly_trained_on_all_five": true,
1023
+ "class_projection_initialized_zero": true,
1024
+ "gains_within_one_common_checkpoint": {
1025
+ "faced": 0.0,
1026
+ "tuev": 0.0,
1027
+ "ad65": 0.0,
1028
+ "openbmi": 1.0,
1029
+ "longitudinal": 0.10000000149011612
1030
+ },
1031
+ "zero_gain_preserves_complete_parent": true
1032
+ }
1033
+ }
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/coupling_features.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Per-window cross-frequency envelope and phase-amplitude relationships."""
2
+ import torch
3
+ BANDS=((1,4),(4,8),(8,13),(13,30),(30,48))
4
+ PAIRS=tuple((i,j) for i in range(5) for j in range(i+1,5))
5
+ PER_CHANNEL=30
6
+
7
+ @torch.no_grad()
8
+ def coupling_features(track,x):
9
+ with torch.autocast(x.device.type,enabled=False):
10
+ x=torch.nan_to_num(x.float().flatten(2),nan=0.,posinf=1e5,neginf=-1e5).clamp(-1e5,1e5)
11
+ x=x-x.mean(-1,keepdim=True)
12
+ if track in ('ad65','openbmi','longitudinal'):x=x-x.mean(1,keepdim=True)
13
+ x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
14
+ n=x.shape[-1];spectrum=torch.fft.fft(x,dim=-1);frequency=torch.fft.fftfreq(n,1/200,device=x.device)
15
+ masks=torch.stack([2*((frequency>=lo)&(frequency<hi)).float() for lo,hi in BANDS])
16
+ analytic=torch.fft.ifft(spectrum[:,:,None]*masks[None,None],dim=-1)
17
+ amplitude=analytic.abs();unit_phase=analytic/amplitude.clamp_min(1e-3)
18
+ weight=torch.hann_window(n,device=x.device);weight=weight/weight.sum()
19
+ mean=(amplitude*weight).sum(-1);centered=amplitude-mean[...,None]
20
+ variance=(centered.square()*weight).sum(-1)
21
+ # Relative and absolute floors avoid normalizing numerical silence after unit-RMS scaling.
22
+ deviation=variance.sqrt()
23
+ stable_deviation=torch.maximum(deviation,.01*mean).clamp_min(1e-3)
24
+ normalized=centered/stable_deviation[...,None]
25
+ power=(amplitude.square()*weight).sum(-1)
26
+ relative=(power/power.sum(-1,keepdim=True).clamp_min(1e-12)).clamp_min(1e-6).log()
27
+ cv=(deviation/mean.clamp_min(1e-3)).clamp(0,10)
28
+ envelopes=[];phase_amplitude=[]
29
+ for low,high in PAIRS:
30
+ correlation=(normalized[:,:,low]*normalized[:,:,high]*weight).sum(-1)
31
+ envelopes.append(torch.atanh(correlation.clamp(-.999,.999)))
32
+ coupling=(normalized[:,:,high]*unit_phase[:,:,low]*weight).sum(-1).abs()
33
+ phase_amplitude.append(coupling.clamp(0,.999))
34
+ return torch.cat([relative,cv,torch.stack(envelopes,-1),torch.stack(phase_amplitude,-1)],-1).flatten(1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/covariances.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared neural filter-bank covariance decoder with spatial input adapters."""
2
+ import torch
3
+ from torch import nn
4
+ SPECS={'faced':(32,10,9),'tuev':(16,5,6),'ad65':(19,10,3),'openbmi':(62,4,2),'longitudinal':(58,2,2)}
5
+ TRACKS=tuple(SPECS)
6
+ BANDS=[(1,4),(4,8),(8,12),(12,16),(16,20),(20,24),(24,28),(28,32),(32,40),(40,48)]
7
+
8
+ @torch.no_grad()
9
+ def extract_covariances(t,x):
10
+ x=torch.nan_to_num(x.float().flatten(2)).clamp(-1e5,1e5)
11
+ x=x-x.mean(-1,keepdim=True)
12
+ if t in ('faced','tuev'):
13
+ x=x/x.square().mean(-1,keepdim=True).clamp_min(1e-12).sqrt()
14
+ else:x=x-x.mean(1,keepdim=True)
15
+ # Per-window normalization, preserving spatial and frequency power ratios.
16
+ x=x/x.square().mean((1,2),keepdim=True).clamp_min(1e-12).sqrt()
17
+ frames=x.unfold(-1,400,200);frames=frames-frames.mean(-1,keepdim=True)
18
+ z=torch.fft.rfft(frames*torch.hann_window(400,device=x.device),dim=-1)/200
19
+ covs=[]
20
+ for lo,hi in BANDS:
21
+ v=z[...,2*lo:2*hi].flatten(2)
22
+ cov=(v.real@v.real.transpose(-1,-2)+v.imag@v.imag.transpose(-1,-2))/v.shape[-1]
23
+ covs.append(cov)
24
+ return torch.stack(covs,1)
25
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/data.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from functools import lru_cache
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ @lru_cache(maxsize=8)
7
+ def array(path):return np.load(path,mmap_mode='r',allow_pickle=False)
8
+ class Dataset(torch.utils.data.Dataset):
9
+ def __init__(self,root,limit=None,cache=False):
10
+ self.root=Path(root)
11
+ self.rows=json.loads((self.root/'manifest.json').read_text())['samples']
12
+ if limit:self.rows=self.rows[:limit]
13
+ self.cached=None
14
+ if cache and self.rows:
15
+ from collections import defaultdict
16
+ groups=defaultdict(list)
17
+ for i,r in enumerate(self.rows):groups[r['path']].append((i,r['index']))
18
+ for name,indices in groups.items():
19
+ path=(self.root/name).resolve()
20
+ if not path.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
21
+ source=np.load(path,mmap_mode='r',allow_pickle=False)
22
+ if self.cached is None:self.cached=torch.empty((len(self.rows),*source.shape[1:]),dtype=torch.float32)
23
+ dst,src=zip(*indices)
24
+ self.cached[list(dst)]=torch.as_tensor(source[list(src)]/100,dtype=torch.float32)
25
+ def __len__(self):return len(self.rows)
26
+ def __getitem__(self,i):
27
+ r=self.rows[i]
28
+ if self.cached is not None:return self.cached[i],r.get('label',-1),r['id']
29
+ p=(self.root/r['path']).resolve()
30
+ if not p.is_relative_to(self.root.resolve()):raise ValueError('input outside root')
31
+ # Division precedes float32 conversion, matching official FACED/TUEV collate.
32
+ x=np.asarray(array(str(p))[r['index']])/100
33
+ return torch.as_tensor(x,dtype=torch.float32),r.get('label',-1),r['id']
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/envelope_features.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Per-window burst-envelope regularity and bilateral synchrony, without fitting."""
2
+ import torch
3
+ import torch.nn.functional as F
4
+
5
+ BANDS=((1,4),(4,8),(8,13),(13,30),(30,45))
6
+ ENVELOPE_DIM=16*5*12+8*5*2
7
+
8
+ @torch.no_grad()
9
+ def extract_envelope_features(signal):
10
+ with torch.autocast(signal.device.type,enabled=False):
11
+ x=signal.float();x=x-x.mean(-1,keepdim=True)
12
+ spectrum=torch.fft.fft(x,dim=-1)
13
+ frequency=torch.fft.fftfreq(x.shape[-1],1/200,device=x.device)
14
+ envelopes=[]
15
+ for lo,hi in BANDS:
16
+ mask=((frequency>=lo)&(frequency<hi)).to(x.dtype)*2
17
+ analytic=torch.fft.ifft(spectrum*mask,dim=-1)
18
+ energy=analytic.abs().square()
19
+ envelope=F.avg_pool1d(energy.flatten(0,1).unsqueeze(1),20,10).squeeze(1)
20
+ envelopes.append(envelope.reshape(len(x),16,-1))
21
+ e=torch.stack(envelopes,2)
22
+ mean=e.mean(-1,keepdim=True).clamp_min(1e-12)
23
+ relative=e/mean
24
+ centered=relative-relative.mean(-1,keepdim=True)
25
+ std=centered.square().mean(-1,keepdim=True).sqrt().clamp_min(1e-6)
26
+ normalized=centered/std
27
+ acf=torch.stack([(normalized[...,:-lag]*normalized[...,lag:]).mean(-1)
28
+ for lag in range(4,41)],-1).clamp(-1,1)
29
+ acf_peak,acf_index=acf.max(-1)
30
+ probability=(relative/relative.sum(-1,keepdim=True).clamp_min(1e-12)).clamp_min(1e-12)
31
+ entropy=-(probability*probability.log()).sum(-1)
32
+ summaries=[std.squeeze(-1).clamp_min(1e-6).log(),relative.amax(-1).clamp_min(1).log(),entropy,
33
+ (relative>2).float().mean(-1),(relative>4).float().mean(-1),
34
+ ((relative[...,1:]>2)&(relative[...,:-1]<=2)).float().mean(-1),
35
+ acf_peak,(acf_index.float()+4)/40,
36
+ acf[...,0],acf[...,6],acf[...,16],acf[...,36]]
37
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=x.device);right=left+4
38
+ synchrony=(normalized[:,left]*normalized[:,right]).mean(-1).clamp(-1,1)
39
+ imbalance=(std[:,left].squeeze(-1).log()-std[:,right].squeeze(-1).log()).abs()
40
+ return torch.cat([torch.stack(summaries,-1).flatten(1),synchrony.flatten(1),imbalance.flatten(1)],1)
41
+
42
+ def mirrored_features(features):
43
+ channels=torch.tensor([4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11],device=features.device)
44
+ return torch.cat([features[:,:16*5*12].reshape(-1,16,5,12)[:,channels].flatten(1),features[:,16*5*12:]],1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/features.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One shared residual backbone, five linear input adapters and output heads."""
2
+ import torch
3
+ from torch import nn
4
+
5
+ SPECS = {'faced': (32, 10, 9), 'tuev': (16, 5, 6), 'ad65': (19, 10, 3),
6
+ 'openbmi': (62, 4, 2), 'longitudinal': (58, 2, 2)}
7
+ TRACKS = tuple(SPECS)
8
+ EDGES = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,22,25,28,32,36,40,45,50,60,70,80,95]
9
+ COV_BANDS = [(1,4),(4,8),(8,12),(12,16),(16,20),(20,28),(28,40)]
10
+
11
+ def feature_dim(channels):
12
+ return channels * (4*(len(EDGES)-1)+4) + len(COV_BANDS)*channels*(channels-1)//2
13
+
14
+ @torch.no_grad()
15
+ def extract_features(track, x):
16
+ """Fixed features; no batch statistics or fitted inference transformations."""
17
+ x = x.float().flatten(2)
18
+ x = torch.nan_to_num(x, nan=0., posinf=1e5, neginf=-1e5).clamp(-1e5,1e5)
19
+ x = x - x.mean(-1,keepdim=True)
20
+ if track in ('ad65','openbmi','longitudinal'):
21
+ x = x - x.mean(1,keepdim=True)
22
+ rms = x.square().mean(-1).clamp_min(1e-12).sqrt()
23
+ norm = x / rms.unsqueeze(-1)
24
+ moments = torch.stack([rms.log(), norm.abs().amax(-1).clamp_min(1).log(),
25
+ norm.pow(4).mean(-1).clamp_min(1).log(),
26
+ (norm[...,1:]-norm[...,:-1]).square().mean(-1).clamp_min(1e-10).log()],-1)
27
+ frames = x.unfold(-1,400,200)
28
+ frames = frames - frames.mean(-1,keepdim=True)
29
+ window = torch.hann_window(400,device=x.device)
30
+ z = torch.fft.rfft(frames*window,dim=-1)/200
31
+ power = z.abs().square()
32
+ bands = torch.stack([power[...,2*lo:2*hi].mean(-1) for lo,hi in zip(EDGES[:-1],EDGES[1:])],-1)
33
+ lp = bands.mean(-2).clamp_min(1e-12).log()
34
+ variation = bands.clamp_min(1e-12).log().std(-2,correction=0)
35
+ relative_frequency = lp - lp.mean(-1,keepdim=True)
36
+ relative_channel = lp - lp.mean(1,keepdim=True)
37
+ parts = [torch.cat([lp, relative_frequency, relative_channel, variation, moments],-1).flatten(1)]
38
+ ii,jj = torch.triu_indices(x.shape[1],x.shape[1],offset=1,device=x.device)
39
+ for lo,hi in COV_BANDS:
40
+ v = z[...,2*lo:2*hi].flatten(2)
41
+ cov = v.real @ v.real.transpose(-1,-2) + v.imag @ v.imag.transpose(-1,-2)
42
+ d = cov.diagonal(dim1=-2,dim2=-1).clamp_min(1e-12).sqrt()
43
+ cor = cov / (d.unsqueeze(1)*d.unsqueeze(2)).clamp_min(1e-12)
44
+ parts.append(cor[:,ii,jj].clamp(-1,1))
45
+ result = torch.cat(parts,-1)
46
+ return torch.nan_to_num(result).clamp(-40,40)
47
+
48
+ class Standardize(nn.Module):
49
+ def __init__(self, dim):
50
+ super().__init__()
51
+ self.register_buffer('mean',torch.zeros(dim))
52
+ self.register_buffer('scale',torch.ones(dim))
53
+ def forward(self,x):
54
+ return ((x-self.mean)/self.scale).clamp(-8,8)
55
+
56
+ class Residual(nn.Module):
57
+ def __init__(self,width,dropout):
58
+ super().__init__()
59
+ self.net=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),
60
+ nn.Dropout(dropout),nn.Linear(width*2,width),nn.Dropout(dropout))
61
+ def forward(self,x):
62
+ return x+self.net(x)
63
+
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/frequency_features.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fixed per-window frequency decomposition for a linear montage adapter."""
2
+ import torch
3
+
4
+ FREQUENCY_BANDS=((1,4),(4,8),(8,13),(13,20),(20,30),(30,45))
5
+
6
+ def frequency_components(signal):
7
+ with torch.autocast(signal.device.type,enabled=False):
8
+ x=signal.float();spectrum=torch.fft.rfft(x,dim=-1)
9
+ frequency=torch.fft.rfftfreq(x.shape[-1],d=1/200,device=x.device)
10
+ masks=torch.stack([((frequency>=lo)&(frequency<hi)).float() for lo,hi in FREQUENCY_BANDS])
11
+ return torch.fft.irfft(spectrum[:,None]*masks[None,:,None],n=x.shape[-1],dim=-1)
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/infer.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse,json
2
+ from pathlib import Path
3
+ import torch
4
+ from model import HybridModel,SPECS
5
+ from data import Dataset
6
+ from covariances import extract_covariances
7
+ p=argparse.ArgumentParser();p.add_argument('input',type=Path);p.add_argument('output',type=Path);a=p.parse_args()
8
+ root=Path(__file__).resolve().parent;c=json.loads((root/'config.json').read_text());t=json.loads((a.input/'manifest.json').read_text())['track']
9
+ if t not in SPECS:raise ValueError('unknown track')
10
+ torch.set_num_threads(4);device='cuda' if torch.cuda.is_available() else 'cpu'
11
+ m=HybridModel(**c['architecture']).to(device);m.load_state_dict(torch.load(root/'weights.pt',map_location=device,weights_only=True));m.eval()
12
+ a.output.mkdir(parents=True,exist_ok=True)
13
+ with torch.inference_mode(),(a.output/'predictions.jsonl').open('w') as f:
14
+ for x,_,ids in torch.utils.data.DataLoader(Dataset(a.input),batch_size=64,num_workers=0):
15
+ # FFT features stay float32; convolutions can use bfloat16 on CUDA.
16
+ x=x.to(device)
17
+ from features import extract_features
18
+ torch.backends.cuda.matmul.allow_tf32=False
19
+ features=extract_features(t,x)
20
+ covariances=extract_covariances(t,x)
21
+ torch.backends.cuda.matmul.allow_tf32=True
22
+ with torch.autocast(device,dtype=torch.bfloat16,enabled=device=='cuda'):pred=m(t,x,features,covariances=covariances)
23
+ pp=pred.float().softmax(-1).cpu().numpy()
24
+ for sid,pr in zip(ids,pp):f.write(json.dumps({'id':sid,'probabilities':pr.tolist()})+'\n')
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/infer.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ exec python "$(dirname -- "$0")/infer.py" "$1" "$2"
tasks/brain-computer-interface-decoding/brain-computer-interface-decoding-astra-xhigh-1h100-48h-20261031a/submissions/S095/model.py ADDED
@@ -0,0 +1,515 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from student_features import CBraModFeatures,FrequencyAdapter
2
+ """One fused waveform/spectral backbone used identically by all five tasks."""
3
+ import torch
4
+ from torch import nn
5
+ from braindecode.models import BIOT
6
+ from features import SPECS,TRACKS,feature_dim,extract_features,Standardize,Residual,EDGES,COV_BANDS
7
+ from covariances import BANDS,extract_covariances
8
+ from alpha_features import extract_alpha_features,ALPHA_DIM
9
+ from envelope_features import extract_envelope_features,ENVELOPE_DIM
10
+ from frequency_features import frequency_components,FREQUENCY_BANDS
11
+ from tangent_features import extract_tangent_features,TANGENT_DIM
12
+ from phase_features import phase_features,PHASE_DIM,PHASE_HALF
13
+ from coupling_features import coupling_features,PER_CHANNEL as COUPLING_PER_CHANNEL
14
+ from ordinal_features import ordinal_features,PER_CHANNEL as ORDINAL_PER_CHANNEL
15
+
16
+ def clinical_asymmetry_features(features):
17
+ """Bipolar homologous-channel amplitude and coherence, invariant to mirroring."""
18
+ bands=len(EDGES)-1;per_channel=4*bands+4
19
+ block=features[:,:16*per_channel].reshape(-1,16,per_channel)
20
+ left=torch.tensor([0,1,2,3,8,9,10,11],device=features.device);right=left+4
21
+ pair_power=(block[:,left,:bands]-block[:,right,:bands]).abs().flatten(1)
22
+ pair_rms=(block[:,left,4*bands]-block[:,right,4*bands]).abs()
23
+ hemisphere=(block[:,left,:bands].mean(1)-block[:,right,:bands].mean(1)).abs()
24
+ index=left*(32-left-1)//2+(right-left-1)
25
+ correlations=features[:,16*per_channel:].reshape(-1,len(COV_BANDS),120)[:,:,index].flatten(1)
26
+ return torch.cat([pair_power,pair_rms,hemisphere,correlations],1)
27
+
28
+ class InputAdapter(nn.Module):
29
+ def __init__(self,c,width,channels,spectral_enabled=True,asymmetry=False,alpha_regions=None,envelope=False):
30
+ super().__init__()
31
+ self.ordinal_normalizer=Standardize(c*ORDINAL_PER_CHANNEL)
32
+ self.ordinal_projection=nn.Linear(c*ORDINAL_PER_CHANNEL,width)
33
+ self.ordinal_dropout=nn.Dropout(.3)
34
+ self.register_buffer('ordinal_probabilities_enabled',torch.ones(()))
35
+ self.coupling_normalizer=Standardize(c*COUPLING_PER_CHANNEL)
36
+ self.coupling_projection=nn.Linear(c*COUPLING_PER_CHANNEL,width)
37
+ self.coupling_dropout=nn.Dropout(.3)
38
+ self.register_buffer('coupling_dependence_enabled',torch.ones(()))
39
+ self.phase_normalizer=Standardize(PHASE_DIM)
40
+ self.signal=nn.Conv1d(c,channels,1,bias=False)
41
+ self.frequency_weight=nn.Parameter(torch.zeros(len(FREQUENCY_BANDS),channels,c))
42
+ self.neural=nn.Conv1d(c,18,1,bias=False)
43
+ self.normalizer=Standardize(feature_dim(c))
44
+ self.spectral=nn.Linear(feature_dim(c),width)
45
+ self.dropout=nn.Dropout(.1)
46
+ self.register_buffer("spectral_enabled",torch.tensor(float(spectral_enabled)))
47
+ self.spatial_weight=nn.Parameter(torch.randn(len(BANDS),24,c)/c**.5)
48
+ self.asymmetry_projection=nn.Linear(316,width,bias=False) if asymmetry else None
49
+ if asymmetry:
50
+ nn.init.zeros_(self.asymmetry_projection.weight)
51
+ self.asymmetry_normalizer=Standardize(316)
52
+ self.asymmetry_dropout=nn.Dropout(.1)
53
+ self.alpha_projection=None
54
+ if alpha_regions is not None:
55
+ self.register_buffer('alpha_regions',torch.tensor(alpha_regions,dtype=torch.float32))
56
+ self.alpha_normalizer=Standardize(ALPHA_DIM)
57
+ self.alpha_projection=nn.Linear(ALPHA_DIM,width,bias=False)
58
+ nn.init.zeros_(self.alpha_projection.weight)
59
+ self.alpha_dropout=nn.Dropout(.3)
60
+ self.envelope_projection=None
61
+ if envelope:
62
+ self.envelope_normalizer=Standardize(ENVELOPE_DIM)
63
+ self.envelope_projection=nn.Linear(ENVELOPE_DIM,width,bias=False)
64
+ nn.init.zeros_(self.envelope_projection.weight)
65
+ self.envelope_dropout=nn.Dropout(.3)
66
+ def coupling_embedding(self,features):
67
+ values=self.coupling_normalizer(features).reshape(len(features),-1,COUPLING_PER_CHANNEL)
68
+ values=torch.cat([values[...,:10],self.coupling_dependence_enabled*values[...,10:]],-1).flatten(1)
69
+ return self.coupling_projection(self.coupling_dropout(values))
70
+ def ordinal_embedding(self,features):
71
+ values=self.ordinal_normalizer(features).reshape(len(features),-1,5,26)
72
+ values=torch.cat([self.ordinal_probabilities_enabled*values[...,:24],values[...,24:]],-1).flatten(1)
73
+ return self.ordinal_projection(self.ordinal_dropout(values))
74
+ def spectral_features(self,features,signal=None,alpha_features=None,envelope_features=None):
75
+ value=self.spectral_enabled*self.spectral(self.dropout(self.normalizer(features)))
76
+ if self.asymmetry_projection is not None:
77
+ extra=self.asymmetry_dropout(self.asymmetry_normalizer(clinical_asymmetry_features(features)))
78
+ value=value+self.asymmetry_projection(extra)
79
+ if self.alpha_projection is not None:
80
+ if alpha_features is None:alpha_features=extract_alpha_features(signal,self.alpha_regions)
81
+ value=value+self.alpha_projection(self.alpha_dropout(self.alpha_normalizer(alpha_features)))
82
+ if self.envelope_projection is not None:
83
+ if envelope_features is None:envelope_features=extract_envelope_features(signal)
84
+ value=value+self.envelope_projection(self.envelope_dropout(self.envelope_normalizer(envelope_features)))
85
+ return value
86
+ def spatial_features(self,covariances):
87
+ with torch.autocast(covariances.device.type,enabled=False):
88
+ w=self.spatial_weight.float()/self.spatial_weight.float().norm(dim=-1,keepdim=True).clamp_min(1e-6)
89
+ power=torch.einsum('bfc,nbcd,bfd->nbf',w,covariances.float(),w).clamp_min(1e-8).log()
90
+ return torch.cat([power,power-power.mean(1,keepdim=True)],1).flatten(1)
91
+ def wave_signal(self,x,components=None):
92
+ if components is None:components=frequency_components(x)
93
+ correction=torch.einsum('blc,nbct->nlt',self.frequency_weight,components.to(self.frequency_weight.dtype))
94
+ return (self.signal(x)+correction.to(x.dtype)).unsqueeze(1)
95
+ def forward(self,x,features,covariance_features):
96
+ return self.wave_signal(x),self.spectral_features(features,signal=x),self.neural(x),covariance_features
97
+
98
+ class SharedBackbone(nn.Module):
99
+ def __init__(self,channels,width,depth,dropout,wave_filters):
100
+ super().__init__()
101
+ self.waveform=nn.Sequential(
102
+ nn.Conv2d(1,wave_filters,(1,64),padding=(0,32),bias=False),nn.GroupNorm(1,wave_filters),
103
+ nn.Conv2d(wave_filters,2*wave_filters,(channels,1),groups=wave_filters,bias=False),nn.GroupNorm(1,2*wave_filters),nn.ELU(),
104
+ nn.AvgPool2d((1,4)),nn.Dropout(.35),
105
+ nn.Conv2d(2*wave_filters,2*wave_filters,(1,16),padding=(0,8),groups=2*wave_filters,bias=False),nn.Conv2d(2*wave_filters,2*wave_filters,1,bias=False),
106
+ nn.GroupNorm(1,2*wave_filters),nn.ELU(),nn.AvgPool2d((1,8)),nn.Dropout(.35))
107
+ self.wave_summary=nn.Sequential(nn.AdaptiveAvgPool2d((1,8)),nn.Flatten(),nn.Linear(2*wave_filters*8,width))
108
+ self.fusion=nn.Sequential(nn.LayerNorm(width),nn.GELU(),nn.Dropout(dropout),
109
+ *[Residual(width,dropout) for _ in range(depth)],nn.LayerNorm(width))
110
+ # Both representations interact before the shared residual stack.
111
+ self.phase_encoder=nn.Sequential(nn.LayerNorm(PHASE_DIM),nn.Linear(PHASE_DIM,width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width))
112
+ self.register_buffer('phase_imaginary_enabled',torch.ones(()))
113
+ self.coupling_encoder=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width),nn.LayerNorm(width))
114
+ self.wave_gain=nn.Parameter(torch.tensor(.1))
115
+ self.biot=BIOT(n_chans=18,n_outputs=2,n_times=400,sfreq=200)
116
+ self.biot.final_layer=nn.Identity()
117
+ self.biot_projection=nn.Sequential(nn.LayerNorm(256),nn.Linear(256,width),nn.Dropout(.2))
118
+ nn.init.normal_(self.biot_projection[1].weight,std=.001);nn.init.zeros_(self.biot_projection[1].bias)
119
+ self.covariance_encoder=nn.Sequential(nn.LayerNorm(len(BANDS)*24*2),nn.Linear(len(BANDS)*24*2,width),nn.GELU(),nn.Dropout(.4),
120
+ *[Residual(width,.4) for _ in range(2)],nn.LayerNorm(width))
121
+ self.covariance_projection=nn.Linear(width,width)
122
+ nn.init.zeros_(self.covariance_projection.weight);nn.init.zeros_(self.covariance_projection.bias)
123
+ self.tangent_encoder=nn.Sequential(nn.LayerNorm(TANGENT_DIM),nn.Linear(TANGENT_DIM,width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width),nn.Linear(width,width))
124
+ self.ordinal_context=nn.Sequential(nn.LayerNorm(width),nn.Linear(width,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width))
125
+ nn.init.zeros_(self.ordinal_context[-1].weight);nn.init.zeros_(self.ordinal_context[-1].bias)
126
+ self.register_buffer('codebrain_enabled',torch.ones(()))
127
+ self.codebrain_patch_encoder=nn.Sequential(nn.LayerNorm(24*64),nn.Linear(24*64,width),nn.GELU(),nn.Dropout(.3))
128
+ self.codebrain_context=nn.Sequential(nn.LayerNorm(width*4),nn.Linear(width*4,width*2),nn.GELU(),nn.Dropout(.3),nn.Linear(width*2,width))
129
+ nn.init.zeros_(self.codebrain_context[-1].weight);nn.init.zeros_(self.codebrain_context[-1].bias)
130
+ def codebrain_correction(self,tokens,representation,fusion_input):
131
+ with torch.autocast(tokens.device.type,enabled=False):
132
+ encoded=self.codebrain_patch_encoder(self.codebrain_enabled*tokens.float())
133
+ pooled=torch.cat([encoded.mean(1),encoded.std(1,correction=0),representation[:,-512:-384].float(),representation[:,-128:].float()],-1)
134
+ delta=self.codebrain_context(pooled)
135
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
136
+ corrected=self.fusion(fusion_input+added.to(fusion_input.dtype))
137
+ return corrected-representation[:,-512:-384],delta
138
+ def forward(self,signal,spectral,neural_signal,covariance_features,tangent_features):
139
+ wave=self.waveform(signal)
140
+ neural=self.biot(neural_signal.float())
141
+ neural=self.biot_projection[0](neural)
142
+ projected=self.biot_projection[2](self.biot_projection[1](neural))
143
+ with torch.autocast(signal.device.type,enabled=False):
144
+ covariance_embedding=self.covariance_encoder(covariance_features.float())
145
+ original=spectral+self.wave_gain*self.wave_summary(wave)+.01*projected
146
+ coupled=.001*self.covariance_projection(covariance_embedding).to(original.dtype)
147
+ fused=self.fusion(original+coupled)
148
+ with torch.autocast(signal.device.type,enabled=False):delta=self.tangent_encoder(tangent_features.float())
149
+ added=.001*nn.functional.linear(delta,self.covariance_projection.weight,None)
150
+ corrected=self.fusion((original+coupled)+added.to(original.dtype))
151
+ return torch.cat([wave.flatten(1),fused,neural,covariance_embedding],-1),corrected-fused,delta,original+coupled
152
+
153
+ class ResidualHead(nn.Module):
154
+ """A small nonlinear classifier correction around an inherited linear readout."""
155
+ def __init__(self,features,classes,width=64,dropout=.3,full_precision=False):
156
+ super().__init__();self.full_precision=full_precision
157
+ self.base=nn.Linear(features,classes)
158
+ self.delta=nn.Sequential(nn.LayerNorm(features),nn.Linear(features,width),nn.GELU(),nn.Dropout(dropout),nn.Linear(width,classes))
159
+ nn.init.zeros_(self.delta[-1].weight);nn.init.zeros_(self.delta[-1].bias)
160
+ def forward(self,x):
161
+ if self.full_precision:
162
+ with torch.autocast(x.device.type,enabled=False):return self.base(x.float())+self.delta(x.float())
163
+ prior=nn.functional.linear(x[:,:-128].contiguous(),self.base.weight[:,:-128].contiguous(),self.base.bias)
164
+ added=nn.functional.linear(x[:,-128:].contiguous(),self.base.weight[:,-128:].contiguous())
165
+ value=prior+added
166
+ return value+self.delta(x).to(value.dtype)
167
+
168
+ class TemporalPoolHead(nn.Module):
169
+ def __init__(self,prior,channels=64):
170
+ super().__init__();self.prior=prior;self.channels=channels
171
+ self.register_buffer('pool_output_scale',torch.ones(()));self.register_buffer('pool_mean',torch.zeros(channels*4));self.register_buffer('pool_scale',torch.ones(channels*4))
172
+ self.pool_projection=nn.Linear(channels*4,prior.base.out_features)
173
+ nn.init.zeros_(self.pool_projection.weight);nn.init.zeros_(self.pool_projection.bias)
174
+ def statistics(self,x):
175
+ with torch.autocast(x.device.type,enabled=False):
176
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1)
177
+ return torch.cat([wave.mean(-1),wave.std(-1,correction=0),wave.amax(-1),wave.amin(-1)],-1)
178
+ def forward(self,x):
179
+ prior=self.prior(x)
180
+ with torch.autocast(x.device.type,enabled=False):
181
+ values=((self.statistics(x)-self.pool_mean)/self.pool_scale).clamp(-8,8)
182
+ added=self.pool_output_scale*self.pool_projection(values)
183
+ return prior+added.to(prior.dtype)
184
+
185
+ class TemporalEvidenceHead(nn.Module):
186
+ """Pool class evidence over the shared waveform time axis."""
187
+ def __init__(self,prior,channels=64,temperature=.25):
188
+ super().__init__();self.prior=prior;self.channels=channels;self.temperature=temperature
189
+ self.register_buffer('evidence_output_scale',torch.ones(()))
190
+ self.register_buffer('evidence_mean',torch.zeros(channels))
191
+ self.register_buffer('evidence_scale',torch.ones(channels))
192
+ self.evidence_projection=nn.Linear(channels,prior.prior.base.out_features,bias=False)
193
+ nn.init.zeros_(self.evidence_projection.weight)
194
+ def patches(self,x):
195
+ with torch.autocast(x.device.type,enabled=False):
196
+ wave=x[:,:-512].float().reshape(len(x),self.channels,-1).transpose(1,2)
197
+ return ((wave-self.evidence_mean)/self.evidence_scale).clamp(-8,8)
198
+ def evidence(self,patches):
199
+ with torch.autocast(patches.device.type,enabled=False):
200
+ values=self.evidence_projection(patches.float())/self.temperature
201
+ maximum=values.amax(1,keepdim=True)
202
+ pooled=self.temperature*((values-maximum).exp().mean(1).log()+maximum.squeeze(1))
203
+ return self.evidence_output_scale*pooled
204
+ def forward(self,x):
205
+ prior=self.prior(x)
206
+ return prior+self.evidence(self.patches(x)).to(prior.dtype)
207
+
208
+ class FourierResidualHead(nn.Module):
209
+ """A fixed random Fourier basis and trainable linear classifier correction."""
210
+ def __init__(self,prior,features,classes,basis=256):
211
+ super().__init__();self.prior=prior
212
+ self.register_buffer('rff_mean',torch.zeros(features));self.register_buffer('rff_scale',torch.ones(features))
213
+ self.register_buffer('rff_frequency',torch.randn(features,basis)/features**.5)
214
+ self.register_buffer('rff_phase',torch.rand(basis)*2*torch.pi)
215
+ self.register_buffer('rff_output_scale',torch.ones(()))
216
+ self.rff_projection=nn.Linear(3*basis,classes);nn.init.zeros_(self.rff_projection.weight);nn.init.zeros_(self.rff_projection.bias)
217
+ def basis(self,x):
218
+ with torch.autocast(x.device.type,enabled=False):
219
+ values=((x.float()-self.rff_mean)/self.rff_scale).clamp(-8,8)@self.rff_frequency
220
+ return 2**.5*torch.cat([(values/sigma+self.rff_phase).cos() for sigma in (.5,1.,2.)],-1)
221
+ def forward(self,x):
222
+ prior=self.prior(x)
223
+ with torch.autocast(x.device.type,enabled=False):added=self.rff_output_scale*self.rff_projection(self.basis(x))
224
+ return prior+added.to(prior.dtype)
225
+
226
+ class TangentFeatureHead(nn.Module):
227
+ """Select a shared feature correction before the inherited classifier."""
228
+ def __init__(self,prior):
229
+ super().__init__();self.prior=prior;self.feature_gain=nn.Parameter(torch.zeros(()))
230
+ def forward(self,values):
231
+ old=values[:,:-256];fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
232
+ adjusted=torch.cat([old[:,:-512],old[:,-512:-384]+self.feature_gain*fusion_delta,old[:,-384:-128],old[:,-128:]+self.feature_gain*covariance_delta],-1)
233
+ return self.prior(adjusted)
234
+
235
+ class CodeBrainFeatureHead(nn.Module):
236
+ """Private use of a jointly trained common feature correction."""
237
+ def __init__(self,prior):
238
+ super().__init__();self.prior=prior;self.codebrain_gain=nn.Parameter(torch.ones(()))
239
+ def forward(self,values):
240
+ previous=values[:,:-256];native=previous[:,:-256]
241
+ fusion_delta=values[:,-256:-128];covariance_delta=values[:,-128:]
242
+ adjusted=torch.cat([native[:,:-512],native[:,-512:-384]+self.codebrain_gain*fusion_delta,native[:,-384:-128],native[:,-128:]+self.codebrain_gain*covariance_delta],-1)
243
+ return self.prior(torch.cat([adjusted,previous[:,-256:]],-1))
244
+
245
+ class WaveCoactivationContext(nn.Module):
246
+ """One common encoder of coactivation among the learned waveform channels."""
247
+ def __init__(self,channels=64,width=128):
248
+ super().__init__();self.channels=channels
249
+ ii,jj=torch.triu_indices(channels,channels,offset=1)
250
+ self.register_buffer('pair_i',ii);self.register_buffer('pair_j',jj)
251
+ self.register_buffer('offdiagonal_enabled',torch.ones(()))
252
+ self.encoder=nn.Sequential(nn.LayerNorm(channels+len(ii)),nn.Linear(channels+len(ii),width),nn.GELU(),nn.Dropout(.3),Residual(width,.3),nn.LayerNorm(width))
253
+ def statistics(self,native):
254
+ with torch.autocast(native.device.type,enabled=False):
255
+ wave=native[:,:-512].float().reshape(len(native),self.channels,-1)
256
+ centered=wave-wave.mean(-1,keepdim=True)
257
+ previous_tf32=torch.backends.cuda.matmul.allow_tf32
258
+ torch.backends.cuda.matmul.allow_tf32=False
259
+ covariance=centered@centered.transpose(-1,-2)/wave.shape[-1]
260
+ torch.backends.cuda.matmul.allow_tf32=previous_tf32
261
+ variance=covariance.diagonal(dim1=-2,dim2=-1).clamp_min(1e-8)
262
+ correlation=covariance/(variance.sqrt()[:,:,None]*variance.sqrt()[:,None,:])
263
+ return torch.cat([variance.log(),correlation[:,self.pair_i,self.pair_j].clamp(-1,1)],-1)
264
+ def encode_statistics(self,values):
265
+ with torch.autocast(values.device.type,enabled=False):
266
+ value=torch.cat([values[:,:self.channels],self.offdiagonal_enabled*values[:,self.channels:]],-1)
267
+ return self.encoder(value.float())
268
+ def forward(self,native):return self.encode_statistics(self.statistics(native))
269
+
270
+ class WaveCoactivationHead(nn.Module):
271
+ def __init__(self,prior,classes,width=128):
272
+ super().__init__();self.prior=prior;self.projection=nn.Linear(width,classes)
273
+ nn.init.zeros_(self.projection.weight);nn.init.zeros_(self.projection.bias)
274
+ self.register_buffer('output_scale',torch.ones(()));self.register_buffer('correction_gain',torch.ones(()))
275
+ def forward(self,values):
276
+ prior=self.prior(values[:,:-128])
277
+ with torch.autocast(values.device.type,enabled=False):delta=self.correction_gain*self.output_scale*self.projection(values[:,-128:].float())
278
+ return prior+delta.to(prior.dtype)
279
+
280
+ class OrdinalFeatureHead(nn.Module):
281
+ """Private strength of one common ordinal-dynamics feature correction."""
282
+ def __init__(self,prior):
283
+ super().__init__();self.prior=prior;self.ordinal_gain=nn.Parameter(torch.ones(()))
284
+ def forward(self,values):
285
+ previous=values[:,:-256];native=previous[:,:-640]
286
+ adjusted=torch.cat([native[:,:-512],native[:,-512:-384]+self.ordinal_gain*values[:,-256:-128],native[:,-384:-128],native[:,-128:]+self.ordinal_gain*values[:,-128:],previous[:,-640:]],-1)
287
+ return self.prior(adjusted)
288
+
289
+ class PhaseReadoutHead(nn.Module):
290
+ """Private class evidence from the common complex-coherence encoder."""
291
+ def __init__(self,prior,classes,width=128):
292
+ super().__init__();self.prior=prior;self.projection=nn.Linear(width,classes)
293
+ nn.init.zeros_(self.projection.weight);nn.init.zeros_(self.projection.bias)
294
+ self.register_buffer('output_scale',torch.ones(()));self.register_buffer('correction_gain',torch.ones(()))
295
+ def forward(self,values):
296
+ prior=self.prior(values[:,:-128])
297
+ with torch.autocast(values.device.type,enabled=False):delta=(self.correction_gain*self.output_scale)*self.projection(values[:,-128:].float())
298
+ return prior+delta.to(prior.dtype)
299
+
300
+ class CouplingReadoutHead(nn.Module):
301
+ """Private class evidence from the common cross-frequency coupling encoder."""
302
+ def __init__(self,prior,classes,width=128):
303
+ super().__init__();self.prior=prior;self.projection=nn.Linear(width,classes)
304
+ nn.init.zeros_(self.projection.weight);nn.init.zeros_(self.projection.bias)
305
+ self.register_buffer('output_scale',torch.ones(()));self.register_buffer('correction_gain',torch.ones(()))
306
+ def forward(self,values):
307
+ prior=self.prior(values[:,:-128])
308
+ with torch.autocast(values.device.type,enabled=False):delta=(self.correction_gain*self.output_scale)*self.projection(values[:,-128:].float())
309
+ return prior+delta.to(prior.dtype)
310
+
311
+ class HybridModel(nn.Module):
312
+ def __init__(self,channels=32,width=128,depth=2,dropout=.5,wave_filters=32,head_width=64,head_dropout=.3,clinical_asymmetry=True,alpha_regions=None,clinical_envelope=False,temporal_pool=True,temporal_evidence=False,evidence_temperature=.25,random_fourier=False,fourier_features=256,tangent_readout=True,shared_context_correction=True,wave_coactivation=True,ordinal_context=True,phase_coherence=True,cross_frequency=True,cbramod_feature_transfer=True,student_architecture=None,student_extension=True,post_embedding_extension=True,extension_activation='gelu',center_context_extension=True,context_crop='center',short_context_extension=True,short_crop='center',dual_context_extension=True,dual_crop='clinical-dual',geometry_extension=True,geometry_mode='mi-log',emotion_extension=True,emotion_mode='faced-log'):
313
+ super().__init__()
314
+ self.adapters=nn.ModuleDict({t:InputAdapter(c,width,channels,spectral_enabled=t not in ("faced","tuev","openbmi"),asymmetry=clinical_asymmetry and t=="tuev",alpha_regions=alpha_regions if t=="longitudinal" else None,envelope=clinical_envelope and t=="tuev") for t,(c,s,k) in SPECS.items()})
315
+ self.backbone=SharedBackbone(channels,width,depth,dropout,wave_filters)
316
+ self.backbone.student_encoder=CBraModFeatures(**(student_architecture or {}))
317
+ self.backbone.register_buffer('student_ordered_enabled',torch.ones(()))
318
+ self.backbone.student_readout=nn.Sequential(nn.Linear(self.backbone.student_encoder.output_dim,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
319
+ for t,(c,s,k) in SPECS.items():
320
+ self.adapters[t].student_input=FrequencyAdapter(c,32)
321
+ self.adapters[t].student_normalizer=Standardize(self.backbone.student_encoder.output_dim)
322
+ self.backbone.wave_coactivation=WaveCoactivationContext(2*wave_filters,width)
323
+ self.heads=nn.ModuleDict({t:ResidualHead(2*wave_filters*(((s*200+1)//4+1)//8)+width+256+width,k,head_width,head_dropout,full_precision=t=='ad65') for t,(c,s,k) in SPECS.items()})
324
+ if temporal_pool:self.heads=nn.ModuleDict({t:TemporalPoolHead(head,wave_filters*2) for t,head in self.heads.items()})
325
+ if temporal_evidence:self.heads=nn.ModuleDict({t:TemporalEvidenceHead(head,wave_filters*2,evidence_temperature) for t,head in self.heads.items()})
326
+ if random_fourier:self.heads=nn.ModuleDict({t:FourierResidualHead(head,2*wave_filters*(((SPECS[t][1]*200+1)//4+1)//8)+width+256+width,SPECS[t][2],fourier_features) for t,head in self.heads.items()})
327
+ self.heads=nn.ModuleDict({t:TangentFeatureHead(head) for t,head in self.heads.items()})
328
+ self.heads=nn.ModuleDict({t:CodeBrainFeatureHead(head) for t,head in self.heads.items()})
329
+ self.heads=nn.ModuleDict({t:WaveCoactivationHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
330
+ self.heads=nn.ModuleDict({t:OrdinalFeatureHead(head) for t,head in self.heads.items()})
331
+ self.heads=nn.ModuleDict({t:PhaseReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
332
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
333
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
334
+ assert student_extension and post_embedding_extension
335
+ assert extension_activation in ('gelu','identity')
336
+ self.backbone.student_extension=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU() if extension_activation=='gelu' else nn.Identity(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
337
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
338
+ assert center_context_extension and context_crop in ('center','first')
339
+ self.context_crop=context_crop
340
+ for t,(c,s,k) in SPECS.items():
341
+ self.adapters[t].center_normalizer=Standardize(feature_dim(c)+30*c)
342
+ self.adapters[t].center_projection=nn.Linear(feature_dim(c)+30*c,width)
343
+ self.backbone.center_encoder=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
344
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
345
+ assert short_context_extension and short_crop in ('center','first')
346
+ self.short_crop=short_crop
347
+ for t,(c,s,k) in SPECS.items():
348
+ self.adapters[t].short_normalizer=Standardize(feature_dim(c)+30*c)
349
+ self.adapters[t].short_projection=nn.Linear(feature_dim(c)+30*c,width)
350
+ self.backbone.short_encoder=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
351
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
352
+ assert dual_context_extension and dual_crop in ('clinical-dual','clinical-duplicate')
353
+ self.dual_crop=dual_crop
354
+ for t,(c,s,k) in SPECS.items():
355
+ self.adapters[t].dual_normalizer=Standardize((feature_dim(c)+30*c)*(2 if t=='tuev' else 1))
356
+ self.adapters[t].dual_projection=nn.Linear((feature_dim(c)+30*c)*(2 if t=='tuev' else 1),width)
357
+ self.backbone.dual_encoder=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
358
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
359
+ assert geometry_extension and geometry_mode in ('mi-log','mi-linear')
360
+ self.geometry_mode=geometry_mode
361
+ for t,(c,s,k) in SPECS.items():
362
+ dimension=7*c*(c+1)//2 if t=='openbmi' else feature_dim(c)+30*c
363
+ self.adapters[t].geometry_normalizer=Standardize(dimension)
364
+ self.adapters[t].geometry_projection=nn.Linear(dimension,width)
365
+ self.backbone.geometry_encoder=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
366
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
367
+ assert emotion_extension and emotion_mode in ('faced-log','faced-linear')
368
+ self.emotion_mode=emotion_mode
369
+ for t,(c,s,k) in SPECS.items():
370
+ dimension=7*c*(c+1)//2 if t=='faced' else feature_dim(c)+30*c
371
+ self.adapters[t].emotion_normalizer=Standardize(dimension)
372
+ self.adapters[t].emotion_projection=nn.Linear(dimension,width)
373
+ self.backbone.emotion_encoder=nn.Sequential(nn.Linear(width,256),nn.LayerNorm(256),nn.GELU(),nn.Dropout(.3),nn.Linear(256,width),nn.LayerNorm(width))
374
+ self.heads=nn.ModuleDict({t:CouplingReadoutHead(head,SPECS[t][2],width) for t,head in self.heads.items()})
375
+ def emotion_features(self,t,x):
376
+ from native_log_covariance_features import connectivity
377
+ from short_context_features import short_spectral_features
378
+ old=torch.backends.cuda.matmul.allow_tf32;torch.backends.cuda.matmul.allow_tf32=False
379
+ try:
380
+ with torch.autocast(x.device.type,enabled=False):
381
+ if t=='faced':return connectivity(t,x,logarithmic=self.emotion_mode=='faced-log')
382
+ view=x.flatten(2)[...,:200]
383
+ return torch.cat([short_spectral_features(t,view),coupling_features(t,view)],-1)
384
+ finally:torch.backends.cuda.matmul.allow_tf32=old
385
+ def emotion_embedding(self,t,values):
386
+ with torch.autocast(values.device.type,enabled=False):
387
+ normalized=self.adapters[t].emotion_normalizer(values.float())
388
+ return self.backbone.emotion_encoder(self.adapters[t].emotion_projection(normalized))
389
+ def geometry_features(self,t,x):
390
+ from native_log_covariance_features import connectivity
391
+ from short_context_features import short_spectral_features
392
+ old=torch.backends.cuda.matmul.allow_tf32;torch.backends.cuda.matmul.allow_tf32=False
393
+ try:
394
+ with torch.autocast(x.device.type,enabled=False):
395
+ if t=='openbmi':return connectivity(t,x,logarithmic=self.geometry_mode=='mi-log')
396
+ view=x.flatten(2)[...,:200]
397
+ return torch.cat([short_spectral_features(t,view),coupling_features(t,view)],-1)
398
+ finally:torch.backends.cuda.matmul.allow_tf32=old
399
+ def geometry_embedding(self,t,values):
400
+ with torch.autocast(values.device.type,enabled=False):
401
+ normalized=self.adapters[t].geometry_normalizer(values.float())
402
+ return self.backbone.geometry_encoder(self.adapters[t].geometry_projection(normalized))
403
+ def dual_features(self,t,x):
404
+ from short_context_features import short_spectral_features
405
+ raw=x.flatten(2);first=raw[...,:200];views=[first]
406
+ if t=='tuev':
407
+ start=(raw.shape[-1]-200)//2
408
+ views.append(raw[...,start:start+200] if self.dual_crop=='clinical-dual' else first)
409
+ old=torch.backends.cuda.matmul.allow_tf32;torch.backends.cuda.matmul.allow_tf32=False
410
+ try:
411
+ with torch.autocast(raw.device.type,enabled=False):return torch.cat([torch.cat([short_spectral_features(t,v),coupling_features(t,v)],-1) for v in views],-1)
412
+ finally:torch.backends.cuda.matmul.allow_tf32=old
413
+ def dual_embedding(self,t,values):
414
+ with torch.autocast(values.device.type,enabled=False):
415
+ normalized=self.adapters[t].dual_normalizer(values.float())
416
+ return self.backbone.dual_encoder(self.adapters[t].dual_projection(normalized))
417
+ def short_features(self,t,x):
418
+ from short_context_features import short_spectral_features
419
+ raw=x.flatten(2);start=(raw.shape[-1]-200)//2 if self.short_crop=='center' else 0
420
+ cropped=raw[...,start:start+200];assert cropped.shape[-1]==200
421
+ old=torch.backends.cuda.matmul.allow_tf32;torch.backends.cuda.matmul.allow_tf32=False
422
+ try:
423
+ with torch.autocast(raw.device.type,enabled=False):return torch.cat([short_spectral_features(t,cropped),coupling_features(t,cropped)],-1)
424
+ finally:torch.backends.cuda.matmul.allow_tf32=old
425
+ def short_embedding(self,t,values):
426
+ with torch.autocast(values.device.type,enabled=False):
427
+ normalized=self.adapters[t].short_normalizer(values.float())
428
+ return self.backbone.short_encoder(self.adapters[t].short_projection(normalized))
429
+ def center_features(self,t,x):
430
+ raw=x.flatten(2);start=(raw.shape[-1]-400)//2 if self.context_crop=='center' else 0
431
+ cropped=raw[...,start:start+400];assert cropped.shape[-1]==400
432
+ old=torch.backends.cuda.matmul.allow_tf32;torch.backends.cuda.matmul.allow_tf32=False
433
+ try:
434
+ with torch.autocast(raw.device.type,enabled=False):return torch.cat([extract_features(t,cropped),coupling_features(t,cropped)],-1)
435
+ finally:torch.backends.cuda.matmul.allow_tf32=old
436
+ def center_embedding(self,t,values):
437
+ with torch.autocast(values.device.type,enabled=False):
438
+ normalized=self.adapters[t].center_normalizer(values.float())
439
+ return self.backbone.center_encoder(self.adapters[t].center_projection(normalized))
440
+ def student_extension_embedding(self,t,values):
441
+ with torch.autocast(values.device.type,enabled=False):
442
+ assert values.shape[-1]==128
443
+ return self.backbone.student_extension(values.float())
444
+
445
+ def student_features(self,t,x):
446
+ outputs=[];old_fastpath=torch.backends.mha.get_fastpath_enabled();torch.backends.mha.set_fastpath_enabled(False)
447
+ try:
448
+ for raw in x.split(16):
449
+ signal=torch.nan_to_num(raw.float().flatten(2),nan=0.,posinf=1e5,neginf=-1e5).clamp(-1e5,1e5)
450
+ signal=signal-signal.mean(-1,keepdim=True)
451
+ if t in ('faced','tuev'):signal=signal/signal.std(-1,keepdim=True,correction=0).clamp_min(1e-6)
452
+ else:signal=signal-signal.mean(1,keepdim=True)
453
+ signal=signal.clamp(-20,20)
454
+ with torch.autocast(signal.device.type,dtype=torch.bfloat16,enabled=signal.device.type=='cuda'):
455
+ outputs.append(self.backbone.student_encoder(self.adapters[t].student_input(signal)))
456
+ finally:torch.backends.mha.set_fastpath_enabled(old_fastpath)
457
+ return torch.cat(outputs).float()
458
+ def student_embedding(self,t,values):
459
+ with torch.autocast(values.device.type,enabled=False):
460
+ normalized=self.adapters[t].student_normalizer(values.float())
461
+ normalized=torch.cat([normalized[:,:256],self.backbone.student_ordered_enabled*normalized[:,256:]],-1)
462
+ return self.backbone.student_readout(normalized)
463
+ def coupling_embedding(self,t,values):
464
+ with torch.autocast(values.device.type,enabled=False):return self.backbone.coupling_encoder(self.adapters[t].coupling_embedding(values.float()))
465
+ def phase_embedding(self,t,values):
466
+ with torch.autocast(values.device.type,enabled=False):
467
+ normalized=self.adapters[t].phase_normalizer(values.float())
468
+ normalized=torch.cat([normalized[:,:PHASE_HALF],self.backbone.phase_imaginary_enabled*normalized[:,PHASE_HALF:]],-1)
469
+ return self.backbone.phase_encoder(normalized)
470
+ def forward(self,t,x,features=None,covariances=None,covariance_features=None):
471
+ if features is None:features=extract_features(t,x)
472
+ if covariance_features is None:
473
+ if covariances is None:covariances=extract_covariances(t,x)
474
+ covariance_features=self.adapters[t].spatial_features(covariances)
475
+ signal=x.flatten(2);signal=signal-signal.mean(-1,keepdim=True)
476
+ if t in ('faced','tuev'):signal=signal/signal.std(-1,keepdim=True,correction=0).clamp_min(1e-6)
477
+ else:signal=signal-signal.mean(1,keepdim=True)
478
+ signal=signal.clamp(-20,20)
479
+ adapted=self.adapters[t](signal,features,covariance_features)
480
+ if covariances is None:covariances=extract_covariances(t,x)
481
+ tangent=extract_tangent_features(covariances,self.adapters[t].spatial_weight)
482
+ representation,fusion_delta,covariance_delta,fusion_input=self.backbone(*adapted,tangent_features=tangent)
483
+ if t in ('faced','openbmi'):
484
+ representation=torch.cat([representation[:,:-384],torch.zeros_like(representation[:,-384:-128]),representation[:,-128:]],-1)
485
+ tokens=torch.zeros(len(signal),signal.shape[-1]//200,24*64,device=signal.device,dtype=torch.bfloat16)
486
+ code_fusion,code_covariance=self.backbone.codebrain_correction(tokens,representation,fusion_input)
487
+ coactivation=self.backbone.wave_coactivation(representation)
488
+ with torch.autocast(signal.device.type,enabled=False):
489
+ ordinal=self.adapters[t].ordinal_embedding(ordinal_features(t,x))
490
+ ordinal_covariance=self.backbone.ordinal_context(ordinal.float())
491
+ added=.001*nn.functional.linear(ordinal_covariance,self.backbone.covariance_projection.weight,None)
492
+ ordinal_fusion=self.backbone.fusion(fusion_input+added.to(fusion_input.dtype))-representation[:,-512:-384]
493
+ phase=self.phase_embedding(t,phase_features(t,x,self.adapters[t].spatial_weight))
494
+ coupling=self.coupling_embedding(t,coupling_features(t,x))
495
+ student_values=self.student_features(t,x)
496
+ student=self.student_embedding(t,student_values)
497
+ extension=self.student_extension_embedding(t,student)
498
+ return self.heads[t](torch.cat([representation,fusion_delta,covariance_delta,code_fusion,code_covariance,coactivation,ordinal_fusion,ordinal_covariance,phase,coupling,student,extension,self.center_embedding(t,self.center_features(t,x)),self.short_embedding(t,self.short_features(t,x)),self.dual_embedding(t,self.dual_features(t,x)),self.geometry_embedding(t,self.geometry_features(t,x)),self.emotion_embedding(t,self.emotion_features(t,x))],-1))
499
+
500
+ def widen_state_dict(state,multiplier=2):
501
+ """Duplicate temporal features and divide downstream sums to preserve outputs."""
502
+ result={}
503
+ for key,value in state.items():
504
+ if key.startswith('backbone.waveform.'):
505
+ layer=int(key.split('.')[2])
506
+ if layer in (0,2,7):value=value.repeat(multiplier,1,1,1)
507
+ elif layer in (1,3,9):value=value.repeat(multiplier)
508
+ elif layer==8:value=value.repeat(multiplier,multiplier,1,1)/multiplier
509
+ elif key=='backbone.wave_summary.2.weight':value=value.repeat(1,multiplier)/multiplier
510
+ elif key.startswith('heads.') and key.endswith('.weight'):
511
+ raw=value[:,:-128]/multiplier
512
+ value=torch.cat([raw]*multiplier+[value[:,-128:]],1)
513
+ result[key]=value
514
+ return result
515
+