pub fn average_path_length_factor(n: f64) -> f64Expand description
Calculates the leaf node adjustment factor c(n)
§Parameters
n- Number of samples
§Returns
f64- The adjustment factor
§Notes
Formula: c(n) = 2 * (H(n-1)) - (2*(n-1)/n) where H(n-1) can be approximated by ln(n-1) + gamma, gamma is Euler’s constant
§Examples
use rustyml::math::average_path_length_factor;
let factor = average_path_length_factor(10.0);
// For n = 10, the factor is approximately 3.748
assert!((factor - 3.748).abs() < 0.01);