Computed once and reused for every prediction chunk: the training data does not change, and the pairwise mean is the expensive part.
Arguments
- x_train
Numeric matrix of SCALED training predictors (n x p), in the model's channel order.
- weights
Optional per-predictor weights, e.g. variable importance. NULL gives every predictor the same weight, which is what Meyer & Pebesma fall back to when no importance is available.
- max_pairs
Cap on the number of point pairs used to estimate avg_dist. The full n^2 is unnecessary for a mean and quadratic in memory; a large random sample estimates it to more precision than the quantity deserves.
- seed
Draw seed for that sample.