juliahep / litehf.jl Goto Github PK
View Code? Open in Web Editor NEWLight-weight HistFactory in pure Julia, attempts to be compatible with `pyhf` json format
License: MIT License
Light-weight HistFactory in pure Julia, attempts to be compatible with `pyhf` json format
License: MIT License
upstream:
apparently there's a small set of EFT / SUSY model where the internal is conserved by physics and only the shape is different.
and somehow this may require special likelihood terms to capture
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Hi. Can you please a CITATION.cff file with information on how you want LiteHF cited? This would be quite useful for properly referencing and citing the code.
Using the sample file:
with open("./test/pyhfjson/sample_normsys.json") as serialized:
spec = json.load(serialized)
workspace = pyhf.Workspace(spec)
pdf_pyhf = workspace.model(modifier_settings={
'normsys': {'interpcode': 'code1'},
'histosys': {'interpcode': 'code0'}}
)
data_pyhf = workspace.data(pdf_pyhf)
calc = pyhf.infer.calculators.AsymptoticCalculator(data_pyhf, pdf_pyhf, test_stat="q0")
In [21]: asimov_data = pyhf.infer.calculators.generate_asimov_data(1.0, calc.data, calc.pdf, calc
...: .init_pars, calc.par_bounds, calc.fixed_params)
In [26]: asimov_data
Out[26]: array([33.24940695, 22.79129107, 13.37482208, 9.16658759, 0.15552048])
In [23]: pyhf.infer.test_statistics.q0(0.0, calc.data, calc.pdf, calc.init_pars, calc.par_bounds,
...: calc.fixed_params)
Out[23]: array(6.57480397)
In [24]: pyhf.infer.test_statistics.q0(0.0, asimov_data, calc.pdf, calc.init_pars, calc.par_bound
...: s, calc.fixed_params)
Out[24]: array(4.15381162)
In Julia
julia> using LiteHF, Optim
julia> RR = build_pyhf(load_pyhfjson("./test/pyhfjson/sample_normsys.json"));
julia> original_LL = pyhf_logjointof(RR.expected, RR.observed, RR.priors);
julia> function condLL(rest)
original_LL(vcat(1.0, rest)) #q0 implies Asimov_mu == 1
end
julia> Asimov_para = vcat(1.0, Optim.maximizer(LiteHF.opt_maximize(condLL, RR.inits[2:end])))
2-element Vector{Float64}: # agrees with pyhf
1.0
0.15529785156250003
julia> Asimov_data = RR.expected(Asimov_para) # agrees with pyhf
([33.247581721021554, 22.790135089980318, 13.374274516306468, 9.16634422946954],)
julia> LiteHF.get_q0(original_LL, RR.inits)(0.0)
6.574804029034912 #agrees with pyhf
julia> Asimov_L = pyhf_logjointof(RR.expected, Asimov_data, RR.priors);
julia> LiteHF.get_q0(Asimov_L, RR.inits)(0.0)
4.352907587323511 #wtf?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.