Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Rounding
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Randomized rounding to an integer=== ====Alternating tie-breaking==== One method, more obscure than most, is to alternate direction when rounding a number with 0.5 fractional part. All others are rounded to the closest integer. Whenever the fractional part is 0.5, alternate rounding up or down: for the first occurrence of a 0.5 fractional part, round up, for the second occurrence, round down, and so on. Alternatively, the first 0.5 fractional part rounding can be determined by a [[random seed]]. "Up" and "down" can be any two rounding methods that oppose each other - toward and away from positive infinity or toward and away from zero. If occurrences of 0.5 fractional parts occur significantly more than a restart of the occurrence "counting", then it is effectively bias free. With guaranteed zero bias, it is useful if the numbers are to be summed or averaged. ====Random tie-breaking==== If the fractional part of {{mvar|x}} is 0.5, choose {{mvar|y}} randomly between {{math|''x'' + 0.5}} and {{math|''x'' β 0.5}}, with equal probability. All others are rounded to the closest integer. Like round-half-to-even and round-half-to-odd, this rule is essentially free of overall bias, but it is also fair among even and odd {{mvar|y}} values. An advantage over alternate tie-breaking is that the last direction of rounding on the 0.5 fractional part does not have to be "remembered". ====Stochastic rounding==== Rounding as follows to one of the closest integer toward negative infinity and the closest integer toward positive infinity, with a probability dependent on the proximity is called [[stochastic]] rounding and will give an unbiased result on average.<ref name="stochastic">{{cite arXiv |title=Deep Learning with Limited Numerical Precision |eprint=1502.02551 |first1=Suyog |last1=Gupta |first2=Ankur |last2=Angrawl |first3=Kailash |last3=Gopalakrishnan |first4=Pritish |last4=Narayanan |page=3 |date=9 February 2016 |class=cs.LG}}</ref> :<math>\operatorname {Round} (x) = \begin{cases} \lfloor x \rfloor & \text { with probability } 1 - (x - \lfloor x \rfloor) = \lfloor x \rfloor - x + 1 \\[5mu] \lfloor x \rfloor + 1 & \text { with probability } {x - \lfloor x \rfloor} \end{cases} </math> For example, 1.6 would be rounded to 1 with probability 0.4 and to 2 with probability 0.6. Stochastic rounding can be accurate in a way that a rounding [[function (mathematics)|function]] can never be. For example, suppose one started with 0 and added 0.3 to that one hundred times while rounding the running total between every addition. The result would be 0 with regular rounding, but with stochastic rounding, the expected result would be 30, which is the same value obtained without rounding. This can be useful in [[machine learning]] where the training may use low precision arithmetic iteratively.<ref name="stochastic"/> Stochastic rounding is also a way to achieve 1-dimensional [[dithering]].
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Rounding
(section)
Add topic