Week 6: Blog, bug fixes, neural network visualization
This week I created this blog and added support for drawing neural networks for MLP.
Question
In JsMVA.DataLoader.GetInputVariableHist
function I need to have access to TMVA::MethodBase::CreateVariableTransforms
function, which is private, so I made public. How can we avoid making this function public? Is there other solution than rewriting in python?
Blog
I decided I will use Jekyll and github pages to post about my work. First I learnt how this works, then I had some error with URL at github, now this is solved. I added sharing in email option to my page, because if I want to share a new post mostly I will do in email. I also added support for scrollbar in code highlight and fixing the size of these boxes.
In my work all my outputs are JavaScript based plots, which easily can be used outside of notebook too. So I thought it would be nice, if in my blog I’m able to show my result. To be able to do this, first I created a python module: SavaJSON. If we import this module, it will change the JPyInterface.JsDraw.Draw method to it’s own, which is similar to JPyInterface’s method, but will save the JSON string. Also contains a method which will save the string to file. In this simple way I save all my plots, I copy to my blog directory. I also wrote a blogJsMVA class in JavaScript which will use the JsMVA to produce plots from JSON. Finally I added a new functionality to my page: calling
{#% include jsdraw.html part='1' file='json_name' method='jsmva_drawing_method' %}
will produce the nice plots. You can see example for this in week 4 and week 5.
Small stuffs
DefaultDataSetInfo() and Log
I solved the privacy problems what occurred when I tried to use TMVA::DefaultDataSetInfo()
from python. In last week I solved this
problem by making the function public, but from TMVA part I got some concerns about this, so I wrote a new method JsMVA.DataLoader.__DefaultDataSetInfo
, which won’t be accessible in notebook environment but do the same in python as the TMVA::DefaultDataSetInfo()
.
The implementation of this is the following:
I also needed to put the TMVA::Configurable::Log()
function public because I had to have access to that function in python. Now I create
a new TMVA::MsgLogger
object in JsMVA.DataLoader
and I use this when I need access to logging.
Classifier Cut Efficiencies
I had some problems with factory.DrawCutEfficiencies(dataset, method)
function: the “Significance” axis x position depended on the
method, which made the whole plot look awful, because for example if for method MLP the axis was at right place, when I made the same plot
for method BDT the axis moved inside the plot. I was able to solve the x coordinate problem. The y coordinate position of the axis still depends on the method, and I don’t see why (the y range not really changes). My solution is the following:
Neural networks
The main part of this week was creating a JavaScript visualization for Neural Networks. To do this first, I learnt about
d3js. I created NeuralNetwork.js, which gets the network properties and create a visualization from that.
When we call factory.DrawNeuralNetwork
from Jupyter notebook, then this method will get the weights of network from the XML file,
and creates a JSON string, after this, inserts a JavaScript code in notebook output. This script will call the
JsMVA.drawNeuralNetwork(divID, neuralNetworkJSON)
function which will use NeuralNetwork.js to produce a visualization for the network.
- Example:
- Result:
- Interaction:
- Mouse-over (neuron, synapse): focusing
- Zooming and grab and move supported
- Reset: double click