This package is aiming to categorize labeled data in terms of a global figure of merit. In high energy physics, categorization of collision data is done by maximizing the discovery significance. This package run on unbinned binary datasets.
Install like any other python package:
pip install binopt --user
or:
git clone git@github.com:yhaddad/binopt.git cd binopt/ pip install .
sevent = 1000
bevent = 10000
X = np.concatenate((
expit(np.random.normal(+2.0, 2.0, sevent)),
expit(np.random.normal(-0.5, 2.0, bevent))
))
Y = np.concatenate((
np.ones(sevent),
np.zeros(bevent)
))
W = np.concatenate((np.ones(sevent), np.ones(bevent)))
binner = binopt.optimize_bin(
nbins=3, range=[0, 1],
drop_last_bin=True,
fix_upper=True,
fix_lower=False,
use_kde_density=True
)
opt = binner.fit(
X, Y, sample_weights=W,
method="Nelder-Mead",
breg=None, fom="AMS2"
)
print "bounds : ", opt.x
print "signif : ", binner.binned_score(opt.x)
print "Nsig : ", binner.binned_stats(opt.x)[0]
print "Nbkg : ", binner.binned_stats(opt.x)[1]
- Free software: GNU General Public License v3
- Documentation: https://binopt.readthedocs.io.
- Dependencies scanned by PyUp.io