if (FALSE) {
sc <- spark_connect("local")
tbl_iris <- copy_to(sc, iris)
iris_split <- sdf_random_split(tbl_iris, training = 0.5, test = 0.5)
model <- ml_random_forest(iris_split$training, "Species ~ .")
tbl_predictions <- ml_predict(model, iris_split$test)
ml_metrics_multiclass(tbl_predictions)
# Request different metrics
ml_metrics_multiclass(tbl_predictions, metrics = c("recall", "precision"))
# Request metrics not translated by the function, but valid in Spark
ml_metrics_multiclass(tbl_predictions, metrics = c("logLoss", "hammingLoss"))
}
Run the code above in your browser using DataLab