Repository navigation
fix: predict with a regressor_predictor fails when training rows have a missing y - #2763
sumedhekaru wants to merge 1 commit into
Conversation
…ng with a regressor model
|
Hi @sumedhekaru! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Bug. Take a regressor added with
regressor_predictor=True, and a training frame with some NaNyvalues (rowswhere the regressor is known). Then
predict()on a future frame without the regressor column, for examplemake_future_dataframe(), raisesValueError: Found NaN in column '<name>':Cause. In
_prepare_regressors_for_predict, missing regressor values on history dates are looked up inself.history. Rows with a NaNyare dropped fromself.history, so those dates stay NaN. The regressor model,however, is fit on every date where the regressor is known (
_fit_regressor_models), including those rows.Fix. After the existing lookup, fill any history dates that are still missing from the regressor model's own
history. The existing lookup is unchanged, so every case that worked before gives bit-identical output. Dates where the
regressor itself was unknown in training still raise, as before.
Tests. A new test in
TestProphetRegressors: training data with three NaNyrows; predict onmake_future_dataframesucceeds, and the history rows get the known regressor values. The test fails onmainwith theerror above. The full suite passes (138 passed, 6 skipped). On 10 fit/predict scenarios (536 arrays), fitted parameters
and predict output are bit-identical to
main.regressor_predictoris Python-only, so there is no R change.It also passes this repository's Build workflow on my fork (Linux x86/ARM, macOS Intel/ARM, Windows, type check, R): https://github.com/sumedhekaru/prophet/actions/runs/39704535238