You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Grzegorz Chilkiewicz (JIRA)" <ji...@apache.org> on 2016/01/08 13:49:39 UTC

[jira] [Updated] (SPARK-12711) ML StopWordsRemover does not protect itself from column name duplication

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

Grzegorz Chilkiewicz updated SPARK-12711:
-----------------------------------------
    Description: 
At work we were 'taking a closer look' at ML transformers&estimators and I spotted that anomally.
On first look, resolution looks simple:
Add to StopWordsRemover.transformSchema line (as is done in e.g. PCA.transformSchema, StandardScaler.transformSchema, OneHotEncoder.transformSchema):
{code:scala}
require(!schema.fieldNames.contains($(outputCol)), s"Output column ${$(outputCol)} already exists.")
{code}

Am I correct? Is that a bug?    If yes - I am willing to prepare an appropriate pull request.
Maybe a better idea is to make use of super.transformSchema in StopWordsRemover (and possibly in all other places)?


Links to files at github, mentioned above:
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala#L147
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/Transformer.scala#L109-L111
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StandardScaler.scala#L101-L102
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/PCA.scala#L138-L139
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/OneHotEncoder.scala#L75-L76


  was:
At work we were 'taking a closer look' at ML transformers&estimators and I spotted that anomally.
On first look, resolution looks simple:
Add to StopWordsRemover.transformSchema line (as is done in e.g. PCA.transformSchema, StandardScaler.transformSchema, OneHotEncoder.transformSchema):
require(!schema.fieldNames.contains($(outputCol)), s"Output column ${$(outputCol)} already exists.")

Am I correct? Is that a bug?    If yes - I am willing to prepare an appropriate pull request.
Maybe a better idea is to make use of super.transformSchema in StopWordsRemover (and possibly in all other places)?


Links to files at github, mentioned above:
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala#L147
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/Transformer.scala#L109-L111
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StandardScaler.scala#L101-L102
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/PCA.scala#L138-L139
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/OneHotEncoder.scala#L75-L76



> ML StopWordsRemover does not protect itself from column name duplication
> ------------------------------------------------------------------------
>
>                 Key: SPARK-12711
>                 URL: https://issues.apache.org/jira/browse/SPARK-12711
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, MLlib
>    Affects Versions: 1.6.0
>            Reporter: Grzegorz Chilkiewicz
>            Priority: Trivial
>              Labels: ml, mllib, newbie, suggestion
>
> At work we were 'taking a closer look' at ML transformers&estimators and I spotted that anomally.
> On first look, resolution looks simple:
> Add to StopWordsRemover.transformSchema line (as is done in e.g. PCA.transformSchema, StandardScaler.transformSchema, OneHotEncoder.transformSchema):
> {code:scala}
> require(!schema.fieldNames.contains($(outputCol)), s"Output column ${$(outputCol)} already exists.")
> {code}
> Am I correct? Is that a bug?    If yes - I am willing to prepare an appropriate pull request.
> Maybe a better idea is to make use of super.transformSchema in StopWordsRemover (and possibly in all other places)?
> Links to files at github, mentioned above:
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala#L147
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/Transformer.scala#L109-L111
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/StandardScaler.scala#L101-L102
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/PCA.scala#L138-L139
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/OneHotEncoder.scala#L75-L76



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