-
Notifications
You must be signed in to change notification settings - Fork 52
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
Median calculation in Threshold #21
Comments
uups !
that bug was in there for a log time!
actually the median value was added by a contributor and i did not reallly
check it's functionality well enough !
i'll have a look when time permits,
|
the code for median was contributed before Brainbay was under version control. the buckets are used in order to prevent sorting the incoming values (to save computation effort particularily for larger intervals). they divide the whole singal range into 1024 "bins" of equal size (sacrificing precision). for an incoming value it's associated bin is increased by one. so above for loop IMO makes sense to find the bottom x% or top x% of the values (represented by bottom / top numtrue bin entries, where numtrue is the number of samples in that interval * x/100) |
OK, I thought the traditional use of the term median was being used (middle bucket). The fan on my VR-ready laptop engages when BrainBay runs, so I suppose all the optimization that can be done is worth it. -- new values outside the min/max settings get clipped to the lowest/highest bucket in incoming_data method. Not sure what impact that may have. |
I noticed that the use of median seemed to favor the last value of the range instead of the whole range of values used in the interval. I checked the calculation and the median calculation only uses the last iterator value:
for (i = 0, sum = 0; (i <= 1024) && (sum < numtrue); i++)
{
sum += buckets[i];
}
to_input = size_value(0.0f,1024.0f,(float)i,in_ports[0].in_min,in_ports[0].in_max,0);
It looks like the buckets need to be sorted then the middle value in the list should be chosen.
The text was updated successfully, but these errors were encountered: