-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat: Toy Calculator executor support #1158
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1158 +/- ##
==========================================
- Coverage 98.21% 97.90% -0.32%
==========================================
Files 69 69
Lines 4543 4339 -204
Branches 804 729 -75
==========================================
- Hits 4462 4248 -214
- Misses 48 57 +9
- Partials 33 34 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
script I used to quickly test functionality import pyhf
import pyhf.futures
import concurrent
import time
model = pyhf.simplemodels.hepdata_like([5], [10], [3.5])
data = [12.5] + model.config.auxdata
ntoys = 500
if __name__ == '__main__':
for executor in [pyhf.futures.TrivialExecutor(), concurrent.futures.ProcessPoolExecutor(), concurrent.futures.ThreadPoolExecutor()]:
start = time.time()
result = pyhf.infer.hypotest(1.0, data, model, qtilde=True, calctype='toybased', ntoys=ntoys, executor=executor)
print(f'Executor = {executor}')
print(f'CLs_obs = {result}')
print(f'Took {time.time() - start} seconds for {ntoys} toys.')
executor.shutdown() which results in (numpy)
and for 5k toys (numpy)
and 5k toys (jax)
and 5k toys (torch)
and 5k toys (tensorflow)
|
This pull request introduces 1 alert when merging 6a8f72e into 81c9adb - view on LGTM.com new alerts:
|
using this to test functionality import pyhf
import pyhf.futures
import concurrent
import time
ntoys = 500
if __name__ == '__main__':
for optimizer in ['scipy', 'minuit']:
for backend in ['numpy', 'jax']:
pyhf.set_backend(backend, optimizer)
model = pyhf.simplemodels.uncorrelated_background(
[5],
[10],
[3.5],
)
data = pyhf.tensorlib.astensor([12.5] + model.config.auxdata)
print(f'Backend = {pyhf.tensorlib.name}')
print(f'Optimizer = {pyhf.optimizer.name}')
print(f'ntoys = {ntoys}')
for executor in [
pyhf.futures.TrivialExecutor(),
concurrent.futures.ProcessPoolExecutor(),
concurrent.futures.ThreadPoolExecutor(),
]:
start = time.time()
result = pyhf.infer.hypotest(
1.0,
data,
model,
test_stat='qtilde',
calctype='toybased',
ntoys=ntoys,
executor=executor,
)
print(f' * with Executor = {executor}')
print(f' - CLs_obs = {result:0.6f}')
print(f' - Time = {time.time() - start:0.6f} seconds')
executor.shutdown() |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Description
Lorem ipsum dolor sit amet. See #807.
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: