| plot.param_grid_result | R Documentation |
Generic plotter for objects returned by run_param_grid(). Supported types:
"line": 1D metric vs one parameter.
"heatmap": 2D heatmap over two parameters.
"surface": 3D surface (persp) over two parameters.
"slices": 2D heatmaps faceted by a third parameter.
"surface_slices": 3D surfaces faceted by a third parameter.
"auto": chosen from the above based on the number of parameters.
## S3 method for class 'param_grid_result'
plot(
x,
y = NULL,
type = c("auto", "line", "heatmap", "surface", "slices", "surface_slices"),
metric = NULL,
params = NULL,
fixed = list(),
agg = c("mean", "median", "max"),
na.rm = TRUE,
palette = NULL,
zlim = NULL,
clip = c(0.02, 0.98),
main = NULL,
sub = NULL,
xlab = NULL,
ylab = NULL,
...
)
x |
A |
y |
Ignored. |
type |
One of "auto","line","heatmap","surface","slices","surface_slices". |
metric |
Column name to plot (defaults to "score" if present). |
params |
Character vector of parameter columns to use for axes/facets.
If |
fixed |
Optional named list of parameter values to condition on. Rows not matching are dropped before plotting. |
agg |
Aggregation when multiple rows map to a cell: "mean","median", or "max". |
na.rm |
Logical; drop NA metric rows before plotting. |
palette |
Optional color vector used for heatmaps/surfaces.
Defaults to |
zlim |
Optional two-element numeric range for color scaling. |
clip |
Two quantiles used to winsorize z-limits for stable coloring. |
main, sub, xlab, ylab |
Base plotting annotations. |
... |
Additional options depending on |
An invisible list describing the plot (kind/params/zlim/etc.).
run_param_grid(), print.param_grid_result()
data(sample_prices_weekly)
b <- function(prices, params, ...) {
weight_equally(filter_top_n(calc_momentum(prices, params$lookback), 10))
}
opt <- run_param_grid(
prices = sample_prices_weekly,
grid = list(lookback = c(8, 12, 26)),
builder = b
)
plot(opt, type = "line", params = "lookback")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.