I am new to xgboost and not so good at math.
I want to use a self defined objective function, here is the expression:
obj = (y * y_pred).sum() / (y_pred).abs().sum()
y
is a n-dimensional vector.
I have some experience for tensorflow, in tensorflow, I just need to define the function, it will calculate the derivatives for me automatically.
But in xgboost, the customized obj function needs to return the first and second derivatives.
I dont know how to take derivatives for abs()
. Is there good method can take derivatives?
Can you help on this?