changing cost function in xgboost I'm using the newest version of xgboost package in python 2.7 and based on my problem, I'm going to change xgboost cost function to use my own defined cost function. Couple of questions:

In which part of the xgboost package should I find and change the cost function?
After changing the cost function, how can I add the updated code to the xgboost package to use the new training function instead of xgboost's pre-defined function?
This is discussed in stackoverflow, just to recap: 

Define your your customized cost function, e.g.:

 def new_cost(y_pred, y_true):
    # perform calculation for new cost
    return 'new_cost', score


Then pass it to the feval argument (see official doc) for training like:

model = xgboost.train(params, dtrain, num_rounds, watchlist, feval=new_cost)


There are many examples out there if you search harder for more concrete use cases.