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 K. Bradley (JIRA)" <ji...@apache.org> on 2016/09/06 20:51:21 UTC

[jira] [Commented] (SPARK-11478) ML StringIndexer return inconsistent schema

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

Joseph K. Bradley commented on SPARK-11478:
-------------------------------------------

I'm not sure if it was on purpose.  I could see two arguments:
* Should not be nullable: MLlib algorithms all assume data are complete, with no missing fields.
* Should be nullable: Algorithms could (should?) be modified to support nullable values.

Is this issue a blocker for any workloads, or is it just an oddity?  I'll downgrade it to minor unless someone protests.

> ML StringIndexer return inconsistent schema
> -------------------------------------------
>
>                 Key: SPARK-11478
>                 URL: https://issues.apache.org/jira/browse/SPARK-11478
>             Project: Spark
>          Issue Type: Bug
>          Components: ML
>            Reporter: Yanbo Liang
>
> ML StringIndexer transform and transformSchema return inconsistent schema.
> {code}
> val data = sc.parallelize(Seq((0, "a"), (1, "b"), (2, "c"), (3, "a"), (4, "a"), (5, "c")), 2)
> val df = sqlContext.createDataFrame(data).toDF("id", "label")
> val indexer = new StringIndexer()
>   .setInputCol("label")
>   .setOutputCol("labelIndex")
>   .fit(df)
> val transformed = indexer.transform(df)
> println(transformed.schema.toString())
> println(indexer.transformSchema(df.schema))
> The nullable of "labelIndex" return inconsistent value:
> StructType(StructField(id,IntegerType,false), StructField(label,StringType,true), StructField(labelIndex,DoubleType,true))
> StructType(StructField(id,IntegerType,false), StructField(label,StringType,true), StructField(labelIndex,DoubleType,false))
> {code}



--
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