selectTrees: Makes a sub-ExtraTrees object by keeping only selected trees.

Description Usage Arguments Value Author(s) Examples

Description

This function creates a sub-ExtraTrees object by keeping only selected trees specified by selection.

Usage

1
  selectTrees(object, selection)

Arguments

object

extraTrees (S3) object, created by extraTrees().

selection

a list of logicals (T/F) of length object$ntree.

Value

A new ExtraTrees (S3) object based on the existing object by keeping only the trees present in the selection.

Author(s)

Jaak Simm

Examples

1
2
3
4
5
6
7
8
9
  ## Regression with ExtraTrees:
  n <- 1000  ## number of samples
  p <- 5     ## number of dimensions
  x <- matrix(runif(n*p), n, p)
  y <- (x[,1]>0.5) + 0.8*(x[,2]>0.6) + 0.5*(x[,3]>0.4) + 0.1*runif(nrow(x))
  et <- extraTrees(x, y, nodesize=3, mtry=p, numRandomCuts=2, ntree=500)
  ## random selection of trees:
  trees <- sample(c(FALSE, TRUE), replace=TRUE, et$ntree)
  et2   <- selectTrees(et, selection=trees)

extraTrees documentation built on May 2, 2019, 2:31 p.m.