I'd be happy with adding Poisson loss to more models, thought I think it would be more natural to first add it to GLM before GBM ;) If the addition is straight-forward, I think it would be a nice contribution nevertheless. 1) for the user to do np.exp(gbmpoisson.predict(X)) is not acceptable. This needs to be automatic. It would be best if this could be done in a minimally intrusive way.

2) I'm not sure, maybe Peter can comment?

3) I would rather contribute sooner, but other might thing differently. Silently ignoring sample weights is not an option, but you can error if they are provided.

Hth,
Andy

On 07/23/2015 08:52 PM, Peter Rickwood wrote:

Hello sklearn developers,

I'd like the GBM implementation in sklearn to support Poisson loss, and I'm comfortable in writing the code (I have modified my local sklearn source already and am using Poisson loss GBM's).

The sklearn site says to get in touch via this list before making a contribution, so is it worth me to submitting something along these lines?

If the answer is yes, some quick questions:

1) The simplest implementation of poisson loss GBMs is to work in log-space (i.e. the GBM predicts log(target) rather than target), and require the user to then take the exponential of those predictions. So, you would need to do something like:
          gbmpoisson = sklearn.ensemble.GradientBoostingRegressor(...)
          gbmpoisson.fit(X,y)
          preds = np.exp(predict(X))
I am comfortable making changes to the source for this to work, but I'm not comfortable changing any of the higher-level interface to deal automatically with the transform. In other words, other developers would need to either be OK with the GBM returning transformed predictions in the case where "poisson" loss is chosen, or would need to change code in the 'predict' function to automatically do the transformation is poisson loss was specified. Is this OK? 2) If I do contribute, can you advise what the best tests are to test/validate GBM loss functions before they are considered to 'work'?

3) Allowing for weighted samples is in theory easy enough to implement, but is not something I have implemented yet. Is it better to contribute code sooner that doesn't handle weighting (i.e. just ignores sample weights), or later that does?




Cheers, and thanks for all your work on sklearn. Fantastic tool/library,



Peter







------------------------------------------------------------------------------


_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to