# TMVA not showing plots on SWAN

**URL:** <https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762>\
**Category:** TMVA\
**Created:** [July 12, 2018, 1:10pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762 "2018-07-12T13:10:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian.gutierrez.vaz](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@adrian.gutierrez.vaz](https://root-forum.cern.ch/u/adrian.gutierrez.vaz)\
**Post date:** [July 12, 2018, 1:10pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/1 "2018-07-12T13:10:43Z")

</div>

Hi dear experts,

I am currently using TMVA to study some particular type of signal. When I finish my training, testing and evaluation I wanna see some graphs produce by the TMVA (such as the roc curve, Output Distribution, Probability Distribution, etc.). If I was to write a .py script I could see all of that by calling “MVAGui” but I believed that in SWAN I cannot call that. Is there a way to see all those graphs on any .ipynb script? I have been using the “magic” function “%jsmva on” to allow the JavaScript graphics to appear but whenever I try to plot something I do not get any plot.

The following part shows a section of my script;

import ROOT  
from ROOT import TFile, TMVA, TCut, TCanvas

%jsmva on

outputFile = TFile( “TMVA.root”, ‘RECREATE’ )  
TMVA.Tools.Instance();

factory = TMVA.Factory( “TMVAClassification”, outputFile  
,"!V:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=Classification" )  
.  
.  
.

# In here i load all variables into my factory, prepare training and booked methods.

.  
.  
.  
factory.TrainAllMethods()  
factory.TestAllMethods()  
factory.EvaluateAllMethods()

factory.DrawOutputDistribution(dataset, “MLP”)  
factory.DrawProbabilityDistribution(dataset, “LD”)  
factory.DrawROCCurve(dataset)

None of the previous three classes are displaying any kind of plots. Is there a way to fix this problem?

I am running the following:  
ROOT 5.34/36 (heads/v5-34-00-patches@v5-34-34-76-g57bae4c, Apr 08 2016, 12:05:00 on linuxx8664gcc)

Thanks,

Adrian Gutierrez

---

<div class="post-metadata">

**Author:** ![xvallspl](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/xvallspl/32/15799_2.png) [@xvallspl](https://root-forum.cern.ch/u/xvallspl)\
**Post date:** [July 13, 2018, 2:40pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/2 "2018-07-13T14:40:09Z")

</div>

Hi, Adrian.

How are you running ROOT 5.34 on SWAN?

---

<div class="post-metadata">

**Author:** ![adrian.gutierrez.vaz](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@adrian.gutierrez.vaz](https://root-forum.cern.ch/u/adrian.gutierrez.vaz)\
**Post date:** [July 16, 2018, 10:16am UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/3 "2018-07-16T10:16:57Z")

</div>

Sorry, it is not ROOT 5.34. When I import ROOT to SWAN i get;  
“Welcome to JupyROOT 6.12/06”

---

<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:** [July 23, 2018, 10:33am UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/4 "2018-07-23T10:33:37Z")

</div>

Hi,

Could you post a minimal example script that reproduces your problem? That would help a lot 🙂

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![adrian.gutierrez.vaz](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@adrian.gutierrez.vaz](https://root-forum.cern.ch/u/adrian.gutierrez.vaz)\
**Post date:** [July 23, 2018, 2:06pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/5 "2018-07-23T14:06:52Z")

</div>

Hi Kim,

Yes. Here is a minimal example of the script that I am trying to run (not quite the same but very similar):

[TMVATest.py](https://root-forum.cern.ch/uploads/default/original/3X/5/b/5b044e323f7d8a6ccc0208ebcc1908e91b9d86a6.py) (3.4 KB)

You can copy and pace the script to SWAN and everything should work fine. The only problem is that none of my plots are display.

Thanks,

Adrian

---

<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:** [July 23, 2018, 9:50pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/6 "2018-07-23T21:50:19Z")

</div>

Hi, thanks for the reproducer. The issue is now understood and will be fixed asap (probably in the next bugfix release of 6.12).

Cheers,  
Kim

---

<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:** [July 25, 2018, 3:12pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/7 "2018-07-25T15:12:23Z")

</div>

Hi,

Could you try your setup through SWAN now. Hopefully the problem has now been resolved 🙂

Please report back whether it works or not!

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![lata](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lata/32/20766_2.png) [@lata](https://root-forum.cern.ch/u/lata)\
**Post date:** [June 11, 2019, 8:31am UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/8 "2019-06-11T08:31:03Z")

</div>

Hello Kim,

I read this post but I am still not able to use %jsmva on in my script to plot variables. My scripts can be found here

[https://swan002.cern.ch/user/lata/notebooks/SWAN\_projects/swanExamples1/notebooks/bbgg\_python.ipynb](https://swan002.cern.ch/user/lata/notebooks/SWAN_projects/swanExamples1/notebooks/bbgg_python.ipynb)

The error looks like this  
ImportErrorTraceback (most recent call last)  
 in ()  
1 import ROOT  
----\> 2 get\_ipython().magic(u’jsmva on’)

/cvmfs/sft.cern.ch/lcg/views/LCG\_95a/x86\_64-centos7-gcc7-opt/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg\_s)  
2158 magic\_name, \_, magic\_arg\_s = arg\_s.partition(’ ')  
2159 magic\_name = magic\_name.lstrip(prefilter.ESC\_MAGIC)  
-\> 2160 return self.run\_line\_magic(magic\_name, magic\_arg\_s)  
2161  
2162 #-------------------------------------------------------------------------

Thanks,

Lata

---

<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:** [June 12, 2019, 3:45pm UTC](https://root-forum.cern.ch/t/tmva-not-showing-plots-on-swan/29762/9 "2019-06-12T15:45:52Z")

</div>

Hi,

We are tracking this issue here: [https://sft.its.cern.ch/jira/browse/ROOT-10175?filter=-4](https://sft.its.cern.ch/jira/browse/ROOT-10175?filter=-4)

Cheers,  
Kim
