Skip to content

Keep standard deviations non-negative when scaling a term by a negative factor - #710

Open
chenyangsu wants to merge 1 commit into
interpretml:mainfrom
chenyangsu:fix/scale-negative-factor-std
Open

chenyangsu wants to merge 1 commit into
interpretml:mainfrom
chenyangsu:fix/scale-negative-factor-std

Conversation

@chenyangsu

Copy link
Copy Markdown

ebm.scale(term, factor) multiplies standard_deviations_[term] by factor, so a negative factor leaves negative standard deviations:

X, y = make_classification(300, 4, random_state=0)
ebm = ExplainableBoostingClassifier(outer_bags=4, interactions=0, random_state=0).fit(X, y)
ebm.scale(0, -1.0)
ebm.standard_deviations_[0].min()  # -0.709

explain_global().data(0) then has upper_bounds below lower_bounds. The standard deviations are now multiplied by abs(factor); term scores and bagged scores still use factor. Happy to reject negative factors instead if you prefer.

Testing: the new test_ebm_scale_negative_factor fails on main and passes with the change. tests/glassbox/ebm/test_ebm.py: 261 passed, 44 skipped.

…ve factor

Signed-off-by: Chen-Yang Su <cysu@stanford.edu>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant