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

    https://github.com/apache/spark/pull/9884#discussion_r56428323
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/RFormulaSuite.scala ---
    @@ -214,4 +215,41 @@ class RFormulaSuite extends SparkFunSuite with 
MLlibTestSparkContext {
             new NumericAttribute(Some("a_foo:b_zz"), Some(4))))
         assert(attrs === expectedAttrs)
       }
    +
    +  test("read/write: RFormula") {
    +    val rFormula = new RFormula()
    +      .setFormula("id ~ a:b")
    +      .setFeaturesCol("myFeatures")
    +      .setLabelCol("myLabels")
    +
    +    testDefaultReadWrite(rFormula)
    +  }
    +
    +  test("read/write: RFormulaModel") {
    +    def checkModelData(model: RFormulaModel, model2: RFormulaModel): Unit 
= {
    +      assert(model.uid === model2.uid)
    +
    +      assert(model.resolvedFormula.label === model2.resolvedFormula.label)
    +      assert(model.resolvedFormula.terms === model2.resolvedFormula.terms)
    +      assert(model.resolvedFormula.hasIntercept === 
model2.resolvedFormula.hasIntercept)
    +
    +      assert(model.pipelineModel.uid === model.pipelineModel.uid)
    +
    +      model.pipelineModel.stages.zip(model2.pipelineModel.stages).foreach {
    +        case (transformer1, transformer2) =>
    +          assert(transformer1.uid === transformer2.uid)
    +          assert(transformer1.params === transformer2.params)
    +      }
    +    }
    +
    +    val dataset = sqlContext.createDataFrame(
    +      Seq((1, "foo", "zq"), (2, "bar", "zq"), (3, "bar", "zz"))
    +    ).toDF("id", "a", "b")
    +
    +    val rFormula = new RFormula().setFormula("id ~ a:b")
    +
    +    val model = rFormula.fit(dataset)
    +    val newModel = testDefaultReadWrite(model)
    --- End diff --
    
    Does it not work to use testDefaultEstimatorReadWrite instead?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to