Skip to content

Commit

Permalink
[TMVA] Avoid xgboost-cppyy symbol clashing problem in tmva101_Training
Browse files Browse the repository at this point in the history
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
  • Loading branch information
guitargeek authored and vepadulano committed Apr 9, 2024
1 parent a4c1482 commit a561a9f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tutorials/tmva/tmva101_Training.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
## \date August 2019
## \author Stefan Wunsch

# XGBoost has to be imported before ROOT to avoid crashes because of clashing
# std::regexp symbols that are exported by cppyy.
# See also: https://github.com/wlav/cppyy/issues/227
from xgboost import XGBClassifier

import ROOT
import numpy as np
import pickle

from tmva100_DataPreparation import variables

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

# Fit xgboost model
from xgboost import XGBClassifier
bdt = XGBClassifier(max_depth=3, n_estimators=500)
bdt.fit(x, y, sample_weight=w)

Expand Down

0 comments on commit a561a9f

Please sign in to comment.