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
1 Like
Hi, Adrian.
How are you running ROOT 5.34 on SWAN?
Sorry, it is not ROOT 5.34. When I import ROOT to SWAN i get;
“Welcome to JupyROOT 6.12/06”
Hi,
Could you post a minimal example script that reproduces your problem? That would help a lot
Cheers,
Kim
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 (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
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
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
lata
June 11, 2019, 8:31am
8
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
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
1 Like