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
Objectiveinxgboostis 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
Objectivefunction example:linkThis is the critical function to training and no
xgboostmodel can be trained without defining one.Objectivefunctions are directly used in splitting at each node in each tree.feval
fevalinxgboostplays 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 customfevalNotice, it just returns a name(metric) and a score(value). Typically the
fevalandobjectivecould be the same, but maybe the scoring mechanism you want is a little different, or doesn't have derivatives. For example, people use the loglossobjectiveto train, but create an AUCfevalto evaluate the model.Furthermore you can use the
fevalto stop your model from training once it stops improving. And you can use multiplefevalfunctions to score your model in different ways and observe them all.You do not need a
fevalfunction to train a model. Only to evaluate it, and help it stop training early.Summary:
Objectiveis the main workhorse.fevalis a helper to allowxgboostto do some cool things.softmaxis anobjectivefunction 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