Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a clear error message about invalid column names in GBM datasets #2879

Merged
merged 3 commits into from Jan 4, 2023

Conversation

jeffkinnison
Copy link
Contributor

When prepping data for GBM training/eval, column names with invalid characters may cause lightgbm.Dataset to throw the following error:

lightgbm.basic.LightGBMError: Do not support special JSON characters in feature name.

This update catches the LightGBMError and provides more descriptive feedback.

@github-actions
Copy link

github-actions bot commented Dec 23, 2022

Unit Test Results

         6 files  ±0           6 suites  ±0   4h 3m 26s ⏱️ + 51m 50s
  3 569 tests +3    3 497 ✔️ +3    72 💤 ±0  0 ±0 
10 707 runs  +9  10 474 ✔️ +9  233 💤 ±0  0 ±0 

Results for commit b4a0fc5. ± Comparison against base commit 461fa74.

♻️ This comment has been updated with latest results.

raise ValueError(
"Some column names in the training set contain invalid characters. Please ensure column names only "
"contain alphanumeric characters and underscores, then try training again."
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can do raise ValueError(...) from e to retain the original exception as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be addressed in b4a0fc5!

@tgaddair tgaddair merged commit 303f389 into master Jan 4, 2023
@tgaddair tgaddair deleted the gbm-invalid-columns branch January 4, 2023 18:58
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.

None yet

2 participants