-
Notifications
You must be signed in to change notification settings - Fork 1
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
General toyMC unbinned method plus max-slice method #49
base: master
Are you sure you want to change the base?
Conversation
As an example, |
…ing very simple rules via "computer says no" rather than just putting in the extra line itself.
…stEqual (places=2 instead of decimals=2?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @kdund for adding this, looks good! A few minor comments but then I think this is good to go! 🚀
GOFevaluation/evaluator_base.py
Outdated
self.distance_measure = distance_measure | ||
|
||
def get_pvalue(self, n_toys=10000, generator_kwargs={}, distance_measure_kwargs={}): | ||
self.gof = self.distance_measure(self.data, **distance_measure_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest defining a trivial method get_gof
to get the test statistic value so that it has the same interface as the other tests in this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. so this is the reason why people call the test statistic gof
.
return np.abs((t0 - t1 + np.pi) % (2 * np.pi) - np.pi) | ||
|
||
@staticmethod | ||
def get_best_partition(data_t, opening_angle=np.pi, test_angles=None, return_best_angle=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a short description of all parameters (with types) to the docstring :)
GOFevaluation/evaluators_1d.py
Outdated
an equal or greater portion in a slice set in the generator | ||
angles in radians | ||
""" | ||
def __init__(self, data, opening_angle=np.pi, fixed_length=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opening_angle
is not used in the init and fixed_length
should be briefly explained in the docstring
This PR implements a generalised GOF where you need to provide a toyMC generator and distance measure given your model, which then runs toyMCs, computes the distance measure for each and returns the p-value based on that.
In particular, it also provides a circular max-slice GOF evaluators to compute how asymmetrical a theta-distribution is.