(task_name, model_cls, dataset_fn, split, checkpoint=-1, use_iob_metrics=True)
Evaluate the model on a specific dataset split [train, validation, test].
    Evaluated for loss, accuracy, precision, recall, F1. Model hyperparameters
    are loaded automatically
    Parameters:
        task_name: Name of the task like NER1 etc. You must use the same name
                    that was provided during training
        model_cls: Model class name. Must be same as used during training
        dataset_fn: Dataset function. Must return a dict. See data/conll.py
        split: One of the strings train/validation/test
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
        use_iob_metrics: If True then adds IOB metrics (precision/recall/F1) 
                    to Evaluator
Evaluate the model on a specific dataset split [train, validation, test].
    Evaluated for loss, accuracy, precision, recall, F1. Model hyperparameters
    are loaded automatically
    Parameters:
        task_name: Name of the task like NER1 etc. You must use the same name
                    that was provided during training
        model_cls: Model class name. Must be same as used during training
        dataset_fn: Dataset function. Must return a dict. See data/conll.py
        split: One of the strings train/validation/test
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
        use_iob_metrics: If True then adds IOB metrics (precision/recall/F1) 
                    to Evaluator
Evaluate the model on a specific dataset split [ train validation test ] . Evaluated for loss accuracy precision recall F1 . Model hyperparameters are loaded automatically Parameters : task_name : Name of the task like NER1 etc . You must use the same name that was provided during training model_cls : Model class name . Must be same as used during training dataset_fn : Dataset function . Must return a dict . See data / conll . py split : One of the strings train / validation / test checkpoint : Checkpoint number ( train iteration ) to load from . - 1 for best / latest checkpoint use_iob_metrics : If True then adds IOB metrics ( precision / recall / F1 ) to Evaluator
def evaluate(task_name, model_cls, dataset_fn, split, checkpoint=-1, use_iob_metrics=True):
    """
    Evaluate the model on a specific dataset split [train, validation, test].
    Evaluated for loss, accuracy, precision, recall, F1. Model hyperparameters
    are loaded automatically
    Parameters:
        task_name: Name of the task like NER1 etc. You must use the same name
                    that was provided during training
        model_cls: Model class name. Must be same as used during training
        dataset_fn: Dataset function. Must return a dict. See data/conll.py
        split: One of the strings train/validation/test
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
        use_iob_metrics: If True then adds IOB metrics (precision/recall/F1) 
                    to Evaluator
    """
    iter_map = {'train': 0, 'validation': 1, 'test': 2}
    dataset = dataset_fn()
    data_iter = dataset['iters'][iter_map[split]]

    model, hparams = model_cls.load(task_name, checkpoint)

    metrics = [BasicMetrics(output_vocab=model.vocab_tags)]
    if use_iob_metrics:
        metrics += [IOBMetrics(tag_vocab=model.vocab_tags)]

    # Setup evaluator on the given dataset
    evaluator = Evaluator(data_iter, *metrics)
    results = evaluator.evaluate(model)

    print('{} set evaluation: {}-{}'.format(split, task_name, model.__class__.__name__))
    print(', '.join(['{}={:3.5f}'.format(k, v) for k,v in results.items()]))
def evaluate ( task_name , model_cls , dataset_fn , split , checkpoint = - 1 , use_iob_metrics = True ) : iter_map = { 'train' : 0 , 'validation' : 1 , 'test' : 2 } dataset = dataset_fn ( ) data_iter = dataset [ 'iters' ] [ iter_map [ split ] ] model , hparams = model_cls . load ( task_name , checkpoint ) metrics = [ BasicMetrics ( output_vocab = model . vocab_tags ) ] if use_iob_metrics : metrics += [ IOBMetrics ( tag_vocab = model . vocab_tags ) ] # Setup evaluator on the given dataset evaluator = Evaluator ( data_iter , * metrics ) results = evaluator . evaluate ( model ) print ( '{} set evaluation: {}-{}' . format ( split , task_name , model . __class__ . __name__ ) ) print ( ', ' . join ( [ '{}={:3.5f}' . format ( k , v ) for k , v in results . items ( ) ] ) )