R/print_explainer.R

Defines functions print.explainer

Documented in print.explainer

#' Prints Explainer Summary
#'
#' @param x a model expaliner created with the `explain` function
#' @param ... other parameters
#'
#' @export
#'
#' @examples
#' apartments_lm <- lm(m2.price ~ ., data = apartments)
#' apartments_lm_ex <- explain(apartments_lm, data = apartments, label = "apartments_lm")
#' apartments_lm_ex
#'
#'  \dontrun{
#' library("breakDown2")
#' wine_lm_model4 <- lm(quality ~ pH + residual.sugar + sulphates + alcohol, data = wine)
#' wine_lm_explainer4 <- explain(wine_lm_model4, data = wine, label = "model_4v")
#' wine_lm_explainer4
#'
#' library("randomForest")
#' wine_rf_model4 <- randomForest(quality ~ pH + residual.sugar + sulphates + alcohol, data = wine)
#' wine_rf_explainer4 <- explain(wine_rf_model4, data = wine, label = "model_rf")
#' wine_rf_explainer4
#'  }
#'
print.explainer <- function(x, ...) {
  cat("Model label: ", x$label, "\n")
  cat("Model class: ", paste(x$class, collapse = ","), "\n")
  cat("Data head  :\n")
  print(head(x$data,2))
  return(invisible(NULL))
}

Try the DALEX2 package in your browser

Any scripts or data that you put into this service are public.

DALEX2 documentation built on May 2, 2019, 1:19 p.m.