-
Notifications
You must be signed in to change notification settings - Fork 71
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 support for weighted fraction accumulator #385
base: develop
Are you sure you want to change the base?
Conversation
Thanks for this substantial contribution, I will review it next weekend. I think you can replace the initializer to remove the warning. |
@@ -36,7 +37,8 @@ class fraction { | |||
using const_reference = const value_type&; | |||
using real_type = typename std::conditional<std::is_floating_point<value_type>::value, | |||
value_type, double>::type; | |||
using interval_type = typename utility::wilson_interval<real_type>::interval_type; | |||
using score_type = typename utility::wilson_interval<real_type>; |
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.
score_type should not appear here, because it is not a type that needs to be publicly visible.
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.
This issue should be addressed now. Please take a look.
The failing check is due to the job never starting and eventually timing out. |
This sometimes happens. I restarted the job. If it continues to fail, we can ignore it. Checking compatibility with an ancient compiler becomes less and less useful as time progresses. |
Please let me know if there are any changes I can make to this. |
I apologize for being slow with responding. I appreciate your enthusiasm to contribute to Boost.Histogram. I need some time to carefully think about the APIs, because in Boost we have very high standards in regards to stability. It would be a good idea to start a new subfolder called |
I moved the |
This PR extends
fraction
to weighted samples to address issue #367.I took the approach of creating a new
weighted_fraction
class. This class is a composition of two classes:fraction
and a new internal classsum_of_weights_squared
. I explain the thought process behind these choices.The classes$\sum (w^2)$ . So, I turned this piece of information into a class
sum
,mean
, andfraction
are non-weighted. Each of these classes could almost function as a weighted class, but requires one additional piece of information: the sum of the weights squared, that is to saysum_of_weights_squared
. I created the classweighted_fraction
by puttingfraction
andsum_of_weights_squared
together.The code passes all unit tests (locally), but has
Wpedantic
warnings becausewilson_solve
uses a designated initializer (i.e.,wilson_solve({.n_eff=n_eff, .p_hat=p_hat, .correction=correction})
). There's likely a good way to avoid getting this warning, while also enforcing input meaning, but I'm missing it.