← Back to portfolio

The Language of Machine Learning

Overview of Terminology & Concepts · Updated November 1, 2018 · Tim Sent

A working vocabulary for machine learning — from what separates Artificial General Intelligence from the narrow, task-specific systems we actually build today, through the three families of learning problems, into the core algorithms, cost functions, and neural network fundamentals underneath them.

Foundations

Making sense of the terminology

🌐

Artificial General Intelligence (AGI) / Strong AI

  • The ability for a machine to apply intelligence to any range of intellectual tasks a human can perform
  • A machine that is conscious, sentient and self-aware
  • Doesn't currently exist and is far from reality — often called the "holy grail of AI"
  • Frequently depicted as a dystopian vision of intelligent machines eradicating or enslaving humanity, as in The Matrix or The Terminator
🎯

Artificial Narrow Intelligence (ANI) / Weak AI

  • The ability for a machine to perform a narrow, pre-defined range of tasks focused on a specific problem, without genuine intelligence or awareness
  • The terms Artificial Intelligence, ANI, Weak AI, and Machine Learning are frequently used interchangeably

Three families

Types of Machine Learning

There are three types of Artificial Narrow Intelligence (ANI), distinguished by how the algorithm learns from data.

🏷️

Supervised & Semi-Supervised

An algorithm is provided a set of labeled training data where the output is already known. It learns a function mapping inputs to outputs. Includes regression and classification problems.

🧩

Unsupervised Learning

Algorithms find structure from a set of unlabeled data. Includes clustering and non-clustering problems.

🎮

Reinforcement Learning

Software agents take actions in an environment so as to maximize some notion of cumulative reward.

Supervised Learning

Teaching a machine from labeled examples

Problem Types

Regression

Predicts a continuous output by mapping input variables to a continuous function — learning the relationship between a dependent variable and one or more independent variables from labeled training data.

Example: predicting the price of a house by learning the relationship between features like square footage, number of bedrooms, and age of the house.

Classification

Predicts a discrete output by mapping input variables into categories or classes — training an algorithm to identify which category a new observation belongs to, based on labeled examples.

Example: identifying email as spam or not-spam by learning characteristics from labeled training data.

Labeled Training Set Machine Learning Algorithm Predictive Model (Hypothesis) hθ(x) y new example (x) →

Supervised learning pipeline — a labeled training set produces a model that maps new feature vectors (x) to predictions (y).

Regression Problems

Univariate Linear Regression

Predicting house sales using linear regression with one variable. The first step in a regression problem is choosing a function — linear, quadratic, or second-order polynomial — to fit the training data.

Index (i)Size in ft² (x)Price ($1,000s) (y)
12,104460
21,416232
31,534315
4852178
………
Hypothesis — a function mapping x's to y's hθ(x) = θ₀ + θ₁x

This dataset — home sales from Portland, Oregon — is labeled training data: it includes both the input (size) and the output being predicted (price). The learning algorithm's job is to train θ₀ and θ₁ so the hypothesis fits the data as closely as possible.

0 125 250 375 500 Price ($1,000s) 0 500 1,000 1,500 2,000 Size (ft²)

The four labeled examples from the table, with the least-squares fit hθ(x) = −42.7 + 0.230x (dashed red = residual error per point).

Cost (Loss) Function

Machine learning algorithms rely on minimizing or maximizing an "objective function." The functions that are minimized are called cost or loss functions — they measure the difference between the predicted value and the actual value, and choosing parameters that minimize this error is how a model is fit.

The most common loss function for regression is Mean Squared Error (MSE, L2). Other options include Mean Absolute Error (MAE, L1), Huber Loss / Smooth MAE, Log-Cosh Error, and Quantile Loss. MSE is easier to solve; MAE is more robust to outliers.

Mean Squared Error (L2) J(θ) = (1/m) Σᵢ₌₁ᵐ (hθ(x⁽ⁱ⁾) − y⁽ⁱ⁾)²
Mean Absolute Error (L1) J(θ) = (1/m) Σᵢ₌₁ᵐ |hθ(x⁽ⁱ⁾) − y⁽ⁱ⁾|
θ J(θ) minimum

Gradient descent: each step moves against ∇J(θ), converging toward the minimum at the bottom of the bowl.

Batch Gradient Descent

Update rule — repeat until convergence θⱼ := θⱼ − α · ∂J(θ)/∂θⱼ   (simultaneously for every j)
  • Each step of gradient descent sums over all the training examples
  • The goal is to find the smallest value for the cost function
  • It's often helpful to adjust features to a similar scale — a technique called feature scaling
  • The first step is taking the derivative of the cost function
  • Identify starting values for the hyperparameters and a learning rate, then iterate until convergence

Multivariate Linear Regression

Linear regression with multiple variables, represented as vectors.

iSize (x₁)Bedrooms (x₂)Floors (x₃)Age (x₄)Price (y)
12,1045145460
21,4163240232
31,5343230315
48522136178
Hypothesis, generalized to n features hθ(x) = θ₀ + θ₁x₁ + θ₂x₂ + θ₃x₃ + θ₄x₄  =  θᵀx

For convenience of notation, x₀ is defined as 1, so the parameter vector θ and feature vector x are both (n+1) × 1, and the hypothesis reduces to the vector product θᵀx.

θ₀ θ₁ θ₂ ⋮ θₙ θ (n+1 × 1) · x₀=1 x₁ x₂ ⋮ xₙ x (n+1 × 1) = θᵀx

The hypothesis as a dot product of two (n+1)-dimensional column vectors.

Classification Problems

Logistic Regression

Binary classification using logistic regression — a sigmoid function maps any real-valued input into a range between 0 and 1, and a threshold on that output defines the decision boundary.

Sigmoid function g(z) = 1 / (1 + e−z)
Logistic regression hypothesis hθ(x) = g(θᵀx) = 1 / (1 + e−θᵀx)
1 0 z 0.5 g(z), plotted from computed values
y=0 y=1 Decision boundary: θᵀx = 0

Logistic Regression for Complex Datasets

Modeling a decision function from labeled training data — real data often isn't linearly separable, which calls for a non-linear boundary built from polynomial feature terms.

Linear decision boundary z = θ₀ + θ₁x₁ + θ₂x₂
Non-linear decision boundary (polynomial features) z = θ₀ + θ₁x₁ + θ₂x₂ + θ₃x₁² + θ₄x₁x₂ + θ₅x₂²
x₁ x₂ z = 0 is a straight line
x₁ x₂ z = 0 is an ellipse

Multi-Class Classification — One-Versus-All

  • Instead of y = {0,1}, expand the definition so y = {0,1…n}, where n is the number of classes
  • Choose one class, lump all others into a single second class
  • Repeat this for each class, applying binary logistic regression to each case
  • Use the hypothesis that returns the highest value as the prediction
Train one classifier per class, predict the highest-confidence class hθ(i)(x) = P(y = i | x; θ) for i = 1, 2, 3   →   prediction = maxi hθ(i)(x)
hθ⁽¹⁾(x) hθ⁽²⁾(x) hθ⁽³⁾(x)

One-versus-all: three separate binary classifiers, one per class, each with its own decision boundary

Support Vector Machine — Large Margin Classifier

  • Finds the decision boundary that maximizes the margin between classes, not just any separating line
  • The points closest to the boundary — the support vectors — define that margin
Decision function f(x) = sign(wᵀx + b)
Margin-maximizing objective min (1/2)‖w‖²  s.t.  y⁽ⁱ⁾(wᵀx⁽ⁱ⁾ + b) ≥ 1
Margin — ringed points are the support vectors

K-Nearest Neighbors (k-NN)

A non-parametric, lazy learning algorithm that predicts labels based on the nearest training examples — based on feature similarity, often used as a baseline against SVM or neural network classifiers.

Euclidean distance between the new sample and a training point d(x, x′) = √( Σᵢ₌₁ⁿ (xᵢ − x′ᵢ)² )

Method

  • Specify a positive integer k and a new sample
  • Select the k entries in the database closest to the new sample
  • Find the most common classification among those entries
  • Assign that classification to the new sample

Pros

Simple to implement; no training time required.

Cons

Computationally expensive and memory-intensive; uses training data at test time.

x_new k = 3 2 of 3 nearest neighbors are class ● — new point is classified ●

Unsupervised Learning

Allowing the machine to infer structure from unlabeled data

Clustering

Derives structure from unstructured data by analyzing relationships among its variables.

Example: automatically grouping genetic data into similar groups related by variables such as lifespan, location, and roles.

Non-Clustering

Approaches problems with little or no idea what the results should look like, deriving structure without necessarily knowing the effect of each variable. There's no feedback based on prediction results.

Example: Blind Source Separation, or the "Cocktail Party Problem."

Unlabeled data grouped into structure by similarity

Reinforcement Learning

Teaching software agents to maximize reward

Reinforcement learning differs from supervised learning in that correct input/output pairs need not be presented, and sub-optimal actions need not be explicitly corrected. The focus is on performance — finding a balance between exploration of uncharted territory and exploitation of current knowledge.

The exploration-versus-exploitation trade-off has been most thoroughly studied through the multi-armed bandit problem, and in finite Markov Decision Processes (MDPs). Examples include learning to play games such as Go at a level exceeding human performance, as well as robotics, chemistry, and traffic-signal control in smart cities.

Agent Environment Action Aₜ State Sₜ₊₁, Reward Rₜ₊₁

The agent–environment loop: the agent acts, the environment returns a new state and reward, repeat.

Traffic-signal reinforcement learning: web.eecs.utk.edu/~itamar/Papers/IET_ITS_2010.pdf

Artificial Neural Networks

Modeling a neuron

A neuron is a computational unit that takes input(s), performs some calculation, and produces an output.

Input Axon

Data forward-propagates from neuron to neuron as computations complete in each layer of the network.

Activation Function

The neuron combines inputs with weights (parameters) and applies an activation function — usually sigmoid — to produce an output.

Output Axon — the activation's output propagates to the next layer. If that layer is the output layer, a SoftMax function normalizes it into a probability distribution.

Neuron activation a = g( Σᵢ wᵢxᵢ + b )   where g is the sigmoid, g(z) = 1 / (1 + e−z)
Σ, g x0=1w0j x1w1j x2w2j x3w3j output axon bias unit + weighted inputs → sigmoid → output
Input Hidden 1 Hidden 2 Output

Training a neural network to analyze visual imagery — signal propagates forward from the input layer, through hidden layers, to an output.

Forward propagation — each layer feeds the next a(2) = g(Θ(1)x)    a(3) = g(Θ(2)a(2))    hΘ(x) = a(4) = g(Θ(3)a(3))

Resources

Courses, reading, people, and tools

Stanford Courses

These courses provide great intuition about how machine learning algorithms work.

01
CS229: Machine Learning — Andrew Ng, Ron Dror A broad introduction to machine learning and statistical pattern recognition: supervised, unsupervised, and reinforcement learning, and learning theory. cs229.stanford.edu · lecture videos
02
CS224n: Natural Language Processing with Deep Learning — Chris Manning, Abigail See A thorough introduction to cutting-edge Deep Learning research for NLP, through lectures, assignments, and a final project. web.stanford.edu/class/cs224n · lecture videos
03
CS231n: Convolutional Neural Networks for Visual Recognition — Fei-Fei Li, Justin Johnson, Serena Yeung A deep dive into end-to-end deep learning architectures for computer vision — search, image understanding, mapping, medicine, drones, and self-driving cars. cs231n.stanford.edu · lecture videos

Coursera Courses

01
Machine Learning — Andrew Ng The most effective machine learning techniques, with both theoretical underpinnings and practical implementation. coursera.org/learn/machine-learning
02
Deep Learning Specialization — Andrew Ng, Younes Bensouda Mourri Five courses covering convolutional networks, RNNs, LSTM, Adam, Dropout, BatchNorm, and initialization strategies, applied via case studies in healthcare, autonomous driving, and NLP. coursera.org/specializations/deep-learning
03
AI For Everyone — Andrew Ng A non-technical course on spotting opportunities to apply AI, what today's AI can and can't do, and how AI is impacting society. coursera.org/learn/ai-for-everyone

Reading Material

Must-read books on machine learning:

Deep Learning

Ian Goodfellow

Reinforcement Learning

Richard S. Sutton

Roweis, S. T.; Saul, L. K. (2000). "Nonlinear Dimensionality Reduction by Locally Linear Embedding." Science. 290 (5500): 2323–2326. doi:10.1126/science.290.5500.2323. PMID 11125150.

Definition of "overfitting" at OxfordDictionaries.com (statistics-specific definition).

Bühlmann, Peter; Van De Geer, Sara (2011). "Statistics for High-Dimensional Data." Springer Series in Statistics: 9. doi:10.1007/978-3-642-20192-9. ISBN 978-3-642-20191-2. If p > n, the ordinary least squares estimator is not unique and will heavily overfit the data — a form of complexity regularization becomes necessary.

Notable AI Thought Leaders

Individuals leading research into machine learning.

Andrew Ng

CEO/Founder, Landing AI; Co-Founder, Coursera; Adjunct Professor, Stanford University; formerly Chief Scientist at Baidu and founding lead of Google Brain.

Yoshua Bengio

Department of Computer Science and Operations Research; Canada Research Chair in Statistical Learning Algorithms.

Ian Goodfellow

Best known for Generative Adversarial Networks (GANs) and as lead author of Deep Learning.

Yann LeCun

VP & Chief AI Scientist at Facebook (Meta).

Geoffrey Hinton

English-Canadian cognitive psychologist and computer scientist, most noted for his work on artificial neural networks.

Richard S. Sutton

Professor of Computer Science and iCORE Chair, University of Alberta; a founding father of modern computational reinforcement learning.

Fei-Fei Li

Professor of AI at Stanford; Director of Stanford's AI Lab; former Chief Scientist of AI/ML at Google Cloud; Co-Founder/Chair of AI4ALL.

Development Tools

Tools that lend themselves to modeling machine learning algorithms.

MATLAB

Linear algebra, vectorized data sets, matrix operations.

mathworks.com

Octave

MATLAB-compatible language for modeling ML algorithms.

gnu.org/software/octave

NumPy

High-level math functions supporting multi-dimensional arrays and matrices.

numpy.org

PyTorch

Open-source ML library for applications like NLP.

pytorch.org

SciPy

Python-based ecosystem for math, science, and engineering.

scipy.org

Theano

Library and optimizing compiler for evaluating matrix-valued expressions.

deeplearning.net/theano

Matplotlib

2D plotting library producing publication-quality figures.

matplotlib.org

TensorFlow

Open-source dataflow library for neural networks.

tensorflow.org