Skip to content

Commit 526b9f1

Browse files
committed
[TMVA] Avoid xgboost-cppyy symbol clashing problem in tmva101_Training
XGBoost has to be imported before ROOT to avoid crashes because of clashing std::regexp symbols that are exported by cppyy. See also: wlav/cppyy#227
1 parent 3e8a272 commit 526b9f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tutorials/tmva/tmva101_Training.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
## \date August 2019
1313
## \author Stefan Wunsch
1414

15+
# XGBoost has to be imported before ROOT to avoid crashes because of clashing
16+
# std::regexp symbols that are exported by cppyy.
17+
# See also: https://github.com/wlav/cppyy/issues/227
18+
from xgboost import XGBClassifier
19+
1520
import ROOT
1621
import numpy as np
17-
import pickle
1822

1923
from tmva100_DataPreparation import variables
2024

@@ -45,7 +49,6 @@ def load_data(signal_filename, background_filename):
4549
x, y, w = load_data("train_signal.root", "train_background.root")
4650

4751
# Fit xgboost model
48-
from xgboost import XGBClassifier
4952
bdt = XGBClassifier(max_depth=3, n_estimators=500)
5053
bdt.fit(x, y, sample_weight=w)
5154

0 commit comments

Comments
 (0)