-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgridsearch.Rd
45 lines (39 loc) · 1.32 KB
/
gridsearch.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gridsearch.R
\name{gridsearch}
\alias{gridsearch}
\title{Grid Search}
\usage{
gridsearch(x, y, searchspace, FUN, nfolds = 5, nrepcv = 2, ...)
}
\arguments{
\item{x}{\code{matrix}/\code{data.frame}, feature matrix, see \code{\link[=ranger]{ranger()}} for
details.}
\item{y}{\code{numeric}/\code{factor}, classification labels, see \code{\link[=ranger]{ranger()}} for
details.}
\item{searchspace}{\code{data.frame}, hyperparameters to tune. Column names have
to match the argument names of \code{FUN}.}
\item{FUN}{\code{function} function to optimize.}
\item{nfolds}{\code{integer(1)} number of cross validation folds.}
\item{nrepcv}{\code{integer(1)} number of repeats.}
\item{\ldots}{further arguments passed to \code{FUN}}
}
\value{
\code{data.frame} with tested hyperparameters and metric
}
\description{
Grid search to optimise hyperparameters for \code{FUN}
}
\examples{
iris <- subset(iris, Species != "setosa")
searchspace <- expand.grid(
mtry = c(2, 3),
num.trees = c(500, 1000)
)
## nfolds and nrepcv are too low for real world applications, and are just
## used for demonstration and to keep the run time of the examples low
gs_rusranger(
iris[-5], as.numeric(iris$Species == "versicolor"),
searchspace = searchspace, nfolds = 3, nrepcv = 1
)
}