Cutoffs

The algorithm for searching atrribute subset space.

1 | ```
exhaustive.search(attributes, eval.fun)
``` |

`attributes` |
a character vector of all attributes to search in |

`eval.fun` |
a function taking as first parameter a character vector of all attributes and returning a numeric indicating how important a given subset is |

The algorithm searches the whole attribute subset space in breadth-first order.

A character vector of selected attributes.

Piotr Romanski

`forward.search`

, `backward.search`

, `best.first.search`

, `hill.climbing.search`

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 | ```
library(rpart)
data(iris)
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)
})
print(subset)
print(mean(results))
return(mean(results))
}
subset <- exhaustive.search(names(iris)[-5], evaluator)
f <- as.simple.formula(subset, "Species")
print(f)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.