Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 42b9da7

Browse files
committed
docs: note about MethodCuts requiring signal to be added first
1 parent 0d35b7c commit 42b9da7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

root_numpy/tmva/_factory.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,19 @@ def add_classification_events(factory, events, labels, signal_label=None,
3737
3838
Notes
3939
-----
40-
A TMVA::Factory requires you to add both training and test events even if
41-
you don't intend to call ``TestAllMethods()``.
40+
* A TMVA::Factory requires you to add both training and test events even if
41+
you don't intend to call ``TestAllMethods()``.
42+
43+
* When using MethodCuts, the first event added must be a signal event,
44+
otherwise TMVA will fail with ``<FATAL> Interval : maximum lower than
45+
minimum``. To place a signal event first::
46+
47+
# Get index of first signal event
48+
first_signal = np.nonzero(labels == signal_label)[0][0]
49+
# Swap this with first event
50+
events[0], events[first_signal] = events[first_signal].copy(), events[0].copy()
51+
labels[0], labels[first_signal] = labels[first_signal], labels[0]
52+
weights[0], weights[first_signal] = weights[first_signal], weights[0]
4253
4354
"""
4455
if not isinstance(factory, TMVA.Factory):

0 commit comments

Comments
 (0)