9 Error analysis

 

This chapter covers

  • Learning curve analysis
  • Residual analysis
  • Finding commonalities in residuals

Once we’ve assembled the initial building blocks, which include gathering the first dataset, picking the metrics, defining the evaluation procedure, and training the baseline, we are ready to start the iterative adjustments process. Just as backpropagation in neural networks calculates the direction of the fastest loss reduction and passes it backward from layer to layer, error analysis finds the fastest improvement for the whole system.

Error analysis steps up as the compass that guides the iterative updates of your system. It helps you understand the error dynamics during the training phase (learning curve analysis) and the distribution of errors after the prediction phase (residual analysis). By analyzing these errors, you can identify commonalities, trends, and patterns that inform improvements to your machine learning (ML) system. In this chapter, we will examine its crucial stages and types and provide examples that we hope will give you a better understanding of the subject.

Error analysis is often skipped when ML systems are designed for a reason that seems somewhat legit at first glance—this step is not part of building the system per se. However, time spent on error analysis is always a good investment as it reveals weak spots and suggests ways of improving the system. Leaving this step out of this book would be a huge mistake from our side.

9.1 Learning curve analysis

9.1.1 Overfitting and underfitting

9.1.2 Loss curve

9.1.3 Interpreting loss curves

9.1.4 Model-wise learning curve

9.1.5 Sample-wise learning curve

9.1.6 Double descent

9.2 Residual analysis

9.2.1 Goals of residual analysis

9.2.2 Model assumptions

9.2.3 Residual distribution

9.2.4 Fairness of residuals

9.2.5 Underprediction and overprediction

9.2.6 Elasticity curves

9.3 Finding commonalities in residuals

9.3.1 Worst/best-case analysis

9.3.2 Adversarial validation

9.3.3 Variety of group analysis

9.3.4 Corner-case analysis

9.4.1 Error analysis for Supermegaretail