Matt Scholar Solutions

Skills · Data science and AI

Machine learning for dissertation research

Learn to prepare data, build and tune models, and evaluate them in a way examiners trust, in Python with scikit-learn. You'll understand why each step matters, avoid the mistakes that inflate results, and be able to explain your model in your viva.

Introduction

Learn to prepare data, build and tune models, and evaluate them in a way examiners trust, in Python with scikit-learn. You'll understand why each step matters, avoid the mistakes that inflate results, and be able to explain your model in your viva.

When you need this skill

  • Your dissertation builds a classification or regression model on tabular data.
  • You're comparing machine learning methods on a dataset.
  • Your results look suspiciously good and you need to check them.
  • You need to explain which features drive your model's predictions.

Common student questions

Which machine learning algorithm should I start with?

Start with a simple, interpretable baseline, such as logistic regression or a decision tree, then try stronger models such as random forests and gradient boosting. On tabular data, tree-based ensembles are hard to beat: Grinsztajn, Oyallon and Varoquaux (2022) found they remained state-of-the-art on medium-sized tabular datasets of around 10,000 samples, outperforming deep learning methods.

How should I split my data?

Hold out a test set that you use only once, at the end. Within the training data, use k-fold cross-validation to compare models and tune settings. Use stratified folds when classes are imbalanced, and time-ordered splits for time-series data, so the model never learns from the future. To tune and evaluate on the same data honestly, use nested cross-validation.

What is data leakage, and how do I avoid it?

Data leakage happens when information that wouldn't be available at prediction time is used to build the model, which inflates your results. The scikit-learn documentation's rule is simple: never fit anything on the test data. Learn scaling, imputation and feature selection from the training data only, and use a scikit-learn Pipeline so this happens automatically inside cross-validation.

How do I handle imbalanced classes?

First, choose the right metrics: with imbalanced data, accuracy misleads, so report precision, recall, F1 and the precision–recall curve. Then try class weights, or resampling methods such as SMOTE (Chawla et al., 2002). Apply any resampling only to the training folds, inside your pipeline; resampling before splitting leaks information into the test set.

How do I tune hyperparameters?

Search over a defined set of values using cross-validation on the training data only. Random search is often more efficient than an exhaustive grid search, because only a few hyperparameters usually matter (Bergstra and Bengio, 2012). Record the search space and the final settings, so your results can be reproduced.

How do I explain what my model has learned?

Use permutation importance to see which features matter most for performance, and SHAP values (Lundberg and Lee, 2017) to explain individual predictions and overall patterns. Treat explanations as describing the model, not proving cause and effect in the real world, and check that they make sense in your domain.

What you'll learn

  • Explore, clean and prepare tabular data with pandas
  • Engineer and encode features correctly
  • Build reproducible scikit-learn pipelines
  • Train baselines, then stronger models such as random forests and gradient boosting
  • Split data and cross-validate properly, including stratified and time-series splits
  • Handle imbalanced data and choose the right metrics
  • Tune hyperparameters without leaking test information
  • Explain models with permutation importance and SHAP, and compare models fairly

Tools required

Machine learning tools and their uses
ToolUsed for
Python with Jupyter notebooksWriting and documenting your analysis
pandas and NumPyLoading, cleaning and transforming data
scikit-learnModels, pipelines, cross-validation and tuning
XGBoost or LightGBMGradient boosting models
SHAPExplaining model predictions
matplotlib and seabornCharts of data and results

How sessions work

Live online sessions, scheduled around your time zone. We build a complete project together on a sample public dataset, step by step, then you apply each step to your own project between sessions. Recordings and notebooks are available to revisit. This skill is taught in the Python and Machine Learning for Research.

Worked example

Sample project: Predicting customer churn for a subscription business, using a public dataset with imbalanced classes.

  1. 1. Explore

    Check class balance, missing values and feature types.

  2. 2. Split

    Hold out a stratified test set and set it aside.

  3. 3. Pipeline

    Imputation, encoding and scaling inside one scikit-learn Pipeline.

  4. 4. Baseline

    Logistic regression, evaluated with stratified cross-validation on recall, precision and F1.

  5. 5. Stronger models

    Random forest and gradient boosting, tuned with a random search inside the cross-validation.

  6. 6. Imbalance

    Compare class weights with SMOTE applied only within the training folds.

  7. 7. Final test

    Evaluate the chosen model once on the held-out test set.

  8. 8. Explain

    Use permutation importance and SHAP to show which features drive churn predictions.

Practical guidance

FAQs

Do I need strong maths to learn machine learning?
No. An understanding of basic statistics helps, and we explain the ideas behind each method in plain terms as we go.
Should I use deep learning instead?
For tabular data, usually not: tree-based ensembles often perform better. Deep learning suits images, text and audio. See the deep learning skill page.
My results are very high. Is that good?
Check for leakage first. Unusually high scores often come from preprocessing on the full dataset, duplicate records across splits or a feature that encodes the answer.
How do I make my results reproducible?
Fix random seeds, record library versions, keep your code in version control, and report results across several runs or folds.
Free 20-minute consultation · No obligation

Learn to build and evaluate your models with a mentor

We will understand your course, stage, and specific roadblocks, and recommend a structured skills programme—or tell you honestly if we are not the right fit.

Discuss topic & timeline
Honest feasibility check
Pricing discussed transparently

Pricing is discussed in your free consultation.

Written by the Matt Scholar research team · Last reviewed 15 November 2026

References

  • Bergstra, J. and Bengio, Y. (2012) 'Random search for hyper-parameter optimization', Journal of Machine Learning Research, 13, pp. 281–305.
  • Chawla, N.V., Bowyer, K.W., Hall, L.O. and Kegelmeyer, W.P. (2002) 'SMOTE: synthetic minority over-sampling technique', Journal of Artificial Intelligence Research, 16, pp. 321–357.
  • Grinsztajn, L., Oyallon, E. and Varoquaux, G. (2022) 'Why do tree-based models still outperform deep learning on typical tabular data?', Advances in Neural Information Processing Systems 35 (Datasets and Benchmarks Track).
  • Lundberg, S.M. and Lee, S.-I. (2017) 'A unified approach to interpreting model predictions', Advances in Neural Information Processing Systems 30.
  • scikit-learn developers. 'Common pitfalls and recommended practices', scikit-learn documentation. Available at: scikit-learn.org.