R: Plot the hyperparameter effects data

plotHyperParsEffect {mlr} | R Documentation

## Plot the hyperparameter effects data

### Description

Plot hyperparameter validation path. Automated plotting method for `HyperParsEffectData` object. Useful for determining the importance or effect of a particular hyperparameter on some performance measure and/or optimizer.

### Usage

    plotHyperParsEffect(hyperpars.effect.data, x = NULL, y = NULL,
      z = NULL, plot.type = "scatter", loess.smooth = FALSE,
      facet = NULL, global.only = TRUE, interpolate = NULL,
      show.experiments = FALSE, show.interpolated = FALSE,
      nested.agg = mean, partial.dep.learn = NULL)

### Arguments

`hyperpars.effect.data` | (`HyperParsEffectData`) Result of generateHyperParsEffectData
`x` | (`character(1)`) Specify what should be plotted on the x axis. Must be a column from `HyperParsEffectData$data`. For partial dependence, this is assumed to be a hyperparameter.
`y` | (`character(1)`) Specify what should be plotted on the y axis. Must be a column from `HyperParsEffectData$data`
`z` | (`character(1)`) Specify what should be used as the extra axis for a particular geom. This could be for the fill on a heatmap or color aesthetic for a line. Must be a column from `HyperParsEffectData$data`. Default is `NULL`.
`plot.type` | (`character(1)`) Specify the type of plot: “scatter” for a scatterplot, “heatmap” for a heatmap, “line” for a scatterplot with a connecting line, or “contour” for a contour plot layered ontop of a heatmap. Default is “scatter”.
`loess.smooth` | (`logical(1)`) If `TRUE`, will add loess smoothing line to plots where possible. Note that this is probably only useful when `plot.type` is set to either “scatter” or “line”. Must be a column from `HyperParsEffectData$data`. Not used with partial dependence. Default is `FALSE`.
`facet` | (`character(1)`) Specify what should be used as the facet axis for a particular geom. When using nested cross validation, set this to “nested_cv_run” to obtain a facet for each outer loop. Must be a column from `HyperParsEffectData$data` Default is `NULL`.
`global.only` | (`logical(1)`) If `TRUE`, will only plot the current global optima when setting x = "iteration" and y as a performance measure from `HyperParsEffectData$measures`. Set this to FALSE to always plot the performance of every iteration, even if it is not an improvement. Not used with partial dependence. Default is `TRUE`.
`interpolate` | (Learner | `character(1)`) If not `NULL`, will interpolate non-complete grids in order to visualize a more complete path. Only meaningful when attempting to plot a heatmap or contour. This will fill in “empty” cells in the heatmap or contour plot. Note that cases of irregular hyperparameter paths, you will most likely need to use this to have a meaningful visualization. Accepts either a regression Learner object or the learner as a string for interpolation. This cannot be used with partial dependence. Default is `NULL`.
`show.experiments` | (`logical(1)`) If `TRUE`, will overlay the plot with points indicating where an experiment ran. This is only useful when creating a heatmap or contour plot with interpolation so that you can see which points were actually on the original path. Note: if any learner crashes occurred within the path, this will become `TRUE`. Not used with partial dependence. Default is `FALSE`.
`show.interpolated` | (`logical(1)`) If `TRUE`, will overlay the plot with points indicating where interpolation ran. This is only useful when creating a heatmap or contour plot with interpolation so that you can see which points were interpolated. Not used with partial dependence. Default is `FALSE`.
`nested.agg` | (`function`) The function used to aggregate nested cross validation runs when plotting 2 hyperparameters. This is also used for nested aggregation in partial dependence. Default is `mean`.
`partial.dep.learn` | (Learner | `character(1)`) The regression learner used to learn partial dependence. Must be specified if “partial.dep” is set to `TRUE` in generateHyperParsEffectData. Accepts either a Learner object or the learner as a string for learning partial dependence. Default is `NULL`.

### Value

ggplot2 plot object.

### Note

Any NAs incurred from learning algorithm crashes will be indicated in the plot (except in the case of partial dependence) and the NA values will be replaced with the column min/max depending on the optimal values for the respective measure. Execution time will be replaced with the max. Interpolation by its nature will result in predicted values for the performance measure. Use interpolation with caution. If “partial.dep” is set to `TRUE` in generateHyperParsEffectData, only partial dependence will be plotted.

Since a ggplot2 plot object is returned, the user can change the axis labels and other aspects of the plot using the appropriate ggplot2 syntax.

### Examples

    # see generateHyperParsEffectData

[Package mlr version 2.13 Index]