lightgbm.record_evaluation

lightgbm.record_evaluation(eval_result)[source]

Create a callback that records the evaluation history into eval_result.

Parameters:

eval_result (dict) –

Dictionary used to store all evaluation results of all validation sets. This should be initialized outside of your call to record_evaluation() and should be empty. Any initial contents of the dictionary will be deleted.

Example

With two validation sets named ‘eval’ and ‘train’, and one evaluation metric named ‘logloss’ this dictionary after finishing a model training process will have the following structure:

{
 'train':
     {
      'logloss': [0.48253, 0.35953, ...]
     },
 'eval':
     {
      'logloss': [0.480385, 0.357756, ...]
     }
}

Returns:

callback – The callback that records the evaluation history into the passed dictionary.

Return type:

_RecordEvaluationCallback