You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Joseph E. Gonzalez (JIRA)" <ji...@apache.org> on 2014/09/22 22:52:34 UTC

[jira] [Resolved] (SPARK-3578) GraphGenerators.sampleLogNormal sometimes returns too-large result

     [ https://issues.apache.org/jira/browse/SPARK-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph E. Gonzalez resolved SPARK-3578.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.2.0

Resolved by https://github.com/apache/spark/pull/2439

> GraphGenerators.sampleLogNormal sometimes returns too-large result
> ------------------------------------------------------------------
>
>                 Key: SPARK-3578
>                 URL: https://issues.apache.org/jira/browse/SPARK-3578
>             Project: Spark
>          Issue Type: Bug
>          Components: GraphX
>    Affects Versions: 1.2.0
>            Reporter: Ankur Dave
>            Assignee: Ankur Dave
>            Priority: Minor
>             Fix For: 1.2.0
>
>
> GraphGenerators.sampleLogNormal is supposed to return an integer strictly less than maxVal. However, it violates this guarantee. It generates its return value as follows:
> {code}
> var X: Double = maxVal
> while (X >= maxVal) {
>   val Z = rand.nextGaussian()
>   X = math.exp(mu + sigma*Z)
> }
> math.round(X.toFloat)
> {code}
> 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 fail the test.
> For example, if maxVal is 5 and X is 4.9, then X < maxVal, but math.round(X.toFloat) is 5.
> A solution is to round X down instead of to the nearest integer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org