What is the difference between objective
and feval
in xgboost in R? I know this is something very fundamental but I am unable to exactly define them/ their purpose.
Also, what is a softmax objective, while doing multi class classification?
What is the difference between objective
and feval
in xgboost in R? I know this is something very fundamental but I am unable to exactly define them/ their purpose.
Also, what is a softmax objective, while doing multi class classification?
Objective
Objective
inxgboost
is the function which the learning algorithm will try and optimize. By definition, it must be able to create 1st (gradient) and 2nd (hessian) derivatives w.r.t. the predictions at a given training round.A custom
Objective
function example:linkThis is the critical function to training and no
xgboost
model can be trained without defining one.Objective
functions are directly used in splitting at each node in each tree.feval
feval
inxgboost
plays no role in directly optimizing or training your model. You don't even need one to train. It doesn't impact splitting. All it does is score your model AFTER it has trained. A look at a example of a customfeval
Notice, it just returns a name(metric) and a score(value). Typically the
feval
andobjective
could be the same, but maybe the scoring mechanism you want is a little different, or doesn't have derivatives. For example, people use the loglossobjective
to train, but create an AUCfeval
to evaluate the model.Furthermore you can use the
feval
to stop your model from training once it stops improving. And you can use multiplefeval
functions to score your model in different ways and observe them all.You do not need a
feval
function to train a model. Only to evaluate it, and help it stop training early.Summary:
Objective
is the main workhorse.feval
is a helper to allowxgboost
to do some cool things.softmax
is anobjective
function that is commonly used in multi-class classification. It insures that all your predictions sum to one, and are scaled using the exponential function. softmax