leaf_donors: Draw donor rows from CART leaves

View source: R/synthesize.r

leaf_donorsR Documentation

Draw donor rows from CART leaves

Description

Fits y ~ X on the training rows and, for every row to predict, returns a training row drawn at random from the same leaf.

Usage

leaf_donors(y, X, train, pred, minbucket = 5, cp = 1e-04)

Arguments

y

Target (factor or numeric), full length.

X

Predictor data.frame, full length.

train, pred

Logical vectors: rows to fit on and rows to draw for.

minbucket, cp

rpart controls; leaves hold at least minbucket rows.

Value

list(donor = row indices into y, leaves, fallback flag).


cellsynth documentation built on Oct. 31, 2026, 1:07 a.m.