You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2020/05/11 09:44:00 UTC

[jira] [Commented] (SPARK-31676) QuantileDiscretizer raise error parameter splits given invalid value (splits array includes -0.0 and 0.0)

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

Apache Spark commented on SPARK-31676:
--------------------------------------

User 'WeichenXu123' has created a pull request for this issue:
https://github.com/apache/spark/pull/28498

> QuantileDiscretizer raise error parameter splits given invalid value (splits array includes -0.0 and 0.0)
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-31676
>                 URL: https://issues.apache.org/jira/browse/SPARK-31676
>             Project: Spark
>          Issue Type: Bug
>          Components: ML
>    Affects Versions: 2.4.5, 3.0.0
>            Reporter: Weichen Xu
>            Priority: Major
>
> Reproduce code
> {code}
> import scala.util.Random
> val rng = new Random(3)
> val a1 = Array.tabulate(200)(_=>rng.nextDouble * 2.0 - 1.0) ++ Array.fill(20)(0.0) ++ Array.fill(20)(-0.0)
> import spark.implicits._
> val df1 = sc.parallelize(a1, 2).toDF("id")
> import org.apache.spark.ml.feature.QuantileDiscretizer
> val qd = new QuantileDiscretizer().setInputCol("id").setOutputCol("out").setNumBuckets(200).setRelativeError(0.0)
> val model = qd.fit(df1)
> {code}
> Raise error like:
>   at org.apache.spark.ml.param.Param.validate(params.scala:76)
>   at org.apache.spark.ml.param.ParamPair.<init>(params.scala:634)
>   at org.apache.spark.ml.param.Param.$minus$greater(params.scala:85)
>   at org.apache.spark.ml.param.Params.set(params.scala:713)
>   at org.apache.spark.ml.param.Params.set$(params.scala:712)
>   at org.apache.spark.ml.PipelineStage.set(Pipeline.scala:41)
>   at org.apache.spark.ml.feature.Bucketizer.setSplits(Bucketizer.scala:77)
>   at org.apache.spark.ml.feature.QuantileDiscretizer.fit(QuantileDiscretizer.scala:231)
>   ... 49 elided
> java.lang.IllegalArgumentException: quantileDiscretizer_479bb5a3ca99 parameter splits given invalid value [-Infinity,-0.9986765732730827,..., -0.0, 0.0, ..., 0.9907184077958491,Infinity]
> 0.0 > -0.0 is False, which break the paremater validation check.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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