Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/18496#discussion_r125522676
--- Diff: R/pkg/tests/fulltests/test_mllib_tree.R ---
@@ -212,6 +212,23 @@ test_that("spark.randomForest", {
expect_equal(length(grep("1.0", predictions)), 50)
expect_equal(length(grep("2.0", predictions)), 50)
+ # Test unseen labels
+ data <- data.frame(clicked = base::sample(c(0, 1), 10, replace = TRUE),
+ someString = base::sample(c("this", "that"), 10,
replace = TRUE),
+ stringsAsFactors = FALSE)
+ trainidxs <- base::sample(nrow(data), nrow(data) * 0.7)
+ traindf <- as.DataFrame(data[trainidxs, ])
+ testdf <- as.DataFrame(rbind(data[-trainidxs, ], c(0, "the other")))
+ model <- spark.randomForest(traindf, clicked ~ ., type =
"classification",
+ maxDepth = 10, maxBins = 10, numTrees = 10)
+ predictions <- predict(model, testdf)
+ expect_error(collect(predictions))
--- End diff --
actually, this is a bit strange - so the spark.randomForest call and
predict runs successfully, only fails when the predictions are collected?
---
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]