You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using forcedsplits_filename parameter, there seems to be no check on the boundaries of the provided features index.
This makes it possible to get an access violation error. Ideally there should be a check to avoid run-time crashes.
Reproducible example
fromsklearn.datasetsimportload_irisfromsklearn.model_selectionimporttrain_test_splitimportpandasaspdimportjsonfromlightgbmimportLGBMClassifierdf=load_iris(return_X_y=True, as_frame=True)[0]
df.columns= [c.replace(" ","_") forcindf.columns]
x_cols=df.columnsdf['target']=load_iris(return_X_y=True, as_frame=True)[1]
# The dataset has four featuresX_train, X_test, y_train, y_test=train_test_split(df[x_cols], df['target'], test_size=0.33, random_state=42)
lgbm_model=LGBMClassifier(random_state=42)
# we proceed as if the dataset has five featuresspl_dict= {"feature": 4,
"threshold": 3.0,
"left": {
"feature": 0,
"threshold": 3.25
},
"right": {
"feature": 0,
"threshold": 3.25
}
}
# write dict to a json filewithopen('splits.json', 'w') asfp:
json.dump(spl_dict, fp)
lgbm_model=LGBMClassifier(random_state=42,forcedsplits_filename="splits.json")
lgbm_model.fit(X_train, y_train)
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.
Description
When using forcedsplits_filename parameter, there seems to be no check on the boundaries of the provided features index.
This makes it possible to get an access violation error. Ideally there should be a check to avoid run-time crashes.
Reproducible example
The above gives this error:
Environment info
LightGBM version or commit hash: 3.3.2
Command(s) you used to install LightGBM: conda install -c conda-forge lightgbm
Additional Comments
The text was updated successfully, but these errors were encountered: