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

Training crashes when "monotone_constraints_method" is set to "advanced" #6841

Open
sv1990 opened this issue Feb 26, 2025 · 2 comments
Open
Labels

Comments

@sv1990
Copy link

sv1990 commented Feb 26, 2025

Description

Training crashes when "monotone_constraints_method" is set to "advanced" and at least one feature is categorical but "monotone_constraints" is not defined.

The crash is fixed by setting "monotone_constraints", but according to the documentation "monotone_constraints_method" should not be used unless "monotone_constraints" is set.

Reproducible example

import lightgbm as lgb
import numpy as np
import pandas as pd

size = 60
df = pd.DataFrame(
    {
        "x": np.random.uniform(size=size),
        "c": pd.Categorical(np.random.choice([0, 1, 2], size=size, replace=True)),
        "y": np.random.uniform(size=size),
    }
)

lgb.train(
    {
        "monotone_constraints_method": "advanced",
        # "monotone_constraints": "0,0",
    },
    lgb.Dataset(df[["x", "c"]], df["y"], categorical_feature="auto"),
)

Environment info

LightGBM version or commit hash: '4.6.0'

Command(s) you used to install LightGBM

poetry add lightgbm

Additional Comments

@jameslamb jameslamb added the bug label Feb 26, 2025
@jameslamb
Copy link
Collaborator

Thanks for using LightGBM, we'll look into this soon.

To clarify... does "crashes" mean something like the process exits, a segmentation fault, etc.? Or do you just mean that it raises a Python exception?

Are there any logs printed before it "crashes", and if so could you share those too?

@sv1990
Copy link
Author

sv1990 commented Feb 26, 2025

This is the output I get from the example above:

[LightGBM] [Info] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000430 seconds.
You can set `force_col_wise=true` to remove the overhead.
[LightGBM] [Info] Total Bins 25
[LightGBM] [Info] Number of data points in the train set: 60, number of used features: 2
[LightGBM] [Info] Start training from score 0.505615
fish: Job 1, 'python test.py' terminated by signal SIGSEGV (Address boundary error)

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

No branches or pull requests

2 participants