recbole.evaluator.proxy_evaluator

class recbole.evaluator.proxy_evaluator.ProxyEvaluator(config)[source]

Bases: object

ProxyEvaluator is used to assign the corresponding evaluator according to the evaluation metrics, for example, TopkEvaluator for top-k metrics, and summarize the results of all evaluators.

build()[source]

assign evaluators according to metrics.

Returns

a list of evaluators.

Return type

list

collect(interaction, scores)[source]

collect the all used evaluators’ intermediate result of one batch.

Parameters
  • interaction (Interaction) – AbstractEvaluator of the batch

  • scores (tensor) – the tensor of model output with size of (N, )

evaluate(batch_matrix_list, eval_data)[source]

calculate the metrics of all batches. It is called at the end of each epoch

Parameters
  • batch_matrix_list (list) – the results of all batches

  • eval_data (Dataset) – the class of test data

Returns

such as {'Hit@20': 0.3824, 'Recall@20': 0.0527, 'Hit@10': 0.3153, 'GAUC': 0.9236}

Return type

dict

merge_batch_result(batch_matrix_list)[source]

merge all the intermediate result got in self.collect for used evaluators separately.

Parameters

batch_matrix_list (list) – the results of all batches not separated

Returns

used evaluators’ results of all batches

Return type

dict