# Segmentation Violation when using PyAdaBoost in TMVA

**URL:** <https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644>\
**Category:** TMVA\
**Created:** [April 11, 2018, 12:53pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644 "2018-04-11T12:53:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martha\_Hilton](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/martha_hilton/32/25928_2.png) [@Martha\_Hilton](https://root-forum.cern.ch/u/Martha_Hilton)\
**Post date:** [April 11, 2018, 12:53pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/1 "2018-04-11T12:53:22Z")

</div>

Hello,

I am trying to use the PYMVA method PyAdaBoost in TMVA. Firstly I checked TMVA was working by running TMVAClassification.C which compiled ok however the following messages appeared at the beginning:

Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libRIO, output: $TMVASYS/lib/libRIO  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libCling, output: $TMVASYS/lib/libCling  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libMathCore, output: $TMVASYS/lib/libMathCore  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/test/rootalias.C, output: $TMVASYS/test/rootalias.C  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/test/TMVAlogon.C, output: $TMVASYS/test/TMVAlogon.C

I then tried to add the PyAdaBoost method to the TMVAClassification.C and I got a segmentation violation at the following line:

factory-\>BookMethod(dataloader, TMVA::Types::kPyAdaBoost, “PyAdaBoost”, “!V:BaseEstimator=None:NEstimators=100:LearningRate=1:Algorithm=SAMME.R:RandomState=None” );

I included PyMethodBase.h and MethodPyAdaBoost.h and included the line TMVA::PyMethodBase::PyInitialize(); in my code. I am using ROOT 6.10.06.

Do you have any ideas?

Many thanks,

Martha

---

<div class="post-metadata">

**Author:** ![maxisacson](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/maxisacson/32/13173_2.png) [@maxisacson](https://root-forum.cern.ch/u/maxisacson)\
**Post date:** [April 11, 2018, 1:05pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/2 "2018-04-11T13:05:09Z")

</div>

Is $TMVASYS set correctly? What is the output of

```bash
echo $TMVASYS

```

in the shell?

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [April 11, 2018, 1:07pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/3 "2018-04-11T13:07:56Z")

</div>

Hi Martha,

Can you detail your ROOT/TMVA installation, did you compile it yourself, did you download the binary or are you using an LCG release?

Could you also post the error message that is output?

Since ROOT6, TMVA is integrated into ROOT, making the environment variable `$TMVASYS` redundant. Getting a reference to this variable thus makes me suspect that, potentially, your ROOT installation is misconfigured.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![Martha\_Hilton](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/martha_hilton/32/25928_2.png) [@Martha\_Hilton](https://root-forum.cern.ch/u/Martha_Hilton)\
**Post date:** [April 11, 2018, 1:16pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/4 "2018-04-11T13:16:14Z")

</div>

Hi,

I am using an LCG release by running the command in my terminal:

source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG\_91 x86\_64-slc6-gcc62-opt

The total output is as follows:

Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libRIO, output: $TMVASYS/lib/libRIO  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libCling, output: $TMVASYS/lib/libCling  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/lib/libMathCore, output: $TMVASYS/lib/libMathCore  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/test/rootalias.C, output: $TMVASYS/test/rootalias.C  
Error in \<TSystem::ExpandFileName: input: $TMVASYS/test/TMVAlogon.C, output: $TMVASYS/test/TMVAlogon.C  
root [0]  
Processing TMVAClassification.C…

==\> Start TMVAClassification  
Info in TFile::OpenFromCache: using local cache copy of [http://root.cern.ch/files/tmva\_class\_example.root](http://root.cern.ch/files/tmva_class_example.root) [./files/tmva\_class\_example.root]  
— TMVAClassification : Using input file: ./files/tmva\_class\_example.root  
DataSetInfo : [dataset] : Added class “Signal”  
: Add Tree TreeS of type Signal with 6000 events  
DataSetInfo : [dataset] : Added class “Background”  
: Add Tree TreeB of type Background with 6000 events  
Factory : Booking method: PyAdaBoost  
:

\*\*\* Break \*\*\* segmentation violation

Thanks,

Martha

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [April 11, 2018, 1:44pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/5 "2018-04-11T13:44:38Z")

</div>

Hmm, I can _not_ reproduce the initial error message on lxplus when running. Is this similar to what you do?

```auto
source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_91 x86_64-slc6-gcc62-opt
root -b $ROOTSYS/tutorials/tmva/TMVAClassification.C

```

I can also run pyAdaBoost on this setup with no issues.

```auto
wget https://raw.githubusercontent.com/root-project/root/master/tmva/pymva/test/testPyAdaBoostClassification.C
root -b testPyAdaBoostClassification.C

```

I also tried booking the classifier with your configuration (`"!V:BaseEstimator=None:NEstimators=100:LearningRate=1:Algorithm=SAMME.R:RandomState=None"`) and am still successful. This indicates that maybe your ROOT setup is not configured properly after all.

Can you verify that you can run these steps on `lxplus`?

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![Martha\_Hilton](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/martha_hilton/32/25928_2.png) [@Martha\_Hilton](https://root-forum.cern.ch/u/Martha_Hilton)\
**Post date:** [April 11, 2018, 2:00pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/6 "2018-04-11T14:00:02Z")

</div>

Hi,

I can run the TMVAClassification.C ok but I get a segmentation violation when trying to run testPyAdaBoostClassification.C.

Thanks,

Martha

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [April 11, 2018, 4:06pm UTC](https://root-forum.cern.ch/t/segmentation-violation-when-using-pyadaboost-in-tmva/28644/7 "2018-04-11T16:06:19Z")

</div>

Ok, I have no idea what the source of this error could be. Maybe you could ask a colleague to try running the same steps.

In any case, the issue seems to be a configuration one and not with ROOT/TMVA itself.

Cheers,  
Kim
