get_params_if_best_at_gridborder: Find the optimal parameters given it occurs at the grid...

Description Usage Arguments Value Examples

View source: R/get_params_if_best_at_gridborder.R

Description

Grid-search is often used for parameter selection. An optimization criteria is calculated for pre-defined model parameters (e.g. sigma/gamma and C for the SVM). When the optimum occurs at the limits of the parameters it is possible that extending the parameter range improves the model performance. This functions returns the values of the parameter limits given the optimum occurs at the limits.

Usage

1
2
get_params_if_best_at_gridborder(x, params = NULL, optcrit = NULL,
  ignore = NULL)

Arguments

x

A data frame with one column for each parameter and the optimization criteria.

params

The column name(s) of the parameters. Optional, if NULL it is assumed that the parameters are in the columns 1:(ncol(x)-1) and the optimization criteria in the column ncol(x). are parameter columns and the last one is the column holding the values of the optimization criteria.

optcrit

The column name of the optimization criteria. Optiona, if NULL the last column is used.

Value

List with the optimums parameters given it occures at the limits of the parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
x <- expand.grid(p1=1:3,
                     p2=2:5)
x$oc <- rnorm(nrow(x))
x[8, 3] <- max(x$oc) + 1 # no limit
get_params_if_best_at_gridborder(x, params=c("p1", "p2"), optcrit="oc")
x[4, 3] <- max(x$oc) + 1 # lower limit of p1
get_params_if_best_at_gridborder(x, params=c("p1", "p2"), optcrit="oc")
x[12, 3] <- max(x$oc) + 1 # upper limits of p1 and p2
get_params_if_best_at_gridborder(x, params=c("p1", "p2"), optcrit="oc")
}

benmack/oneClass documentation built on Dec. 15, 2020, 7:38 p.m.