Skip to content

'oob_impr' is not defined when subsample=1.0 #6

@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions