Files
Castor/mp_cnn/evaluators/evaluator.py
Michael Tu 4470983504 TrecQA for MP-CNN (#77)
* Add TrecQA dataset and modularize MP-CNN infra

* Stylistic improvements

* Fix and warn about trec_eval path issue

* Update README for MP-CNN

* Update incorrect map/mrr

* MP-CNN: address code review comments

* Create common Castor pair Dataset class

* Move map and mrr computation to Castor utils

* Make map mrr utility trec_eval path more general
2017-11-04 18:22:40 -04:00

20 lines
734 B
Python

class Evaluator(object):
"""
Evaluates performance of model on a Dataset, using metrics specific to the Dataset.
"""
def __init__(self, dataset_cls, model, data_loader, batch_size, device):
self.dataset_cls = dataset_cls
self.model = model
self.data_loader = data_loader
self.batch_size = batch_size
self.device = device
def get_scores(self):
"""
Get the scores used to evaluate the model.
Should return ([score1, score2, ..], [score1_name, score2_name, ...]).
The first score is the primary score used to determine if the model has improved.
"""
raise NotImplementedError('Evaluator subclass needs to implement get_score')