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

monotone_constraints is expected to be a str, rather than tuple #7888

Closed
wangminzheng opened this issue May 12, 2022 · 0 comments · Fixed by #7891
Closed

monotone_constraints is expected to be a str, rather than tuple #7888

wangminzheng opened this issue May 12, 2022 · 0 comments · Fixed by #7891

Comments

@wangminzheng
Copy link

In the official document, the value of monotone_constraints is a tuple:
params_constrained['monotone_constraints'] = (1,-1)
See: https://xgboost.readthedocs.io/en/stable/tutorials/monotonic.html

But in the source code, it's evaluated to be either a str or a dict:
if isinstance(value, str):
return value
constrained_features = set(value.keys())
See:

constrained_features = set(value.keys())

When passing the argument as a tuple, it will throw an error say tuple doesn't have attribute "keys"

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

Successfully merging a pull request may close this issue.

2 participants