OTE (version 1.0)

Predict.OTReg: Prediction function for the object returned by OTReg

Description

This function provides prediction for test data on the trained OTReg object for the continuous response variable.

Usage

Predict.OTReg(Opt.Trees, XTesting, YTesting)

Arguments

Opt.Trees
An object of class OptTreesEns.
XTesting
An m x d dimensional training data matrix/frame consiting of test observations where m is the number of observations and d is the number of features.
YTesting
Optional. A vector of length m consisting of the values of the continuous response variable for the test data.

Value

A list with values
Unexp.Variations
Unexplained variations based on estimated response and given response.
Pr.Values
A vector of length m consisting of the estimated values for the response observations in XTesting

References

Khan, Z., Gul, A., Perperoglou, A., Mahmoud, O.,Miftahuddin, M., Adler, W. and Lausen, B.(2014) ``An ensemble of optimal trees for classification and regression'' Journal name to appear.

Liaw, A. and Wiener, M. (2002) ``Classification and regression by random forest'' R news. 2(3). 18--22.

See Also

OTProb, OTReg, OTClass

Examples

Run this code
# Load the data

  data(Galaxy)
  data <- Galaxy
  
#Divide the data into training and test parts

  set.seed(9123) 
  n <- nrow(data)
  training <- sample(1:n,round(2*n/3))
  testing <- (1:n)[-training]
  X <- data[,1:4]
  Y <- data[,5]
  
#Train oTReg on the training data

  Opt.Trees <- OTReg(XTraining=X[training,],YTraining = Y[training],t.initial=200)
  
#Predict on test data

  Prediction <- Predict.OTReg(Opt.Trees, X[testing,],YTesting=Y[testing])
  
#Objects returned

  names(Prediction)
  Prediction$Unexp.Variations
  Prediction$Pr.Values
  Prediction$Trees.Used

Run the code above in your browser using DataCamp Workspace