A NameError occurs in MooGBTRegressor and MooGBTClassifier during the training loop when subsampling is disabled (i.e., subsample=1.0). The variable oob_impr is referenced in the early stopping and logging logic but is never initialized if the Out-of-Bag (OOB) code path is skipped.
Steps to Reproduce:
Initialize MooGBTClassifier with subsample=1.0.
Call .fit(X, y).
The model will crash with NameError: name 'oob_impr' is not defined at the end of the first iteration.
Expected Behavior: The model should complete training. If subsample=1.0, OOB metrics should be ignored or set to None.
Suggested Fix: Initialize oob_impr = None at the start of the iteration or wrap the logging/early-stopping logic in a conditional check for self.subsample < 1.0.
A NameError occurs in MooGBTRegressor and MooGBTClassifier during the training loop when subsampling is disabled (i.e., subsample=1.0). The variable oob_impr is referenced in the early stopping and logging logic but is never initialized if the Out-of-Bag (OOB) code path is skipped.
Steps to Reproduce:
Initialize MooGBTClassifier with subsample=1.0.
Call .fit(X, y).
The model will crash with NameError: name 'oob_impr' is not defined at the end of the first iteration.
Expected Behavior: The model should complete training. If subsample=1.0, OOB metrics should be ignored or set to None.
Suggested Fix: Initialize oob_impr = None at the start of the iteration or wrap the logging/early-stopping logic in a conditional check for self.subsample < 1.0.