Raw File
Tip revision: d2854b77f74f8ee2cb0f4916e5d5a940f035fc6e authored by Lars Kotthoff on 07 January 2021, 17:10 UTC
version 0.32
Tip revision: d2854b7
\title{ Greedy search }
  The algorithms for searching atrribute subset space.
  \item{attributes}{ a character vector of all attributes to search in }
  \item{}{ a function taking as first parameter a character vector of all attributes and returning a numeric indicating how important a given subset is }
  These algorithms implement greedy search. At first, the algorithms expand starting node, evaluate its children and choose the best one which becomes a new starting node. This process goes only in one direction. \code{} starts from an empty and \code{} from a full set of attributes.
  A character vector of selected attributes.
\author{ Piotr Romanski }
\seealso{ \code{\link{}}, \code{\link{}}, \code{\link{}} }
  evaluator <- function(subset) {
    #k-fold cross validation
    k <- 5
    splits <- runif(nrow(iris))
    results = sapply(1:k, function(i) {
      test.idx <- (splits >= (i - 1) / k) & (splits < i / k)
      train.idx <- !test.idx
      test <- iris[test.idx, , drop=FALSE]
      train <- iris[train.idx, , drop=FALSE]
      tree <- rpart(as.simple.formula(subset, "Species"), train)
      error.rate = sum(test$Species != predict(tree, test, type="c")) / nrow(test)
      return(1 - error.rate)
  subset <-[-5], evaluator)
  f <- as.simple.formula(subset, "Species")

back to top