Skip to content

feat: add features names options for example samples#48

Merged
Abdoulaye-SAKHO merged 3 commits into
mainfrom
dev_abd
Jun 15, 2026
Merged

feat: add features names options for example samples#48
Abdoulaye-SAKHO merged 3 commits into
mainfrom
dev_abd

Conversation

@Abdoulaye-SAKHO

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ability to specify custom feature_names in the explanation method, updating the documentation and example notebook to demonstrate this new capability. A review comment suggests adding validation to ensure that the length of the provided feature_names matches the number of features in the training data, which would prevent potential runtime errors when constructing the pandas DataFrame.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +169 to +170
if feature_names is None:
feature_names = [f"feature_{j}" for j in range(self.train_X.shape[1])]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When feature_names is provided, there is no validation to ensure that its length matches the number of features in the training data (self.train_X.shape[1]). If the lengths do not match, pd.DataFrame will raise a ValueError with an unclear error message. Adding a validation check improves robustness and provides a clear error message to the user.

            if feature_names is None:
                feature_names = [f"feature_{j}" for j in range(self.train_X.shape[1])]
            elif len(feature_names) != self.train_X.shape[1]:
                raise ValueError(
                    f"Length of feature_names ({len(feature_names)}) must match "
                    f"the number of features ({self.train_X.shape[1]})."
                )

@Abdoulaye-SAKHO Abdoulaye-SAKHO merged commit 3c8f9ff into main Jun 15, 2026
5 checks passed
@Abdoulaye-SAKHO Abdoulaye-SAKHO deleted the dev_abd branch June 15, 2026 09:09
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.

1 participant