Skip to content

FIX: return early in Mahalanobis.fit when cat_vars is None (closes #905)#953

Open
Ebube22 wants to merge 4 commits into
SeldonIO:masterfrom
Ebube22:fix/mahalanobis-fit-cat-vars-none-905
Open

FIX: return early in Mahalanobis.fit when cat_vars is None (closes #905)#953
Ebube22 wants to merge 4 commits into
SeldonIO:masterfrom
Ebube22:fix/mahalanobis-fit-cat-vars-none-905

Conversation

@Ebube22

@Ebube22 Ebube22 commented Jun 15, 2026

Copy link
Copy Markdown

Closes #905

Problem

The fit method raised a TypeError when cat_vars is None, but both
the docstring and documentation explicitly state that this step is
not necessary in the absence of categorical variables.

Fix

Replace the TypeError with a logging.warning() and early return,
consistent with the documented behaviour.

Testing

Added a unit test (test_mahalanobis_fit_no_cat_vars_warns_and_returns)
confirming fit() warns and returns early without raising, and that
d_abs remains unchanged.

@CLAassistant

CLAassistant commented Jun 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mahalanobis.fit unexpectedly raises error when no categorical variables are present

2 participants