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

Clarify how to specify monotonic constraints in docu #4345

Closed
mayer79 opened this issue Jun 6, 2021 · 4 comments · Fixed by #4346
Closed

Clarify how to specify monotonic constraints in docu #4345

mayer79 opened this issue Jun 6, 2021 · 4 comments · Fixed by #4346
Labels

Comments

@mayer79
Copy link
Contributor

mayer79 commented Jun 6, 2021

Description

In https://lightgbm.readthedocs.io/en/latest/Parameters.html, it is unclear how to pass the monotone_constraints parameter.

monotone_constraints 🔗︎, default = None, type = multi-int, aliases: mc, monotone_constraint

  • used for constraints of monotonic features
  • 1 means increasing, -1 means decreasing, 0 means non-constraint
  • you need to specify all features in order. For example, mc=-1,0,1 means decreasing for 1st feature, non-constraint for 2nd feature and increasing for the 3rd feature

In R and Python, we can pass neither a "multi-int" like mc=-1,0,1 nor a list, but rather a string like "-1,0,1".

Suggestion

Add to the docu a sentence like: "In R and Python, pass a string of the form '-1,0,1'." (If this is correct.)

@jameslamb jameslamb added the doc label Jun 7, 2021
@jameslamb
Copy link
Collaborator

Thanks very much for the write-up and request! I'll add this right now.

@jameslamb
Copy link
Collaborator

I've opened a draft PR, #4346, to update the documentation.

For the Python package, you can pass a string or a list like [-1, 0, 1]. For the R package, you can pass a string or a vector like c(-1, 0, 1).

@mayer79
Copy link
Contributor Author

mayer79 commented Jun 7, 2021

oh wow! I wasn't even aware that you can pass a list/vector!

StrikerRUS added a commit that referenced this issue Jun 9, 2021
#4345) (#4346)

* [R-package] add docs and tests on monotone constraints (fixes #4345)

* remove tests

* move doc to top level

* slightly more specific

* Update docs/Parameters.rst

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants