ML Concepts
Machine learning builds models that learn patterns from data. Instead of writing explicit rules, you provide examples and the algorithm finds the rules itself. This page covers the foundations you need before writing any code.
Supervised vs unsupervised learning
Section titled “Supervised vs unsupervised learning”Supervised learning uses labeled data: each example has input features and a known output, and the model learns to map inputs to outputs. Examples: predicting tumor malignancy from gene expression, patient survival from clinical variables, cell type from single-cell RNA-seq.
Unsupervised learning uses unlabeled data. There is no target; the model finds structure on its own. Examples: clustering patients into subgroups, reducing high-dimensional data to 2D (PCA, UMAP), finding co-expressed gene modules.
This section focuses on supervised learning for tabular data.
Regression vs classification
Section titled “Regression vs classification”Regression predicts a continuous number (drug IC50, patient age, expression level). Classification predicts a category (tumor vs normal, cancer subtype, cell type). The choice determines which algorithms, loss functions, and metrics you use.
The training workflow
Section titled “The training workflow”- Split the data into training and test sets. Hold the test set out.
- Preprocess the training data (scale, encode, impute).
- Train a model on the training data.
- Evaluate on the test set to estimate real-world performance.
┌─────────────────────────────────────┐│ Full dataset │├─────────────────────┬───────────────┤│ Training set │ Test set ││ (fit model) │ (evaluate) ││ ~80% │ ~20% │└─────────────────────┴───────────────┘Evaluating on the same data you trained on gives an overly optimistic estimate. That is one of the most common mistakes in machine learning.
Bias-variance tradeoff
Section titled “Bias-variance tradeoff”Model error comes from two sources. Bias is error from oversimplifying: a high-bias model underfits and misses real patterns. Variance is error from being too sensitive to the training data: a high-variance model overfits and captures noise as signal.
The figure shares its cosine function, thirty samples, and polynomial degrees with the scikit-learn developers’ Underfitting vs. Overfitting example. The companion generator changes the random seed, noise, polynomial fitter, plotting grid, and styles. It omits the original cross-validation calculation.
Scikit-learn source notice
BSD 3-Clause License
Copyright (c) 2007-2026 The scikit-learn developers. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The same noisy data (the dashed line is the truth) fit by three polynomials. Degree 1 is too simple to follow the curve (high bias). Degree 4 tracks it well. Degree 15 wiggles through every point, chasing noise (high variance). Reducing bias increases variance and vice versa; the goal is the sweet spot where total error is lowest.
Overfitting and underfitting
Section titled “Overfitting and underfitting”Overfitting: good on training data, poor on new data. The model memorized examples instead of learning generalizable patterns. Signs: training accuracy far above test accuracy, a very complex model.
Underfitting: poor on both training and test data. The model is too simple. Signs: both accuracies low, and adding complexity improves both.
Prevent overfitting with more data, a simpler model, regularization, cross-validation, and early stopping.
Parameters vs hyperparameters
Section titled “Parameters vs hyperparameters”Parameters are learned during training (regression weights, tree split points). Hyperparameters are set before training and control the learning process (number of trees, learning rate, regularization strength, tree depth). Choosing them well is hyperparameter tuning, covered in the Cross-Validation page.
No free lunch
Section titled “No free lunch”No single algorithm is best for every problem. The right choice depends on dataset size, feature types, whether the relationship is linear, and whether you need interpretability. Compare several algorithms on your data rather than assuming one wins. The Algorithms Overview describes the main ones and when each tends to work.
Next steps
Section titled “Next steps”The next page covers EDA: exploring your dataset before building any models.
Further reading
Section titled “Further reading”-
scikit-learn bias and variance example
The example estimates squared bias, variance, and noise across repeated training sets. It explains why prediction error contains more than the two terms illustrated by model complexity.
-
scikit-learn cross-validation guide
The guide explains what validation and test observations contribute to model assessment. It connects the workflow diagram to concrete split procedures.