R/plot_predict_parts.R

Defines functions plot.predict_parts

Documented in plot.predict_parts

#' Plot Variable Attribution Explanations
#'
#' @param x an object of the class \code{predict_parts}
#' @param ... other parameters described below
#'
#' @return An object of the class \code{ggplot}.
#'
#' @section Plot options:
#'
#' \subsection{break_down}{
#' \itemize{
#'  \item{\code{max_features}}{ maximal number of features to be included in the plot. default value is \code{10}}
#'  \item{\code{min_max}}{ a range of OX axis. By default \code{NA}, therefore it will be extracted from the contributions of \code{x}.
#'    But it can be set to some constants, useful if these plots are to be used for comparisons.}
#'  \item{\code{add_contributions}}{ if \code{TRUE}, variable contributions will be added to the plot.}
#'  \item{\code{shift_contributions}}{ number describing how much labels should be shifted to the right, as a fraction of range. By default equal to \code{0.05}.}
#'  \item{\code{vcolors}}{ If \code{NA} (default), DrWhy colors are used.}
#'  \item{\code{vnames}}{ a character vector, if specified then will be used as labels on OY axis. By default \code{NULL}.}
#'  \item{\code{digits}}{ number of decimal places (\code{\link{round}}) or significant digits (\code{\link{signif}}) to be used.}
#'  \item{\code{rounding_function}}{ a function to be used for rounding numbers.}
#'  \item{\code{plot_distributions}}{ if \code{TRUE} then distributions of conditional propotions will be plotted. This requires \code{keep_distributions=TRUE} in the
#'    \code{\link{break_down}}, \code{\link{local_attributions}}, or \code{\link{local_interactions}}.}
#'  \item{\code{baseline}}{ if numeric then veritical line starts in \code{baseline}.}
#'  \item{\code{title}}{ a character. Plot title. By default \code{"Break Down profile"}.}
#'  \item{\code{subtitle}}{ a character. Plot subtitle. By default \code{NULL} - then subtitle is set to "created for the XXX, YYY model",
#'        where XXX, YYY are labels of given explainers.}
#'  \item{\code{max_vars}}{ alias for the \code{max_features} parameter.}
#' }
#' }
#' \subsection{shap}{
#' \itemize{
#'  \item{\code{show_boxplots}}{ logical if \code{TRUE} (default) boxplot will be plotted to show uncertanity of attributions.}
#'  \item{\code{vcolors}}{ If \code{NA} (default), DrWhy colors are used.}
#'  \item{\code{max_features}}{ maximal number of features to be included in the plot. default value is \code{10}}
#'  \item{\code{max_vars}}{ alias for the \code{max_features} parameter.}
#' }
#' }
#' \subsection{oscillations}{
#' \itemize{
#'  \item{\code{bar_width}}{ width of bars. By default \code{10}}
#' }
#' }
#'
#' @export
plot.predict_parts <- function(x, ...) {
  class(x) <- class(x)[-1]
  plot(x, ...)
}
ModelOriented/DALEX documentation built on Feb. 29, 2024, 6:55 a.m.