liveBook · Manning

Cross-validation

As explained in Effective Conversational AI

K-fold cross-validation is a model-evaluation technique that partitions a dataset into k folds and repeatedly evaluates a model with each fold held out in turn.

When a chatbot misreads an intent, it may give the wrong response or fail to start the right flow. K-fold cross-validation estimates how consistently an intent classifier handles its existing training examples, without requiring additional annotated data. section 4.2.1

The test repeatedly holds out part of the training set:

  • Set aside a portion as a temporary blind test set and train a temporary classifier on the rest. section 4.2.1
  • Run the held-out examples through the classifier, score its predictions, and return those examples to the training set. section 4.2.1
  • Repeat the process k times; review accuracy, precision, and recall to find intents that may be confusing the classifier. section 4.2.1

A baseline for a chatbot

In a 125-question test, the classifier predicted 105 correctly, for 84% accuracy. Two intents with only three training examples had zero recall, illustrating how sparse data can make fold-based results unstable. section 5.1.3

Figure 4.5 K-fold cross validation and generated test data are suitable for situations where representative data is not available. Once a solution is deployed to production, representative blind test data will produce the most reliable measurement of your classifier’s ability to understand.
figure

Use the figure to distinguish when cross-validation is useful from when representative blind data is available after deployment. section 4.2.1

Treat the result as a baseline, not a guarantee of production performance: cross-validation reflects consistency within the training data. Once the chatbot is live, representative blind tests built from actual user utterances provide a more reliable measure. section 4.2.1 section 5.1.3

How Effective Conversational AI covers it

How deep it goes
Outlines repeated holdout, scoring, and reintegration, but leaves detailed testing instructions to further guidance.
Examples
Uses a 125-question chatbot baseline with 84% accuracy to show how sparse intents can produce zero recall.
What it assumes
Requires an existing training set, which supplies both the temporary training data and held-out examples.
What you can do after
Evaluate baseline classifier performance and identify weak intents while treating results cautiously.
How it connects
Connects classifier evaluation to accuracy, precision, recall, training data, and blind testing.

Also explained in

Compare how 12 books explain cross-validation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Conversational AI. The section links point to the parts of the book it draws on.