Note: histogram-based boosting (LightGBM-style binning), why it is faster at scale
Beginner classical-mlensemblesgradient-boostingscalability
Implement:
def build_histogram(values: np.ndarray, n_bins: int) -> np.ndarray:
"""n_bins + 1 evenly-spaced bin edges covering [values.min(), values.max()]."""
def find_best_split_histogram(input, labels, n_bins) -> tuple[int, float, float] | None:
"""Like find_best_split, using only n_bins-1 candidate thresholds per feature."""
- Reuse
02-information-gain's information_gain, the scoring itself doesn't change, only which thresholds get scored.