You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wojciech Szymanski (JIRA)" <ji...@apache.org> on 2017/02/23 23:48:44 UTC
[jira] [Commented] (SPARK-19714) Bucketizer Bug Regarding Handling
Unbucketed Inputs
[ https://issues.apache.org/jira/browse/SPARK-19714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15881568#comment-15881568 ]
Wojciech Szymanski commented on SPARK-19714:
--------------------------------------------
IMHO Bucketizer works as expected. I guess that from your point of view, invalid value is a number out of range, i.e. 0,1,2,3,4, but from Spark point of view, invalid value is not a number.
{code}
if (getHandleInvalid == Bucketizer.SKIP_INVALID) {
// "skip" NaN option is set, will filter out NaN values in the dataset
(dataset.na.drop().toDF(), false)
}
{code}
I fully agree that dosc for handleInvalid might be confusing, since definition of invalid values is missing:
{code}
/**
* Param for how to handle invalid entries. Options are 'skip' (filter out rows with
* invalid values), 'error' (throw an error), or 'keep' (keep invalid values in a special
* additional bucket).
* Default: "error"
* @group param
*/
val handleInvalid: Param[String]
{code}
I would suggest that I update the dosc by clarifying what kind of invalid values will be filtered out if 'skip' strategy is used.
I am not sure if introducing a new strategy for handling values out of range will be welcomed by the community.
> Bucketizer Bug Regarding Handling Unbucketed Inputs
> ---------------------------------------------------
>
> Key: SPARK-19714
> URL: https://issues.apache.org/jira/browse/SPARK-19714
> Project: Spark
> Issue Type: Bug
> Components: ML, MLlib
> Affects Versions: 2.1.0
> Reporter: Bill Chambers
>
> {code}
> contDF = spark.range(500).selectExpr("cast(id as double) as id")
> import org.apache.spark.ml.feature.Bucketizer
> val splits = Array(5.0, 10.0, 250.0, 500.0)
> val bucketer = new Bucketizer()
> .setSplits(splits)
> .setInputCol("id")
> .setHandleInvalid("skip")
> bucketer.transform(contDF).show()
> {code}
> You would expect that this would handle the invalid buckets. However it fails
> {code}
> Caused by: org.apache.spark.SparkException: Feature value 0.0 out of Bucketizer bounds [5.0, 500.0]. Check your features, or loosen the lower/upper bound constraints.
> {code}
> It seems strange that handleInvalud doesn't actually handleInvalid inputs.
> Thoughts anyone?
--
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