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

C API does not return error on invalid parameters #8659

Closed
ExpandingMan opened this issue Jan 11, 2023 · 7 comments
Closed

C API does not return error on invalid parameters #8659

ExpandingMan opened this issue Jan 11, 2023 · 7 comments

Comments

@ExpandingMan
Copy link

Currently libxgboost does not error if invalid parameter names are passed, which can lead to some confusion. As far as I can tell, there are no good options for obtaining a list of valid parameter names: either I can get it from the documentation page or source code, but in either case maintenance is very difficult and, worse, may not even match up perfectly with versions of the underlying library unless I am very careful.

It seems to me that ideally the C API should error when invalid parameters are passed, as it is much harder to validate them at the wrapper level.

Alternatively, if the C API provided a list of parameter names, the wrappers could more easily check for invalid parameter names.

@Moelf
Copy link

Moelf commented Jan 11, 2023

given how stable it is (is it?) I wonder if we can just hard code it

@trivialfis
Copy link
Member

It would be quite difficult to hard code if you want accurate report.

Currently there's a warning for invalid parameters. I kept it as warning since there are lots of users just dump the parameters into tuning libraries, flipping it to error will upset quite some people ...

@ExpandingMan
Copy link
Author

Ah, ok, this is my fault then. Somehow I'm not picking up warnings, I'll have to look into the documentation to see what I should be doing.

@trivialfis
Copy link
Member

Apologies, I forgot to mention there's a parameter called validate_parameters.

bool validate_parameters{false};

You need to set it to true to enable it. (Set it just like any other training parameters)

@ExpandingMan
Copy link
Author

Ah! I'm so happy now, I'm definitely going to enable this by default in XGBoost.jl.

@trivialfis
Copy link
Member

Glad that it's useful. Feel free to close the issue if the warning message is sufficient.

@ExpandingMan
Copy link
Author

Ok, PR is up here. It's not ideal: in particular, as with all other output from inside libxgboost, we can't run the warnings through the Julia logger, meaning that these warnings will ignore logging settings. I'm also a little wary about messing around with default parameter values, but I think enough of us have found this issue sufficiently annoying that we can make an exception.

Anyway, thanks for your help.

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

No branches or pull requests

3 participants