spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zhengruifeng (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-20711) MultivariateOnlineSummarizer incorrect min/max for identical NaN feature
Date Fri, 12 May 2017 07:38:04 GMT

    [ https://issues.apache.org/jira/browse/SPARK-20711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16007748#comment-16007748
] 

zhengruifeng commented on SPARK-20711:
--------------------------------------

[~mlnick] It seems that in current implementation {{min/max}} will ignore {{NaN}}
{code}
scala> import org.apache.spark.mllib.stat._
import org.apache.spark.mllib.stat._

scala> val summarizer = new MultivariateOnlineSummarizer()
summarizer: org.apache.spark.mllib.stat.MultivariateOnlineSummarizer = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2d1f3639

scala> import org.apache.spark.mllib.linalg.{Vector, Vectors}
import org.apache.spark.mllib.linalg.{Vector, Vectors}

scala> summarizer.add(Vectors.dense(Double.NaN, -10.0))
res0: summarizer.type = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2d1f3639

scala> summarizer.add(Vectors.dense(Double.NaN, Double.NaN))
res1: summarizer.type = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2d1f3639

scala> summarizer.max
res2: org.apache.spark.mllib.linalg.Vector = [-1.7976931348623157E308,-10.0]

scala> summarizer.mean
res3: org.apache.spark.mllib.linalg.Vector = [NaN,NaN]

scala> summarizer.count
res4: Long = 2

scala> summarizer.normL1
res5: org.apache.spark.mllib.linalg.Vector = [NaN,NaN]

scala> summarizer.normL2
res6: org.apache.spark.mllib.linalg.Vector = [NaN,NaN]

scala> summarizer.variance
res7: org.apache.spark.mllib.linalg.Vector = [NaN,NaN]
{code}

> MultivariateOnlineSummarizer incorrect min/max for identical NaN feature
> ------------------------------------------------------------------------
>
>                 Key: SPARK-20711
>                 URL: https://issues.apache.org/jira/browse/SPARK-20711
>             Project: Spark
>          Issue Type: Bug
>          Components: ML
>    Affects Versions: 2.2.0
>            Reporter: zhengruifeng
>            Priority: Minor
>
> {code}
> scala> val summarizer = new MultivariateOnlineSummarizer()
> summarizer: org.apache.spark.mllib.stat.MultivariateOnlineSummarizer = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2ac58d
> scala> summarizer.add(Vectors.dense(Double.NaN, -10.0))
> res20: summarizer.type = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2ac58d
> scala> summarizer.add(Vectors.dense(Double.NaN, 2.0))
> res21: summarizer.type = org.apache.spark.mllib.stat.MultivariateOnlineSummarizer@2ac58d
> scala> summarizer.min
> res22: org.apache.spark.mllib.linalg.Vector = [1.7976931348623157E308,-10.0]
> scala> summarizer.max
> res23: org.apache.spark.mllib.linalg.Vector = [-1.7976931348623157E308,2.0]
> {code}
> For a feature only containing {{Double.NaN}}, the returned max is {{Double.MinValue}}
and the min is {{Double.MaxValue}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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


Mime
View raw message