Learn R Programming

FFTrees (version 1.2.3)

predict.FFTrees: Predict new data from an FFTrees x

Description

Predict new data from an FFTrees x

Usage

# S3 method for FFTrees
predict(object = NULL, data = NULL, tree = "best.train",
  sens.w = NULL, ...)

Arguments

object

An FFTrees object created from the FFTrees() function.

data

dataframe. A dataframe of test data

tree

Which tree in the FFTrees x should be used? Can be an integer or "best.train" (the default) to use the tree with the best training statistics (according the goal specified in tree construction).

sens.w

numeric. A number from 0 to 1 indicating how to weight sensitivity relative to specificity. If specified, the tree with the highest weighted accuracy (wacc) given the specified value of sens.w will be selected

...

Additional arguments passed on to predict()

Value

A logical vector of predictions

Examples

Run this code


  # Create training and test data

  set.seed(100)
  breastcancer <- breastcancer[sample(nrow(breastcancer)),]
  breast.train <- breastcancer[1:150,]
  breast.test <- breastcancer[151:303,]

  # Create an FFTrees x from the training data

  breast.fft <- FFTrees(formula = diagnosis ~.,
                              data = breast.train)

 # Predict results for test data
  breast.fft.pred <- predict(breast.fft,
                             data = breast.test)

Run the code above in your browser using DataLab