Skip to main content
VierApparatus
On this page
  1. References

Level 08 · Biostatistics and Biological Data Science

Machine Learning

Statistical learning methods for predicting outcomes and finding structure in biological data, covering supervised and unsupervised learning, the division of data into training, validation and test sets, cross-validation for estimating prediction error, regularisation with the lasso to control the complexity of a model, random forests as ensembles of decision trees, performance metrics for classification and regression, the dangers of overfitting and of data leakage, and the reporting of a learning pipeline so that its predictions can be reproduced and judged.

2 min read · Updated

Listen to this moduleComing soon

Learning objectives

  • Distinguish supervised from unsupervised learning and estimate the prediction error of a model with a held-out or cross-validated sample.
  • Explain how regularisation and ensemble methods control overfitting and state the risk of data leakage in a pipeline.

Machine learning builds models that predict an outcome from measured features, or that find structure in data without an outcome to predict. In biology it is applied to gene expression profiles, images of tissue, sequences of proteins and clinical records, where the number of features is often larger than the number of samples. The methods are powerful, and the same flexibility that lets them fit complex patterns lets them fit noise, so the central discipline of the field is the honest estimation of how well a model will predict new cases.

The topic begins with the distinction between supervised learning, in which the model is trained to predict a known outcome, and unsupervised learning, in which it seeks groups or low-dimensional structure. The division of data into training, validation and test sets follows, together with cross-validation, which estimates prediction error by repeated splitting. Breiman (2001) described how ensembles of trees reduce error by averaging many models, and Tibshirani (1996) showed how a penalty can shrink coefficients and remove those that contribute little.

The later chapters address the evaluation and the pitfalls. Performance metrics summarise how well predictions match outcomes, and each metric answers a different question. Overfitting occurs when a model describes the training data too closely to generalise, and data leakage occurs when information from the test set influences training. Ioannidis (2005) described how flexibility in analysis produces findings that fail to replicate, and a machine learning pipeline is open to the same flaw.

The final chapter covers reporting. Peng (2011) argued that a computational result must be reproducible from the means of producing it, and Sandve et al. (2013) recommended keeping the data, the steps and the code together. A machine learning report must describe how the data were split, how the model was tuned and how its performance was estimated, so that a reader can judge whether a reported accuracy is real.

Chapters in this module

  • Supervised and Unsupervised Learning

    The distinction between supervised learning, in which a model learns a mapping from features to a known outcome, and unsupervised learning, in which a model finds groups, components or low-dimensional structure in features alone, the classification and regression forms of supervised learning, the clustering and dimension reduction forms of unsupervised learning, and the choice of approach by the question asked and the availability of labelled data.

  • Training, Validation and Test Sets

    The division of a dataset into a training set used to fit a model, a validation set used to choose its settings, and a test set held back to estimate its performance on new cases, the reason that the test set must be used once and only at the end, the stratification of the split to keep the outcome balanced, the handling of samples that are related by family, batch or patient, and the consequences of reusing the test set for model selection.

  • Cross-Validation

    Cross-validation as the repeated division of the data into folds, each of which serves in turn as the held-out sample while the others train the model, the k-fold and leave-one-out forms and their trade-off between bias and variance, the averaging of prediction error across folds with its spread, the nested form that keeps the tuning inside the training folds, and the reasons that cross-validation estimates the error of the procedure rather than of one fitted model.

  • Regularisation and the Lasso

    Regularisation as the addition of a penalty to the fit of a model so that its coefficients are shrunk towards zero, the lasso penalty on the absolute values of the coefficients that sets some of them exactly to zero and so selects variables, the ridge penalty on the squared values that shrinks without selection, the choice of the penalty strength by cross-validation, and the limits of the selected variables when predictors are strongly correlated.

  • Random Forests

    The random forest as an ensemble of decision trees, each grown on a bootstrap sample of the data with a random subset of predictors considered at each split, the averaging of the trees to reduce variance, the out-of-bag estimate of error from the samples each tree did not see, the variable importance measures and their bias towards variables with many levels, and the limits of interpretation of an ensemble that contains hundreds of trees.

  • Performance Metrics

    The metrics that summarise how well a classifier or a regression model predicts, namely sensitivity, specificity, positive and negative predictive values and the area under the receiver operating characteristic curve for classification, and the mean squared error, the mean absolute error and the coefficient of determination for regression, the dependence of predictive values on the prevalence of the outcome, the calibration of predicted probabilities, and the choice of a metric that reflects the costs of errors in the biological context.

  • Overfitting and Data Leakage

    Overfitting as the fitting of a model to the noise in its training data so that its error on new cases is much larger than its error on the training cases, the signs of overfitting in the gap between training and validation performance, the causes including too many predictors relative to samples and too flexible a model, data leakage as the use of information from the test cases or from the outcome during training, the common forms of leakage in feature selection and normalisation, and the procedures that prevent each.

  • Reporting Machine Learning

    What a report of a machine learning study must contain for its predictions to be judged and repeated, including the data and their source, the outcome and feature definitions, the split into training, validation and test sets with the rule for related samples, the tuning procedure and the search space, the metrics with their intervals and the prevalence of the outcome, the external validation of the model, and the deposition of the data, the code and the trained model.

References

  1. Breiman, L. (2001). Random Forests. Machine Learning, 45(1), 5-32. https://doi.org/10.1023/A%3A1010933404324
  2. Tibshirani, R. (1996). Regression Shrinkage and Selection Via the Lasso. Journal of the Royal Statistical Society Series B: Statistical Methodology, 58(1), 267-288. https://doi.org/10.1111/j.2517-6161.1996.tb02080.x
  3. Ioannidis, J. P. A. (2005). Why most published research findings are false. PLoS Medicine, 2(8), e124. https://doi.org/10.1371/journal.pmed.0020124
  4. Sandve, G. K., Nekrutenko, A., Taylor, J., & Hovig, E. (2013). Ten Simple Rules for Reproducible Computational Research. PLoS Computational Biology, 9(10), e1003285. https://doi.org/10.1371/journal.pcbi.1003285
  5. Peng, R. D. (2011). Reproducible Research in Computational Science. Science, 334(6060), 1226-1227. https://doi.org/10.1126/science.1213847

Callouts marked Commentary or Speculation in the lesson separate interpretation and open questions from established findings.