Evaluate the Model on a Validation Set

R/ml_evaluate.R, R/ml_evaluator.R

ml_evaluate

Description

Compute performance metrics.

Usage

 
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_model_logistic_regression'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_logistic_regression_model'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_model_linear_regression'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_linear_regression_model'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_model_generalized_linear_regression'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_generalized_linear_regression_model'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_model_clustering'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_model_classification'
ml_evaluate(x, dataset) 
 
## S3 method for class 'ml_evaluator'
ml_evaluate(x, dataset) 

Arguments

Arguments Description
x An ML model object or an evaluator object.
dataset The dataset to be validate the model on.

Examples

library(sparklyr)
 
sc <- spark_connect(master = "local") 
iris_tbl <- sdf_copy_to(sc, iris, name = "iris_tbl", overwrite = TRUE) 
 
ml_gaussian_mixture(iris_tbl, Species ~ .) %>% 
  ml_evaluate(iris_tbl) 
#> # A tibble: 1 × 1
#>   Silhouette
#>        <dbl>
#> 1      0.477
 
ml_kmeans(iris_tbl, Species ~ .) %>% 
  ml_evaluate(iris_tbl) 
#> # A tibble: 1 × 1
#>   Silhouette
#>        <dbl>
#> 1      0.850
 
ml_bisecting_kmeans(iris_tbl, Species ~ .) %>% 
  ml_evaluate(iris_tbl) 
#> # A tibble: 1 × 1
#>   Silhouette
#>        <dbl>
#> 1      0.517