Aug-06-2019, 03:01 PM
(Aug-05-2019, 11:54 PM)scidam Wrote:(Aug-05-2019, 07:35 PM)Zandar Wrote: Specifically, I can't figure out how to fit 2D histograms.Is this about computing probability density estimations, e.g. using kernel approaches?
Consider seaborn package. Also, take a look at Scipy. These functions can be used to get smooth pdf-estimations by sample data.
Thanks for the reply! It's about getting parameters in order to normalise the distributions to each other; so, for the above graph, running the x-axis parameter (nMIP) through an equation in order to make the graph a straight line. For instance, here's a plot I made doing that with a Keras/TensorFlow machine learning algorithm (very simple one; I'm still learning):
I've also used Seaborn a bit for plotting, but I'm having trouble using it for the functionality mentioned.
I'll show what I'm trying to do with ROOT plots for clarity. Here's a plot of the distribution, fitted with an order 3 polynomial:
I can get the parameters of the polynomial fit and then simply redraw the histogram, but instead of nMIP I use p0+p1*nMIP+p2*nMIP^2+p3*nMIP^3, which gives this:
The fit is done on the first histogram as outlined in the OP. I've played around with Seaborn a bit and it seems like a very powerful tool (as well as scipy curve_fit), but I can't find out how to use them for fitting 2D histograms. I can pull out information, which is I think what you're referring to with probability density estimations, but I can't actually fit to a function like this. It's very possible that I simply don't know how to use kernel approaches to do this (I'm not familiar with that concept; I've done a ton of math so far for this degree path, but not a lot of coding).
Thanks for the feedback!
And just because we all like pretty plots, here's using seaborn to plot the ML graph as a kde with jet colours:
Python really is a step up in display and simplicity vs ROOT.