liveBook · Manning

Evaluation dataset

As explained in Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI

Data used to measure a machine learning model's performance.

An evaluation dataset is labeled data held apart from training to measure a model’s performance. Often called a test set or held-out data, it provides a consistent check on accuracy as a model is retrained through active learning iterations. section 2.5.1 section 2.6

Select evaluation items randomly before using active learning or other sampling techniques, and keep them out of training and sampling throughout all iterations. Labeling some of these items yourself also helps you become familiar with the data. section 2.5.1 section 3.6.1 section 2.5

Sampling first can distort the apparent accuracy of a model:

  • After low-confidence items are removed from the unlabeled pool, a sample of what remains is biased toward high-confidence items and can make accuracy look too high. section 2.5.1 section 3.6.1
  • A sample drawn from training data selected by confidence can be biased toward low-confidence items and make accuracy look too low. section 2.5.1
  • After outlier detection, avoiding bias is especially difficult because selected items have already influenced the search for additional outliers. section 2.5.1

If an existing test set and the unlabeled data come from more or less the same distribution, the same test set can be reused. If their distributions differ or the relationship is uncertain, randomly select and label additional items; add them to the test set or create a separate one. Do this before the first uncertainty-sampling iteration. section 3.6.1

A separate random-sampling baseline can help evaluate the sampling strategy itself. Unlike the model’s held-out evaluation data, those baseline items can be added to training in the next iteration, because the comparison concerns the strategy at that step. section 3.6.1

Disaster-related headlines

Randomly select and annotate headlines before active learning begins. Keep those headlines held out while the classifier is retrained, then evaluate each iteration on them using measures such as F-score and AUC. section 2.5.1

Listing 2.6 Calculating precision, recall, F-score, and AUC
def evaluate_model(model, evaluation_data):
                    ...
                    ...
    # Get FScore
    if true_pos == 0.0:
        fscore = 0.0
    else:
        precision = true_pos / (true_pos + false_pos)
        recall = true_pos / (true_pos + false_neg)
        fscore = (2 * precision * recall) / (precision + recall)    #1
 
    # GET AUC
    not_related_confs.sort()
    total_greater = 0 # count of how many total have higher confidence
    for conf in related_confs:
        for conf2 in not_related_confs:
            if conf < conf2:                                        #2
                break
            else:                  
                total_greater += 1
 
 
    denom = len(not_related_confs) * len(related_confs) 
    auc = total_greater / denom
 
    return[fscore, auc]

The metric calculation shows how precision and recall contribute to F-score, alongside an AUC calculation for the held-out evaluation. section 2.5.1

How Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI covers it

How deep it goes
Explains when to select and reuse test data, how sampling biases arise, and how to compare a sampling strategy with a random baseline.
Examples
Evaluates a disaster-related headline classifier on held-out labels using F-score and AUC.
What you can do after
Evaluate and understand model accuracy by selecting a held-out random sample before active learning and keeping it separate throughout iterations.
How it connects
Connects evaluation datasets to active learning, uncertainty sampling, random sampling, and outlier detection.

Also explained in

Compare how 28 books explain evaluation dataset →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI. The section links point to the parts of the book it draws on.