microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.67k stars 3.83k forks source link

Clarify how to specify monotonic constraints in docu #4345

Closed mayer79 closed 3 years ago

mayer79 commented 3 years ago

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 commented 3 years ago

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

jameslamb commented 3 years ago

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 commented 3 years ago

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

github-actions[bot] commented 1 year ago

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.