harrysouthworth / gbm

Gradient boosted models
Other
106 stars 27 forks source link

Weights not properly calibrated in gbmDoFold function #52

Open thamilto opened 6 years ago

thamilto commented 6 years ago

https://github.com/harrysouthworth/gbm/blob/9c11f642fec7268e42837b4abc7fa34e10137651/R/gbmDoFold.R#L41

At the point of the line mentioned above the x and y variables have been modified so that they include the right data, i.e. the data to be used to fit the nth cv fold. The same thing happens to the offset variable, but not to the weights variable. Therefore the weights which are passed through are pretty much in a random order.

This is an easy fix AFAIK, you just need to add in a line w <- w[i.train][i] and everyone is happy.