Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. struct EvalPoissonNegLogLik : public EvalEWiseBase {
  2.  
  3. const char *Name() const override {
  4.  
  5. return "poisson-nloglik";
  6.  
  7. }
  8.  
  9. inline bst_float EvalRow(bst_float y, bst_float py) const {
  10.  
  11. const bst_float eps = 1e-16f;
  12.  
  13. if (py < eps) py = eps;
  14.  
  15. return common::LogGamma(y + 1.0f) + py - std::log(py) * y;
  16.  
  17. }
  18.  
  19. }
  20.  
  21. poisson_deviance <- function(y, py, eps) {
  22.  
  23. mean(LogGamma(y + 1.0f) + pmax(py, eps) - log(pmax(py, eps)) * y);
  24.  
  25. }
  26.  
  27. setinfo(xgbMatrix, "base_margin", log(exposure))
  28.  
  29. poisson_deviance <- function(y, py, exposure, eps) {
  30.  
  31. mean(LogGamma(y + 1.0f) + pmax(py + log(exposure), eps) - log(pmax(py +
  32.  
  33. log(exposure), eps)) * y);
  34.  
  35. }
  36.  
  37. poisson_deviance <- function(y, py) {mean(y*py - exp(py))}
  38.  
  39. 2 * mean(y * log(y / py) - (y - py))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement