predict.FFTrees {FFTrees} | R Documentation |
Predict classification outcomes or probabilities from data
Description
predict.FFTrees
predicts binary classification outcomes or their probabilities from newdata
for an FFTrees
object.
Usage
## S3 method for class 'FFTrees'
predict(
object = NULL,
newdata = NULL,
tree = 1,
type = "class",
sens.w = NULL,
method = "laplace",
data = NULL,
...
)
Arguments
object |
An |
newdata |
dataframe. A data frame of test data. |
tree |
integer. Which tree in the object should be used? By default, |
type |
string. What should be predicted? Can be |
sens.w , data |
deprecated |
method |
string. Method of calculating class probabilities. Either 'laplace', which applies the Laplace correction, or 'raw' which applies no correction. |
... |
Additional arguments passed on to |
Value
Either a logical vector of predictions, or a matrix of class probabilities.
See Also
print.FFTrees
for printing FFTs;
plot.FFTrees
for plotting FFTs;
summary.FFTrees
for summarizing FFTs;
FFTrees
for creating FFTs from and applying them to data.
Examples
# 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 object from the training data:
breast.fft <- FFTrees(
formula = diagnosis ~ .,
data = breast.train
)
# Predict classification outcomes for test data:
breast.fft.pred <- predict(breast.fft,
newdata = breast.test
)
# Predict class probabilities for test data:
breast.fft.pred <- predict(breast.fft,
newdata = breast.test,
type = "prob"
)