aboutsummaryrefslogtreecommitdiff
path: root/docs/running-on-yarn.md
diff options
context:
space:
mode:
authorAnkur Dave <ankurdave@gmail.com>2014-09-22 13:47:43 -0700
committerJoseph E. Gonzalez <joseph.e.gonzalez@gmail.com>2014-09-22 13:47:43 -0700
commitf9d6220c792b779be385f3022d146911a22c2130 (patch)
tree5bfe8997d09a8c28119a590ddbb3e8ded2f9a138 /docs/running-on-yarn.md
parent56dae30ca70489a62686cb245728b09b2179bb5a (diff)
downloadspark-f9d6220c792b779be385f3022d146911a22c2130.tar.gz
spark-f9d6220c792b779be385f3022d146911a22c2130.tar.bz2
spark-f9d6220c792b779be385f3022d146911a22c2130.zip
[SPARK-3578] Fix upper bound in GraphGenerators.sampleLogNormal
GraphGenerators.sampleLogNormal is supposed to return an integer strictly less than maxVal. However, it violates this guarantee. It generates its return value as follows: ```scala var X: Double = maxVal while (X >= maxVal) { val Z = rand.nextGaussian() X = math.exp(mu + sigma*Z) } math.round(X.toFloat) ``` When X is sampled to be close to (but less than) maxVal, then it will pass the while loop condition, but the rounded result will be equal to maxVal, which will violate the guarantee. For example, if maxVal is 5 and X is 4.9, then X < maxVal, but `math.round(X.toFloat)` is 5. This PR instead rounds X before checking the loop condition, guaranteeing that the condition will hold for the return value. Author: Ankur Dave <ankurdave@gmail.com> Closes #2439 from ankurdave/SPARK-3578 and squashes the following commits: f6655e5 [Ankur Dave] Go back to math.floor 5900c22 [Ankur Dave] Round X in loop condition 6fd5fb1 [Ankur Dave] Run sampleLogNormal bounds check 1000 times 1638598 [Ankur Dave] Round down in sampleLogNormal to guarantee upper bound
Diffstat (limited to 'docs/running-on-yarn.md')
0 files changed, 0 insertions, 0 deletions