predict {ranktreeEnsemble}R Documentation

Prediction or Extract Predicted Values for Random Forest, Random Forest Rule or Boosting Models

Description

Obtain predicted values using a random forest (rfsrc), random forest extracted rule (rules) or boosting (gbm) object. If no new data is provided, it extracts the out-of-bag predicted values of the outcome for the training data.

Usage

predict(object,
        newdata = NULL,
        newdata.pair = FALSE, ...)

Arguments

object

An object of class rfsrc generated from the function rforest or gbm generated from the function rboost.

newdata

Test data. If missing, the original training data is used for extracting the out-of-bag predicted values without running the model again.

newdata.pair

Is newdata already converted into binary ranked pairs from the pair function?

...

Further arguments passed to or from other methods.

Details

For the boosting (gbm) object, the cross-validation predicted values are provided if cv.folds>=2.

Value

value

Predicted value of the outcome. For the random forest (rfsrc) object, it is the predicted probability. For the boosting (gbm) object, it is the fitted values on the scale of regression function (e.g. log-odds scale). For the random forest extracted rule (rules) object, it is empty.

label

Predicted label of the outcome.

Author(s)

Ruijie Yin (Maintainer,<ruijieyin428@gmail.com>), Chen Ye and Min Lu

References

Lu M. Yin R. and Chen X.S. Ensemble Methods of Rank-Based Trees for Single Sample Classification with Gene Expression Profiles. Journal of Translational Medicine. 22, 140 (2024). doi: 10.1186/s12967-024-04940-2

Examples


data(tnbc)
######################################################
# Random Forest
######################################################
obj <- rforest(subtype~., data = tnbc[1:100,c(1:5,337)])
predict(obj)$label
predict(obj, tnbc[101:110,1:5])$label

datp <- pair(tnbc[101:110,1:5])
predict(obj, datp, newdata.pair = TRUE)$label
######################################################
# Random Forest Extracted Rule
######################################################
 objr <- extract.rules(obj)
 predict(objr)$label[1:5]
 predict(obj, tnbc[101:110,1:5])$label
######################################################
# Boosting
######################################################
obj <- rboost(subtype~., data = tnbc[1:100,c(1:5,337)])
predict(obj)$label
predict(obj, tnbc[101:110,1:5])$label



[Package ranktreeEnsemble version 0.23 Index]