Learn R Programming

unityForest (version 0.1.0)

predict.unityfor: Unity Forest prediction

Description

Prediction with new data and a saved forest from unityfor.

Usage

# S3 method for unityfor
predict(
  object,
  data = NULL,
  predict.all = FALSE,
  num.trees = object$num.trees,
  type = "response",
  num.threads = NULL,
  verbose = TRUE,
  ...
)

Value

Object of class unityfor.prediction with elements

predictionsPredicted classes/probabilities/values (only for classification and regression)
num.treesNumber of trees.
num.independent.variablesNumber of independent variables.
treetypeType of forest/tree. Classification or regression (the latter is not implemented yet).
num.samplesNumber of samples.

Arguments

object

unityfor object.

data

New test data of class data.frame.

predict.all

Return individual predictions for each tree instead of aggregated predictions for all trees. Return a matrix (sample x tree) for classification and a 3d array for probability estimation (sample x class x tree).

num.trees

Number of trees used for prediction. The first num.trees in the forest are used.

type

Type of prediction. One of 'response', 'se', 'terminalNodes', 'quantiles' with default 'response'. See below for details.

num.threads

Number of threads. Default is number of CPUs available.

verbose

Verbose output on or off.

...

further arguments passed to or from other methods.

Author

Marvin N. Wright

Details

This package is a fork of the R package 'ranger' that implements random forests using an efficient C++ implementation. More precisely, 'unityForest' was written by modifying the code of 'ranger', version 0.11.0.

References

  • Hornung, R., Hapfelmeier, A. (2026). Unity Forests: Improving Interaction Modelling and Interpretability in Random Forests. arXiv:2601.07003, <tools:::Rd_expr_doi("10.48550/arXiv.2601.07003")>.

  • Wright, M. N., Ziegler, A. (2017). ranger: A fast Implementation of Random Forests for High Dimensional Data in C++ and R. Journal of Statistical Software 77:1-17, <tools:::Rd_expr_doi("10.18637/jss.v077.i01")>.

See Also

unityfor