Github user MechCoder commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7879#discussion_r36062974
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -1110,6 +1110,80 @@ class PCAModel(JavaModel):
         """
     
     
    +@inherit_doc
    +class RFormula(JavaEstimator, HasFeaturesCol, HasLabelCol):
    +    """
    +    .. note:: Experimental
    +
    +    Implements the transforms required for fitting a dataset against an
    +    R model formula. Currently we support a limited subset of the R
    +    operators, including '~', '+', '-', and '.'. Also see the R formula
    +    docs:
    +    http://stat.ethz.ch/R-manual/R-patched/library/stats/html/formula.html
    +
    +    >>> df = sqlContext.createDataFrame([
    +    ...     (1.0, 1.0, "a"),
    +    ...     (0.0, 2.0, "b"),
    +    ...     (0.0, 0.0, "a")
    +    ... ], ["y", "x", "s"])
    +    >>> rf = RFormula(formula="y ~ x + s")
    +    >>> rf.fit(df).transform(df).show()
    --- End diff --
    
    Out of curiosity, in the test here 
(https://github.com/apache/spark/blob/master/mllib/src/test/scala/org/apache/spark/ml/feature/RFormulaSuite.scala#L104)
 why isn't the vector of dimension 4 (2 from the OneHotEncoder and two others), 
since there are three terms?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to