mergeForest: Merge two forests

View source: R/mergeForest.R

mergeForestR Documentation

Merge two forests

Description

This function merges two forests. The trees are combined and the variable importance is calculated as a weighted average of the two forests. If the forests are trained on the same data, the predictions and oob_predictions are combined as well.

Usage

mergeForest(fit1, fit2)

Arguments

fit1

first SDForest object

fit2

second SDForest object

Value

merged SDForest object set.seed(1) n <- 50 X <- matrix(rnorm(n * 5), nrow = n) y <- sign(X[, 1]) * 3 + rnorm(n) fit1 <- SDForest(x = X, y = y, Q_type = 'no_deconfounding', nTree = 5, cp = 0.5) fit2 <- SDForest(x = X, y = y, nTree = 5, cp = 0.5) mergeForest(fit1, fit2)

Author(s)

Markus Ulmer


SDModels documentation built on April 11, 2025, 5:50 p.m.