Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Normal/MultivariateNormal PDFs #40

Merged
merged 18 commits into from
Jun 21, 2024
Merged

Add Normal/MultivariateNormal PDFs #40

merged 18 commits into from
Jun 21, 2024

Conversation

jackaraz
Copy link
Member

@jackaraz jackaraz commented Jun 19, 2024

This PR extends the PDF list with normal and multivariate normal distributions:

spey.AvailableBackends()
# ['pyhf',
#  'pyhf.simplify',
#  'pyhf.uncorrelated_background',
#  'default_pdf.correlated_background',
#  'default_pdf.effective_sigma',
#  'default_pdf.multivariate_normal',
#  'default_pdf.normal',
#  'default_pdf.poisson',
#  'default_pdf.third_moment_expansion',
#  'default_pdf.uncorrelated_background']


pdf_wrapper = spey.get_backend("default_pdf.multivariate_normal")
statistical_model1 = pdf_wrapper(
    signal_yields=[12.0, 15.0],
    background_yields=[50.0,48.0],
    data=[36, 33],
    covariance_matrix=[[144.0,13.0], [25.0, 256.0]],
)

pdf_wrapper = spey.get_backend("default_pdf.normal")
statistical_model2 = pdf_wrapper(
    signal_yields=[12.0, 15.0],
    background_yields=[50.0,48.0],
    data=[36, 33],
    absolute_uncertainties=[20.0,10.0],
)

print(statistical_model2.chi2())
# 7.949999999999935

print(statistical_model1.exclusion_confidence_level(), statistical_model2.exclusion_confidence_level())
# ([0.9591145211259625], [0.9890014596358632])

@jackaraz jackaraz changed the title Gaussian Add Normal/MultivariateNormal PDFs Jun 19, 2024
@jackaraz jackaraz self-assigned this Jun 19, 2024
@jackaraz jackaraz added enhancement New feature or request simplified likelihoods simplified likelihood interface related issues labels Jun 19, 2024
@jackaraz jackaraz added Likelihood Modification or addition of likelihood prescriptions and removed simplified likelihoods simplified likelihood interface related issues labels Jun 19, 2024
@jackaraz
Copy link
Member Author

Note: Autograd does not work with numpy v2.0.0. Thus numpy version has been limited to be less than 2.

@jackaraz jackaraz marked this pull request as ready for review June 21, 2024 02:27
@jackaraz jackaraz merged commit ec414c0 into main Jun 21, 2024
@jackaraz jackaraz deleted the gaussian branch June 21, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Likelihood Modification or addition of likelihood prescriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant