Skip to content

Commit e38ff4f

Browse files
committed
bootstrap resampling for train
1 parent ddb44a6 commit e38ff4f

File tree

12 files changed

+243
-159
lines changed

12 files changed

+243
-159
lines changed

.github/workflows/icenet-install-test.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,21 @@ jobs:
101101
run: |
102102
source setenv-github-actions.sh && python icefit/peakfit.py --analyze --group --test_mode --fit_type dual-unitary-II --output_name dual-unitary-II
103103
104+
#
105+
- name: Deep Learning system (runme_eid)
106+
run: |
107+
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid.sh
108+
109+
#
110+
- name: Deep Learning system (runme_eid_deep)
111+
run: |
112+
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid_deep.sh
113+
114+
#
115+
- name: Deep Learning system (runme_eid_visual)
116+
run: |
117+
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid_visual.sh
118+
104119
# (This is run twice to test cache files)
105120
- name: Deep Learning system (runme_brem)
106121
run: |
@@ -127,7 +142,7 @@ jobs:
127142
source tests/runme_zee_gridtune.sh
128143
129144
echo "yes" | source superclean.sh
130-
145+
131146
#
132147
- name: Deep Learning system (runme_zee)
133148
run: |
@@ -151,21 +166,6 @@ jobs:
151166
run: |
152167
source setenv-github-actions.sh && maxevents=10000; source tests/runme_trg.sh
153168
echo "yes" | source superclean.sh
154-
155-
#
156-
- name: Deep Learning system (runme_eid)
157-
run: |
158-
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid.sh
159-
160-
#
161-
- name: Deep Learning system (runme_eid_deep)
162-
run: |
163-
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid_deep.sh
164-
165-
#
166-
- name: Deep Learning system (runme_eid_visual)
167-
run: |
168-
source setenv-github-actions.sh && maxevents=10000; source tests/runme_eid_visual.sh
169169
170170
## source setenv-github-actions.sh && maxevents=10000; source tests/runme_brk.sh
171171
## source setenv-github-actions.sh && maxevents=10000; source tests/runme_dqcd_vector_train.sh

configs/zee/models.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ iceboost_swd:
193193
<<: *ICEBOOST0
194194

195195
label: 'ICEBOOST-SWD'
196+
197+
bootstrap: 3
196198

197199
# BCE loss domains [use with custom:binary_cross_entropy]
198200
BCE_param:

icedqcd/common.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ def splitfactor(x, y, w, ids, args, skip_graph=True, use_dequantize=True):
353353

354354
data_graph += sum(ray.get(graph_futures), []) # Join split array results
355355
ray.shutdown()
356-
356+
357357
print(f'ray_results: {time.time() - start_time:0.1f} sec')
358358
io.showmem()
359-
359+
360360
# -------------------------------------------------------------------------
361361
## Tensor representation
362362
data_tensor = None
@@ -392,5 +392,9 @@ def splitfactor(x, y, w, ids, args, skip_graph=True, use_dequantize=True):
392392
"""
393393
# --------------------------------------------------------------------------
394394

395-
396-
return {'data': data, 'data_MI': data_MI, 'data_kin': data_kin, 'data_deps': data_deps, 'data_tensor': data_tensor, 'data_graph': data_graph}
395+
return {'data': data,
396+
'data_MI': data_MI,
397+
'data_kin': data_kin,
398+
'data_deps': data_deps,
399+
'data_tensor': data_tensor,
400+
'data_graph': data_graph}

icefit/icepeak.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def TH1_to_numpy(hist, dtype=np.float64):
366366

367367
#for n, v in hist.__dict__.items(): # class generated on the fly
368368
# print(f'{n} {v}')
369-
369+
370370
hh = hist.to_numpy()
371371
counts = np.array(hist.values(), dtype=dtype)
372372
errors = np.array(hist.errors(), dtype=dtype)
@@ -1430,7 +1430,8 @@ def integral_wrapper(lambdafunc, x, edges, norm=False, N_int: int=128, EPS=1E-8,
14301430
if norm:
14311431
# Normalization based on a numerical integral over edge bounds
14321432
x_fine = np.linspace(edges[0], edges[-1], N_int)
1433-
I = max(np.trapz(y=lambdafunc(x_fine), x=x_fine), EPS)
1433+
y_fine = lambdafunc(x_fine)
1434+
I = max(np.trapz(x=x_fine, y=y_fine), EPS)
14341435

14351436
return f / I * edges2binwidth(edges)
14361437
else:

icehgcal/common.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,23 +242,29 @@ def splitfactor(x, y, w, ids, args):
242242
### DeepSets representation
243243
data_deps = None
244244

245+
# -------------------------------------------------------------------------
246+
### Mutual Information
247+
data_MI = None
248+
245249
# -------------------------------------------------------------------------
246250
### Tensor representation
247251
data_tensor = None
248252

249253
# -------------------------------------------------------------------------
250254
## Graph representation
251-
data_graph = None
255+
data_graph = None
252256

253-
data_graph = graphio.parse_graph_data_candidate(X=data.x, Y=data.y, weights=data.w, ids=data.ids,
257+
data_graph = graphio.parse_graph_data_candidate(X=data.x, Y=data.y, weights=data.w, ids=data.ids,
254258
features=scalar_vars, graph_param=args['graph_param'])
255259

256260
# --------------------------------------------------------------------
257261
### Finally pick active scalar variables out
258-
262+
259263
data.x = None # To protect other routines (TBD see global impact --> comment this line)
260264

261-
return {'data': data, 'data_kin': data_kin, 'data_deps': data_deps, 'data_tensor': data_tensor, 'data_graph': data_graph}
262-
263-
# ========================================================================
264-
# ========================================================================
265+
return {'data': data,
266+
'data_MI': data_MI,
267+
'data_kin': data_kin,
268+
'data_deps': data_deps,
269+
'data_tensor': data_tensor,
270+
'data_graph': data_graph}

icehnl/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,9 @@ def splitfactor(x, y, w, ids, args):
146146
data = data[vars]
147147
data.x = data.x.astype(np.float32)
148148

149-
return {'data': data, 'data_MI': data_MI, 'data_kin': data_kin, 'data_deps': data_deps, 'data_tensor': data_tensor, 'data_graph': data_graph}
149+
return {'data': data,
150+
'data_MI': data_MI,
151+
'data_kin': data_kin,
152+
'data_deps': data_deps,
153+
'data_tensor': data_tensor,
154+
'data_graph': data_graph}

iceid/common.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def splitfactor(x, y, w, ids, args):
150150
data_kin = data[vars]
151151
data_kin.x = data_kin.x.astype(np.float32)
152152

153+
# -------------------------------------------------------------------------
154+
### MI variables
155+
data_MI = None
156+
153157
# -------------------------------------------------------------------------
154158
### DeepSets representation
155159
data_deps = None
@@ -213,4 +217,9 @@ def splitfactor(x, y, w, ids, args):
213217
data = data[vars]
214218
data.x = data.x.astype(np.float32)
215219

216-
return {'data': data, 'data_kin': data_kin, 'data_deps': data_deps, 'data_tensor': data_tensor, 'data_graph': data_graph}
220+
return {'data': data,
221+
'data_MI': data_MI,
222+
'data_kin': data_kin,
223+
'data_deps': data_deps,
224+
'data_tensor': data_tensor,
225+
'data_graph': data_graph}

icenet/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import os
44
import psutil
55

6-
__version__ = '0.1.3.6'
6+
__version__ = '0.1.3.7'
77
__release__ = 'alpha'
8-
__date__ = '04/11/2024'
8+
__date__ = '18/11/2024'
99
__author__ = '[email protected]'
1010
__repository__ = 'github.com/mieskolainen/icenet'
1111
__asciiart__ = \

icenet/tools/io.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,11 @@ def __getitem__(self, key):
391391
return IceXYW(x=self.x[..., col], y=self.y, w=self.w, ids=ids)
392392
else:
393393
return IceXYW(x=self.x[col], y=self.y, w=self.w, ids=ids)
394-
394+
395+
# length operator
396+
def __len__(self):
397+
return len(self.x)
398+
395399
# + operator
396400
def __add__(self, other):
397401

0 commit comments

Comments
 (0)