You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mengxr <gi...@git.apache.org> on 2015/02/12 12:17:45 UTC

[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

GitHub user mengxr opened a pull request:

    https://github.com/apache/spark/pull/4564

    [SPARK-5769] Set params in constructors and in setParams in Python ML pipelines

    This PR allow Python users to set params in constructors and in setParams, where we use decorator `keyword_only` to force keyword arguments. The trade-off is discussed in the design doc of SPARK-4586.
    
    Generated doc:
    ![screen shot 2015-02-12 at 3 06 58 am](https://cloud.githubusercontent.com/assets/829644/6166491/9cfcd06a-b265-11e4-99ea-473d866634fc.png)
    
    CC: @davies @rxin

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mengxr/spark py-pipeline-kw

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/4564.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4564
    
----
commit 8e59180431f4db045160401da4f785f8a34be923
Author: Xiangrui Meng <me...@databricks.com>
Date:   2015-02-12T10:34:56Z

    add setParams and make constructors take params, where we force keyword args

commit c9384b88bbdd87b3f57f84f46e08cfba5f661739
Author: Xiangrui Meng <me...@databricks.com>
Date:   2015-02-12T11:07:20Z

    fix sphinx doc

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4564#discussion_r24723962
  
    --- Diff: python/pyspark/ml/classification.py ---
    @@ -32,22 +32,46 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredicti
     
         >>> from pyspark.sql import Row
         >>> from pyspark.mllib.linalg import Vectors
    -    >>> dataset = sqlCtx.inferSchema(sc.parallelize([ \
    -            Row(label=1.0, features=Vectors.dense(1.0)), \
    -            Row(label=0.0, features=Vectors.sparse(1, [], []))]))
    -    >>> lr = LogisticRegression() \
    -            .setMaxIter(5) \
    -            .setRegParam(0.01)
    -    >>> model = lr.fit(dataset)
    +    >>> df = sqlCtx.inferSchema(sc.parallelize([
    --- End diff --
    
    #4557 is closed, so you change update the tests (examples) to use new API.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/4564


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74064635
  
      [Test build #27348 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27348/consoleFull) for   PR 4564 at commit [`fdde5fc`](https://github.com/apache/spark/commit/fdde5fcf6219831c5c71350fc806dc97e6b3292f).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4564#discussion_r24707888
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -29,18 +29,45 @@ class Tokenizer(JavaTransformer, HasInputCol, HasOutputCol):
         splits it by white spaces.
     
         >>> from pyspark.sql import Row
    -    >>> dataset = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    -    >>> tokenizer = Tokenizer() \
    -            .setInputCol("text") \
    -            .setOutputCol("words")
    -    >>> print tokenizer.transform(dataset).head()
    +    >>> df = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    +    >>> tokenizer = Tokenizer(inputCol="text", outputCol="words")
    +    >>> print tokenizer.transform(df).head()
         Row(text=u'a b c', words=[u'a', u'b', u'c'])
    -    >>> print tokenizer.transform(dataset, {tokenizer.outputCol: "tokens"}).head()
    +    >>> # Change a parameter.
    +    >>> print tokenizer.setParams(outputCol="tokens").transform(df).head()
         Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Temporarily modify a parameter.
    +    >>> print tokenizer.transform(df, {tokenizer.outputCol: "words"}).head()
    +    Row(text=u'a b c', words=[u'a', u'b', u'c'])
    +    >>> print tokenizer.transform(df).head()
    +    Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Must use keyword arguments to specify params.
    +    >>> tokenizer.setParams("text")
    +    Traceback (most recent call last):
    +        ...
    +    TypeError: Method setParams forces keyword arguments.
         """
     
         _java_class = "org.apache.spark.ml.feature.Tokenizer"
     
    +    @keyword_only
    +    def __init__(self, inputCol="input", outputCol="output"):
    --- End diff --
    
    It may cause troubles in other parameters that specify column names, for example `featuresCol` and `labelCol`. This is not part of this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74055827
  
      [Test build #27347 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27347/consoleFull) for   PR 4564 at commit [`c9384b8`](https://github.com/apache/spark/commit/c9384b88bbdd87b3f57f84f46e08cfba5f661739).
     * This patch **fails Python style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74222353
  
      [Test build #27425 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27425/consoleFull) for   PR 4564 at commit [`cbc15d3`](https://github.com/apache/spark/commit/cbc15d39b8c0af7be2d6941ec9a346cc920c7a42).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4564#discussion_r24648445
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -29,18 +29,45 @@ class Tokenizer(JavaTransformer, HasInputCol, HasOutputCol):
         splits it by white spaces.
     
         >>> from pyspark.sql import Row
    -    >>> dataset = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    -    >>> tokenizer = Tokenizer() \
    -            .setInputCol("text") \
    -            .setOutputCol("words")
    -    >>> print tokenizer.transform(dataset).head()
    +    >>> df = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    +    >>> tokenizer = Tokenizer(inputCol="text", outputCol="words")
    +    >>> print tokenizer.transform(df).head()
         Row(text=u'a b c', words=[u'a', u'b', u'c'])
    -    >>> print tokenizer.transform(dataset, {tokenizer.outputCol: "tokens"}).head()
    +    >>> # Change a parameter.
    +    >>> print tokenizer.setParams(outputCol="tokens").transform(df).head()
         Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Temporarily modify a parameter.
    +    >>> print tokenizer.transform(df, {tokenizer.outputCol: "words"}).head()
    +    Row(text=u'a b c', words=[u'a', u'b', u'c'])
    +    >>> print tokenizer.transform(df).head()
    +    Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Must use keyword arguments to specify params.
    +    >>> tokenizer.setParams("text")
    +    Traceback (most recent call last):
    +        ...
    +    TypeError: Method setParams forces keyword arguments.
         """
     
         _java_class = "org.apache.spark.ml.feature.Tokenizer"
     
    +    @keyword_only
    +    def __init__(self, inputCol="input", outputCol="output"):
    --- End diff --
    
    Is it possible to use 'input' instead of 'inputCol'? The same for `outputCol`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74214814
  
      [Test build #27424 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27424/consoleFull) for   PR 4564 at commit [`5032097`](https://github.com/apache/spark/commit/5032097c587c5b81f5c73a8d7900eba07559361a).
     * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74458711
  
    Merged into master and branch-1.3.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74441686
  
    LGTM, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74055831
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27347/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74432111
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27530/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74428482
  
      [Test build #27530 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27530/consoleFull) for   PR 4564 at commit [`fedf720`](https://github.com/apache/spark/commit/fedf720692627bff4f87b11946efb27d02d20549).
     * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74056273
  
      [Test build #27348 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27348/consoleFull) for   PR 4564 at commit [`fdde5fc`](https://github.com/apache/spark/commit/fdde5fcf6219831c5c71350fc806dc97e6b3292f).
     * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74064640
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27348/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74214912
  
      [Test build #27424 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27424/consoleFull) for   PR 4564 at commit [`5032097`](https://github.com/apache/spark/commit/5032097c587c5b81f5c73a8d7900eba07559361a).
     * This patch **fails Python style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74215543
  
      [Test build #27425 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27425/consoleFull) for   PR 4564 at commit [`cbc15d3`](https://github.com/apache/spark/commit/cbc15d39b8c0af7be2d6941ec9a346cc920c7a42).
     * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74214914
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27424/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74432107
  
      [Test build #27530 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27530/consoleFull) for   PR 4564 at commit [`fedf720`](https://github.com/apache/spark/commit/fedf720692627bff4f87b11946efb27d02d20549).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4564#discussion_r24648384
  
    --- Diff: python/pyspark/ml/classification.py ---
    @@ -32,22 +32,46 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredicti
     
         >>> from pyspark.sql import Row
         >>> from pyspark.mllib.linalg import Vectors
    -    >>> dataset = sqlCtx.inferSchema(sc.parallelize([ \
    -            Row(label=1.0, features=Vectors.dense(1.0)), \
    -            Row(label=0.0, features=Vectors.sparse(1, [], []))]))
    -    >>> lr = LogisticRegression() \
    -            .setMaxIter(5) \
    -            .setRegParam(0.01)
    -    >>> model = lr.fit(dataset)
    +    >>> df = sqlCtx.inferSchema(sc.parallelize([
    --- End diff --
    
    Wait for #4557, then you could user new API for convert RDD into DataFrame:
    ```
    dataset = rdd.toDF()
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4564#discussion_r24723956
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -29,18 +29,45 @@ class Tokenizer(JavaTransformer, HasInputCol, HasOutputCol):
         splits it by white spaces.
     
         >>> from pyspark.sql import Row
    -    >>> dataset = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    -    >>> tokenizer = Tokenizer() \
    -            .setInputCol("text") \
    -            .setOutputCol("words")
    -    >>> print tokenizer.transform(dataset).head()
    +    >>> df = sqlCtx.inferSchema(sc.parallelize([Row(text="a b c")]))
    +    >>> tokenizer = Tokenizer(inputCol="text", outputCol="words")
    +    >>> print tokenizer.transform(df).head()
         Row(text=u'a b c', words=[u'a', u'b', u'c'])
    -    >>> print tokenizer.transform(dataset, {tokenizer.outputCol: "tokens"}).head()
    +    >>> # Change a parameter.
    +    >>> print tokenizer.setParams(outputCol="tokens").transform(df).head()
         Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Temporarily modify a parameter.
    +    >>> print tokenizer.transform(df, {tokenizer.outputCol: "words"}).head()
    +    Row(text=u'a b c', words=[u'a', u'b', u'c'])
    +    >>> print tokenizer.transform(df).head()
    +    Row(text=u'a b c', tokens=[u'a', u'b', u'c'])
    +    >>> # Must use keyword arguments to specify params.
    +    >>> tokenizer.setParams("text")
    +    Traceback (most recent call last):
    +        ...
    +    TypeError: Method setParams forces keyword arguments.
         """
     
         _java_class = "org.apache.spark.ml.feature.Tokenizer"
     
    +    @keyword_only
    +    def __init__(self, inputCol="input", outputCol="output"):
    --- End diff --
    
    Make sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74222359
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27425/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74055720
  
      [Test build #27347 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27347/consoleFull) for   PR 4564 at commit [`c9384b8`](https://github.com/apache/spark/commit/c9384b88bbdd87b3f57f84f46e08cfba5f661739).
     * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-5769] Set params in constructors and in...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/4564#issuecomment-74215214
  
    @davies I updated the constructor doc signature. Auto-completion works in both iPython and IntelliJ now. The only issue is that the `help` doc in iPython still contains the doc signature. I think this is a minor one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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