huaxingao commented on a change in pull request #27570:
[SPARK-30820][SPARKR][ML] Add FMClassifier to SparkR
URL: https://github.com/apache/spark/pull/27570#discussion_r386510001
##########
File path: R/pkg/tests/fulltests/test_mllib_classification.R
##########
@@ -488,4 +488,36 @@ test_that("spark.naiveBayes", {
expect_equal(class(collect(predictions)$clicked[1]), "character")
})
+test_that("spark.fmClassifier", {
+ df <- withColumn(
+ suppressWarnings(createDataFrame(iris)),
+ "Species", otherwise(when(column("Species") == "Setosa", "Setosa"),
"Not-Setosa")
+ )
+
+ model1 <- spark.fmClassifier(
+ df, Species ~ .,
+ regParam = 0.01, maxIter = 10, fitLinear = TRUE, factorSize = 3
+ )
+
+ prediction1 <- predict(model1, df)
+ expect_is(prediction1, "SparkDataFrame")
Review comment:
Seems to me that all the other ML R tests check the prediction result. For
example, in LinearSVM,
```
# Test prediction with string label
prediction <- predict(model, training)
expect_equal(typeof(take(select(prediction, "prediction"), 1)$prediction),
"character")
expected <- c("versicolor", "versicolor", "versicolor", "virginica",
"virginica",
"virginica", "virginica", "virginica", "virginica",
"virginica")
expect_equal(sort(as.list(take(select(prediction, "prediction"),
10))[[1]]), expected)
```
Is it OK if we do something similar here?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]