R Evaluator

Creates an R Evaluator that executes an R function provided by the user on a DataFrame. Returns the result metric of the execution as a MetricValue.

The R function that will be executed must:

This operation has an is larger better that indicates whether the returned metric is better to be maximized or minimized. It is especially useful in Grid Search operation that searches for the best Estimator using a given metric.

Example R code:

evaluate <- function(dataframe){
  n <- nrow(dataframe)
  sq.error.column <- (dataframe$label - dataframe$prediction) ^ 2
  sq.error.sum.column <- sum(sq.error.column)
  sq.error.sum <- as.data.frame(agg(dataframe, sq.error.sum.column))
  rmse <- sqrt(sq.error.sum / n)
  return(rmse)
}

Remark: Trying to install an R package for the first time in multiple operations in parallel might cause erorrs. The operation should work properly when run again.

Since: Seahorse 1.3.0

Input

This operation does not take any input.

Output

Port Type Qualifier Description
0EvaluatorAn Evaluator that can be used in an Evaluate operation.

Parameters

Name Type Description
metric name String Name of the metric.
R evaluator code Code Snippet The R code to be executed. It has to contain an R function complying to signature presented in the operation's description.
is larger better Boolean Indicates whether the returned metric is better to be maximized or minimized.