stanfordmlgroup / ngboost

Natural Gradient Boosting for Probabilistic Prediction
Apache License 2.0
1.63k stars 214 forks source link

Off-by-one error #302

Closed juliangilbey closed 1 year ago

juliangilbey commented 1 year ago

It seems that at this point: https://github.com/stanfordmlgroup/ngboost/blob/3a064b48b2f97ddc99bf01aa93d4037e466a67a8/ngboost/ngboost.py#L424-L425 the code breaks out of the loop once there are max_iter+1 predictors rather than max_iter, as the enumeration starts from 0. One easy way to fix this is to add start=1 to the enumerate call; another is to test for i >= max_iter + 1.

ryan-wolbeck commented 1 year ago

I think that makes sense, feel free to submit a PR!

juliangilbey commented 1 year ago

I've just submitted a PR for this; I also realise that I got one of my suggested fixes wrong - it should have been i >= max_iter - 1!

ryan-wolbeck commented 1 year ago

Thanks you for the PR, this will be published in the next release!