ITADN

[C++] LGBM_BoosterPredictForMatSingleRow ignores start_iteration due to incomplete predictor cache key

#7220Opensabarinathh 创建于 2026-04-07
bug
S
sabarinathhcommented
https://github.com/lightgbm-org/LightGBM/blob/d14c4ba0029f3005a4acc1bc7c4260535582a232/src/c_api.cpp#L437 ### Summary [LGBM_BoosterPredictForMatSingleRow](https://github.com/lightgbm-org/LightGBM/blob/d14c4ba0029f3005a4acc1bc7c4260535582a232/src/c_api.cpp#L2541) returns identical predictions when called repeatedly with different start_iteration values, as long as predict_type and num_iteration remain the same. This happens because the internal single-row predictor cache does not include start_iteration in its cache key, leading to reuse of a stale predictor. ### Expected Behavior Predictions should vary when start_iteration changes, since different subsets of boosting iterations are used. ### Actual Behavior Predictions remain identical across calls with different start_iteration values when using: `LGBM_BoosterPredictForMatSingleRow`
1 条评论