Skip to content

lightgbm/cv-regression-stratified

Pack Severity Fix Versions
LightGBM error none, edit by hand All versions

lightgbm.cv defaults to stratified=True. Passing a regression objective with continuous targets raises ValueError: Supported target types are: ('binary', 'multiclass'). Got 'continuous' instead..

result = lgb.cv({"objective": "regression"}, train_set, num_boost_round=50)
result = lgb.cv({"objective": "regression"}, train_set, num_boost_round=50, stratified=False)

Calls to lightgbm.cv whose parameter dictionary sets a regression objective (regression, l1, l2, rmse, mae, huber, fair, poisson, quantile, mape, gamma, or tweedie) without stratified=False or explicit folds=.

Pass stratified=False for continuous targets, or pass an explicit time- or group-aware folds= splitter.

lightgbm.cv defaults to stratified=True, which raises ValueError("Supported target types are: ('binary', 'multiclass'). Got 'continuous' instead.") on regression objectives. Pass stratified=False.

See all rules in the LightGBM pack.