ML Foundations
The Science of Getting Computers to Learn from Data
Machine learning is transforming every industry — from healthcare to finance to autonomous vehicles. Understanding the fundamentals is the first step to building intelligent systems.
- Supervised Learning — Learn from labeled data to make predictions
- Unsupervised Learning — Discover hidden patterns in unlabeled data
- The ML Workflow — A systematic approach from problem definition to deployment
"Machine learning is the last invention that humanity will ever need to make."
What is Machine Learning? — Complete Introduction
Machine Learning is the science of getting computers to learn from data without being explicitly programmed. This tutorial provides a comprehensive foundation for your entire ML journey.
What is Machine Learning?
DfMachine Learning
Machine Learning is a branch of artificial intelligence that enables systems to learn and improve from experience without being explicitly programmed. Formally, a computer program is said to learn from experience with respect to some task and performance measure , if its performance at task , as measured by , improves with experience (Mitchell, 1997).
Traditional Programming vs Machine Learning
How ML reverses traditional programming: The top half shows traditional programming: a human explicitly writes rules (if-else statements) that transform input data into outputs. For email spam filtering, you'd write rules like "if email contains 'free money', mark as spam." The bottom half shows the ML approach: instead of writing rules, you provide examples (labeled emails) and the algorithm automatically discovers the rules. The red "Learned Rules (Model)" box represents what the ML algorithm produces — a mathematical function that maps inputs to outputs. The text at the bottom summarizes the paradigm shift: traditional = Data + Rules → Output; ML = Data + Output → Rules. This is powerful because the learned rules can capture patterns too complex for humans to specify manually — like recognizing spam based on thousands of subtle features simultaneously.
Types of Machine Learning
Supervised Learning
DfSupervised Learning
Given a training set where are input features and are labels, supervised learning seeks a function that maps inputs to outputs while minimizing expected loss .
Unsupervised Learning
DfUnsupervised Learning
Given unlabeled data , unsupervised learning seeks to discover the underlying structure or low-dimensional representations. This includes clustering, dimensionality reduction, density estimation, and generative modeling.
Reinforcement Learning
DfReinforcement Learning
An agent interacts with an environment in discrete time steps, observing state , taking action , and receiving reward . The goal is to learn a policy that maximizes the expected cumulative discounted reward: where is the discount factor.
ML Algorithm Taxonomy
Key Applications
The ML Workflow
Why It Matters
Understanding the ML workflow is essential because it provides a systematic approach to solving problems with data. Each step builds on the previous one, and skipping steps often leads to poor model performance. The workflow is inherently iterative — expect to revisit earlier stages as you gain insights.
Key Concepts
Training, Validation, and Test Sets
DfData Splitting
Given dataset of size , we partition it into three disjoint subsets: training set (typically 60-80%), validation set (10-20%), and test set (10-20%). The training set fits model parameters, the validation set tunes hyperparameters, and the test set provides an unbiased estimate of generalization performance. Formally, with pairwise disjoint intersections.
Bias-Variance Decomposition
ThBias-Variance Decomposition
For a model trained on dataset , the expected prediction error at a point can be decomposed as:
where , , and is the irreducible noise.
Overfitting vs Underfitting
DfOverfitting
Overfitting occurs when a model learns the training data too well, including noise and random fluctuations, resulting in poor generalization. Formally, overfitting occurs when the model's test error increases while training error continues to decrease. This corresponds to a model with high variance and low bias.
DfUnderfitting
Underfitting occurs when a model is too simple to capture the underlying patterns in the data, resulting in poor performance on both training and test data. This corresponds to a model with high bias and low variance.
Common ML Algorithms
Key Takeaways
Summary: What is Machine Learning
- ML learns patterns from data instead of explicit rules
- Supervised learning: with labeled pairs (most common)
- Unsupervised learning: discover or latent structure without labels
- Reinforcement learning: maximize through trial and error
- Always split data into train/validation/test sets to estimate generalization
- Bias-variance tradeoff:
- Overfitting is the #1 problem — model memorizes instead of learns
- Start simple, add complexity only when needed (Occam's Razor)
- Data quality matters more than algorithm choice — garbage in, garbage out
- The ML workflow is iterative — expect to repeat steps as you gain insights
What to Learn Next
-> Math Foundations Master the essential math — vectors, matrices, derivatives, and probability.
-> Linear Regression The simplest and most fundamental ML algorithm for predicting continuous values.
-> Logistic Regression Classification with probability — from linear to sigmoid.
-> KNN Instance-based learning where your neighbors tell the story.
-> Decision Trees If-then rules that learn — the most interpretable algorithm.
-> Model Evaluation How to know if your model actually works — beyond accuracy.