Machine Learning
A predictive analysis needs a defined target population and an evaluation that represents new observations. This section uses Python to prepare tabular and sequence data, compare models without leakage, and interpret their predictions. The examples cover linear models, tree ensembles, neural networks, and foundation models without assuming that one family wins on every dataset.
How to use this section
Section titled “How to use this section”- Python throughout. scikit-learn for the workflow, XGBoost / LightGBM / CatBoost for the models, PyTorch for deep learning.
- Every result is real. All code runs in a container in a companion repository. The numbers and figures come from those runs. A few tools with heavy or conflicting dependencies (AutoML, TabPFN) are marked reference only.
- Each guide teaches the decision. When to use a method, how to avoid the common traps, how to read the output, and where it fails.
Choose the evaluation before the algorithm
Section titled “Choose the evaluation before the algorithm”| Intended use | Decision to make first |
|---|---|
| Predict for new patients | Keep each patient’s measurements in one partition. See cross-validation. |
| Predict a later event | Keep future observations outside the available history. A random row split answers a different question. |
| Predict from tables with missing values and categories | Fit all preprocessing within training partitions. See scikit-learn pipelines. |
| Act on a predicted probability | Evaluate probability quality and select the threshold using development data. See model evaluation. |
| Compare a pretrained model with a conventional model | Use the same partitions, metrics, and information access. See foundation model evaluation. |
The complete workflow uses generated independent rows to teach the sequence. It is not an external biological validation. Its model ranking applies to that example.
Foundations
Section titled “Foundations”ML ConceptsSupervised vs unsupervised, over- and underfitting, the bias-variance tradeoff.
EDA for MLExplore a dataset before modelling: distributions, correlations, leakage checks.
Preprocessing & Data LeakageSplit, scale, encode, and impute inside a Pipeline so the test set stays clean.
Feature EngineeringBuild informative features without leaking the target.
Feature SelectionFilter, wrapper, and model-based selection on high-dimensional data.
Model selection & evaluation
Section titled “Model selection & evaluation”Cross-ValidationEstimate performance honestly with stratified and grouped folds.
Model EvaluationConfusion matrix, ROC-AUC, precision-recall, and picking the right metric.
Algorithms
Section titled “Algorithms”Algorithms OverviewA visual tour of the main model families, with StatQuest videos.
Linear & Logistic RegressionThe baselines every project should start from, with regularization.
Bagging & BoostingRandom forests and gradient boosting, the two great tree ensembles.
XGBoostThe gradient-boosting workhorse, with SHAP interpretation.
LightGBMFast, leaf-wise boosting for larger tabular data.
CatBoostBoosting with native categorical handling.
Ensembling
Section titled “Ensembling”OOF Blending & Hill ClimbingCombine models with out-of-fold predictions and a greedy weight search.
StackingTrain a meta-model on out-of-fold predictions.
End-to-End PipelineThe whole workflow: compare, select, evaluate, interpret.
Deep learning
Section titled “Deep learning”Neural Networks with PyTorchBuild and train a multilayer perceptron on tabular data.
CNNs for SequencesDetect a DNA motif with a convolutional network and read it back out.
AutoML & foundation models
Section titled “AutoML & foundation models”AutoML with AutoGluonA competitive stacked model in one line (reference only).
AutoML with FLAMLFast, cost-aware tuning on a laptop (reference only).
AutoML with auto-sklearnThe canonical Bayesian-search baseline (reference only).
Tabular Deep LearningTabNet, TabTransformer, TabPFN, and TabM (reference only).
Tabular Foundation ModelsCompare TabPFN 3.5 with NVIDIA Kumo and run a local Kumo Tabular example.