Skip to content

Commit

Permalink
updated rotation forest models
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Oct 25, 2016
1 parent d6cb9ea commit afcaa29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions models/files/rotationForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ modelInfo <- list(label = "Rotation Forest",
class = rep("numeric", 2),
label = c("#Variable Subsets", "Ensemble Size")),
grid = function(x, y, len = NULL, search = "grid") {
feas_k <- 1:15
feas_k <- feas_k[ncol(x)%%feas_k == 0]
if(search == "grid") {
out <- expand.grid(K = 1:min(len, ncol(x)-1), L = (1:len)*3)
out <- expand.grid(K = feas_k[1:min(len, length(feas_k))], L = (1:len)*3)
} else {
out <- data.frame(K = sample(1:min(len, ncol(x)-1), size = len, replace = TRUE),
out <- data.frame(K = sample(feas_k, size = len, replace = TRUE),
L = sample(1:100, size = len, replace = TRUE))
}
out
Expand Down
6 changes: 4 additions & 2 deletions models/files/rotationForestCp.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ modelInfo <- list(label = "Rotation Forest",
class = rep("numeric", 3),
label = c("#Variable Subsets", "Ensemble Size", "Complexity Parameter")),
grid = function(x, y, len = NULL, search = "grid") {
feas_k <- 1:15
feas_k <- feas_k[ncol(x)%%feas_k == 0]
if(search == "grid") {
out <- expand.grid(K = 1:min(len, ncol(x)-1),
out <- expand.grid(K = feas_k[1:min(len, length(feas_k))],
L = (1:len)*3,
cp = unique(seq(0, .1, length = len)))
} else {
out <- data.frame(K = sample(1:min(len, ncol(x)-1), size = len, replace = TRUE),
out <- data.frame(K = sample(feas_k, size = len, replace = TRUE),
L = sample(10:100, size = len, replace = TRUE),
cp = runif(len, 0, .1))
}
Expand Down
1 change: 1 addition & 0 deletions pkg/caret/inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
\item A variable importance method was added for boosted generalized linear models \issue{493}
\item \code{preProcess} now has an option to filter out highly correlated predictors.
\item \code{trainControl} now has additional options to modify the parameters of near-zero variance and correlation filters. See the \code{preProcOptions} argument.
\item The \code{rotationForest} and \code{rotationForestCp} methods were revised to evaluate only \emph{feasible} values of the parameter \code{K} (the number of variable subsets). The underlying \code{rotationForest} function reduces this parameter until values of \code{K} divides evenly into the number of parameters.
}
}

Expand Down

0 comments on commit afcaa29

Please sign in to comment.