Complete for freeAdvanced

Course 22

Machine Learning for Scientific Research

Many published ML results in science don't survive a second look: a test set from the same hospital as the training data, a deep network that a two-parameter logistic regression matches, a 2-point gain measured on 60 images. This course teaches the habits that catch those problems before your own project makes them. You work in Google Colab (or Jupyter) with NumPy, pandas, SciPy, statsmodels, scikit-learn, and matplotlib. You start by setting up a project that can be rerun: a folder that keeps raw data raw, pinned library versions, seeds, data fingerprints, and run records. Then you turn hunches into testable questions, build an evidence table that recomputes what papers left out, audit multi-site datasets for missingness, batch effects, and confounding, design randomized and blocked follow-up experiments sized with a power analysis, and climb a baseline ladder from dummy models to linear models before anything complex. Later modules quantify uncertainty with confidence and bootstrap intervals, run ablations, sensitivity checks, and leakage hunts, and practice reproducing and reporting results honestly, including discrepancies. Real cases from the literature, such as the pneumonia model that learned to recognize hospitals and Kapoor and Narayanan's survey of leakage across 30 fields, appear throughout. Every example uses simulated scientific data with realistic structure (sites, batches, repeated measurements) or datasets that ship with scikit-learn, and every Python cell on these pages was run to produce the numbers and charts you see. Each core module has a Notes lesson, a Build-along, and a Practice set with worked solutions, and the course ends with a reproduction study of a published result.

Free completion promise: Every lesson can be completed for $0. Google Colab's free tier runs every notebook in the course, all the libraries are open source, the key papers discussed are open access or have free copies, and every dataset is either generated by code on the page or ships with scikit-learn.

What's inside

  • 24hand-written lessons
  • 19videos
  • 2step-through animations
  • 34diagrams, charts & live previews
  • 49quiz questions
  • 166code examples

Before you begin

Requirements & setup for Machine Learning for Scientific Research

Start with the complete free pathway below. Hardware, subscriptions, paid APIs, and cloud credits are never required.

Start here ยท free path

Your complete $0 setup

Every lesson can be completed for $0. Google Colab's free tier runs every notebook in the course, all the libraries are open source, the key papers discussed are open access or have free copies, and every dataset is either generated by code on the page or ships with scikit-learn.

$0 required

Setup checklist

0 of 9 complete

This checklist is a temporary setup aid and resets when the page reloads. Saved course progress begins in the setup lessons below.

  1. Everything required for this course is free. Paid software, APIs, cloud credits, GPUs, and physical equipment are optional.

    About 2 min
  2. Go to colab.research.google.com and sign in with a Google account (a personal account avoids school restrictions on Drive access).

  3. Choose File > New notebook in Drive and rename the notebook 00-setup.ipynb.

    About 5 min
  4. Run a cell with from google.colab import drive and drive.mount("/content/drive"), and approve access, so files you write under /content/drive/MyDrive are kept.

    About 5 min
  5. Run the version cell from the first lesson, which prints and saves the versions of Python, NumPy, pandas, SciPy, statsmodels, scikit-learn, and matplotlib.

    About 5 min
  6. Every lesson works in Google Colab (free) with scikit-learn and statsmodels, so Python 3.10+ with JupyterLab on your own computer is never required.

  7. If you have Python 3.10+ with JupyterLab on your own computer, use it where a lesson mentions it and compare your result with the lesson's.

    About 5 min
  8. If it doesn't match, finish that step in Google Colab (free) with scikit-learn and statsmodels and keep going.

    About 5 min
  9. Google Colab (free) with scikit-learn and statsmodels: The version cell prints all six library versions, writes environment.json and requirements.txt into your project folder in Drive, and the drift check prints "Environment matches results/environment.json". Python 3.10+ with JupyterLab on your own computer: The version cell prints all six library versions, writes environment.json and requirements.txt into your project folder in Drive, and the drift check prints "Environment matches results/environment.json".

    About 5 min

Software

1 item

Google Colab (free) with scikit-learn and statsmodels

Colab is Google's free hosted Jupyter notebook. Your code runs on a Google machine, notebooks save to your Google Drive, and it works in any modern browser, Chromebooks included. NumPy, pandas, SciPy, statsmodels, scikit-learn, and matplotlib normally come preinstalled. The first lesson connects the notebook to Drive so project files survive a restart, and records the exact library versions in requirements.txt. A local JupyterLab install works just as well.

Course need
Google Colab (free) with scikit-learn and statsmodels
Free

Colab is Google's free hosted Jupyter notebook. Your code runs on a Google machine, notebooks save to your Google Drive, and it works in any modern browser, Chromebooks included. NumPy, pandas, SciPy, statsmodels, scikit-learn, and matplotlib normally come preinstalled. The first lesson connects the notebook to Drive so project files survive a restart, and records the exact library versions in requirements.txt. A local JupyterLab install works just as well. Every lesson is readable text with copyable code, keyboard-friendly quizzes and step-throughs, and videos with YouTube captions.

  1. Go to colab.research.google.com and sign in with a Google account (a personal account avoids school restrictions on Drive access).
  2. Choose File > New notebook in Drive and rename the notebook 00-setup.ipynb.
  3. Run a cell with from google.colab import drive and drive.mount("/content/drive"), and approve access, so files you write under /content/drive/MyDrive are kept.
  4. Run the version cell from the first lesson, which prints and saves the versions of Python, NumPy, pandas, SciPy, statsmodels, scikit-learn, and matplotlib.

Hardware

1 item

Python 3.10+ with JupyterLab on your own computer

Optional. A local virtual environment works offline and has no session limits; the first lesson has the install steps for Windows, macOS, and Linux.

Optional
Google Colab (free) with scikit-learn and statsmodels
Free

Optional. Every lesson can be completed with Google Colab (free) with scikit-learn and statsmodels; Python 3.10+ with JupyterLab on your own computer is an extra for learners who have it. Optional equipment: every assessed outcome can be completed without it.

  1. Every lesson works in Google Colab (free) with scikit-learn and statsmodels, so Python 3.10+ with JupyterLab on your own computer is never required.
  2. If you have Python 3.10+ with JupyterLab on your own computer, use it where a lesson mentions it and compare your result with the lesson's.
  3. If it doesn't match, finish that step in Google Colab (free) with scikit-learn and statsmodels and keep going.

Accounts

Nothing required

No external account is needed for this course.

What you will be able to do

Learning outcomes

  • Turn a research idea into a testable question with a population, inputs, a comparison, an outcome metric, and a success threshold, and distinguish prediction questions from causal ones.
  • Read ML papers critically, recomputing confidence intervals, majority-class baselines, and effect sizes that papers omit.
  • Audit a dataset's provenance, missingness patterns, batch effects, and confounders, and design a randomized, blocked, controlled experiment sized with a power analysis.
  • Compare models fairly with a baseline ladder on the right held-out groups, reporting spread across folds and seeds.
  • Quantify uncertainty and test results with ablations, sensitivity analyses, and leakage checks.
  • Package an experiment so it reruns from one configuration, and reproduce and report a published result with its discrepancies and limitations.

Build real work

Assignments & capstone

Free tools accepted

Dataset audit and experiment design

In Colab, fingerprint a pilot dataset with SHA-256, audit it for provenance, independent units, missing values, and site effects, test whether a model's score holds on a new site, and design a randomized, blocked follow-up sized with a power analysis.

Every lesson can be completed for $0. Google Colab's free tier runs every notebook in the course, all the libraries are open source, the key papers discussed are open access or have free copies, and every dataset is either generated by code on the page or ships with scikit-learn. Submit your project file, or screenshots with descriptions, or a short demo.

Baseline ladder with intervals

Score a ladder of baselines and one complex model on held-out batches, compare them on paired cross-validation folds with a corrected interval and on a locked test set with bootstrap intervals, and package the experiment as one function that writes a run record.

Every lesson can be completed for $0. Google Colab's free tier runs every notebook in the course, all the libraries are open source, the key papers discussed are open access or have free copies, and every dataset is either generated by code on the page or ships with scikit-learn. Submit your project file, or screenshots with descriptions, or a short demo.

Final assessment

Published-result reproduction

Reproduce one published machine-learning result, such as the wrong-way cross-validation example in Elements of Statistical Learning, with a plan and match rule written first, provenance checks, a baseline and controls, intervals on every number, and sensitivity checks. Deliverables: Colab notebook that regenerates every number and figure, 4 to 6 page report with a discrepancy log, Completed REFORMS checklist, and Five-minute talk.

Prerequisites & pacing

Skills assumed

  • Python in notebooks: functions, loops, dictionaries, and reading a traceback
  • pandas and NumPy basics: selecting columns, grouping, and array shapes
  • One complete scikit-learn workflow: split, fit, predict, and score with cross-validation
  • Introductory statistics: means, standard deviations, and what a p-value is

Recommended prior courses

These are advisory, not locks. If you already have the skills listed above, enroll directly.

Choose your pace

  • self paced: 12 weeks at 5 hours per week
  • weekly: 12 weeks at 5 hours per week

Part of this learning path

Course created by Zafir Shamsi.