huaxingao commented on a change in pull request #27571: 
[SPARK-30819][SPARKR][ML]  Add FMRegressor wrapper to SparkR
URL: https://github.com/apache/spark/pull/27571#discussion_r379882502
 
 

 ##########
 File path: R/pkg/tests/fulltests/test_mllib_regression.R
 ##########
 @@ -551,4 +551,33 @@ test_that("spark.survreg", {
   }
 })
 
+
+test_that("spark.fmRegressor", {
+  df <- suppressWarnings(createDataFrame(iris))
+
+  model <- spark.fmRegressor(
+    df,  Sepal_Width ~ .,
+    regParam = 0.01, maxIter = 10, fitLinear = TRUE
+  )
+
+  prediction1 <- predict(model, df)
+  expect_is(prediction1, "SparkDataFrame")
+
+  # Test model save/load
+  if (windows_with_hadoop()) {
+    modelPath <- tempfile(pattern = "spark-fmregressor", fileext = ".tmp")
+    write.ml(model, modelPath)
+    model2 <- read.ml(modelPath)
+
+    expect_is(model2, "FMRegressionModel")
+
+    prediction2 <- predict(model2, df)
+    expect_equal(
+      collect(prediction1),
+      collect(prediction2)
+    )
+  }
+})
+
+
 
 Review comment:
   nit: delete extra line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to