Function for making predictions from trained ExtraTree object.

Description

This function makes predictions for regression/classification using the given trained ExtraTree object and provided input matrix (newdata).

Usage

1
2
  ## S3 method for class 'extraTrees'
predict(object, newdata, quantile=NULL, allValues=F, probability=F, newtasks=NULL, ...)

Arguments

object

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

newdata

a new numberic input data matrix, for each row a prediction is made.

quantile

the quantile value between 0.0 and 1.0 for quantile regression, or NULL (default) for standard predictions.

allValues

whether or not to return outputs of all trees (default FALSE).

probability

whether to return a matrix of class (factor) probabilities, default FALSE. Can only be used in the case of classification. Calculated as the proportion of trees voting for particular class.

newtasks

list of tasks, for each input in newdata (default NULL). Must be NULL if no multi-task learning was used at training.

...

not used currently.

Value

The vector of predictions from the ExtraTree et. The length of the vector is equal to the the number of rows in newdata.

Author(s)

Jaak Simm

Examples

1
2
3
4
5
6
7
  ## 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)
  yhat <- predict(et, x)