Parametric Models

Data types matter:

  • Numeric — continuous (age, income) or discrete (counts)
    • Regression
  • Categorical — a fixed set of labels (blood type, country)
    • Classification

We have two types of models:

1. Discriminative Models: learn a directly.

  • .e.g logistic regression:
  • classification, segmentation, descriptors

2. Generative Models: learn the joint distribution of the data and target, and use Bayes’ rule

  • Bayes’ Rule:

Go through Bernoulli Distribution before the reading the rest.

What is the probability that you will have to wait exactly 5 minutes for your bus?

zero.

We cannot assign probabilities to values. Instead, we need to assign probabilities to value ranges. Here we reiterate the Probability Density Function.

Remember that PDF’s

  • are non-negative everywhere, integrate to 1
  • can be interpreted as relative probabilities, but not as probabilities.
  • can be larger than 1.

Something very interesting about the next example. The wider red distribution dominates the left extreme because its probability density function has higher variance. The narrow green distribution has a small variance, meaning its probability density drops to near zero very rapidly as you move away from its center. Because the green density decays so quickly on the far left, the wide, slowly decaying tail of the red distribution mathematically overtakes it, making the red class more probable at that extreme.

flow 1
flow 2

Mathematically, the distribution with the larger variance will always decay slower and eventually dominate at both limits

Central Limit Theorem

The sum of a sufficiently large number of independent, identically distributed (i.i.d.) variables with finite variance will have an approximately Gaussian distribution.

So in other words: take any distribution and randomly sample from it. Say if you sample at least 30 times, and you take the sum of those sampled values. Then repeat that process like 1000 times. If you plot the sums of those samples, it will follow a Normal Distribution.

Non-Parametric Models

Histogram Density Estimation

Instead of assuming a single functional representation of the distribution, we can use the training data itself. If we try to evaluate the distribution of data without assuming a parametric form of the density, we can use histograms.

Disadvantages include:

  • The bin positions and widths affect the density estimate
  • The number of bins grows exponentially with the number of dimensions of the data

Kernel Density Estimation

For this reason we introduce Parzen Estimators — a technique that scales better with dimensionality.

  • Consider a kernel function centered on each training data point
    • A common choice is the Gaussian where is the standard deviation of our Gaussian components and controls the smoothness of our estimate
  • If this kernel is non-negative for all and normalised, this gives a valid estimate of the data density.

Both methods require a hyperparameter to control the smoothness of the resulting density estimate. In histograms, this is the bin width . In Gaussian Parzen estimators, this is the kernel’s standard deviation . The final image demonstrates how sensitive the Parzen estimator is to this value

  • A very small standard deviation () produces an extremely jagged, spiky distribution that overfits to individual data points.
  • A very large standard deviation () produces an overly smooth, flat distribution that fails to capture the local peaks of the true underlying function.
  • An intermediate value () provides a balanced density estimate that closely aligns with the actual underlying distribution.
flow 1
flow 2
  • the left image visualizes the joint probabilities, calculated as for three classes. The glowing regions represent the kernel density estimates build directly around the training data.
  • the right image applies Bayes’ Theorem to those kernel estimates to compute the posterior probability, for each class at any given location. These hard boundaries represent the decision regions a classifier would use to categorize a new, unseen data point into the red, blue, or green class based on its coordinates.

For example, The Nadaraya-Watson Model applies the concept of kernel density estimation to solve continuous regression problems, allowing us to predict a target variable  based on an input .

Dual Representation

Many standard linear, parametric models can be mathematically rewritten so that instead of evaluating individual features directly, they evaluate pairs of training data points using a kernel function .

We often apply a fixed mapping  to transform input data  into a new, higher-dimensional feature space to make it easier to classify or analyze. For models based on this mapping, the kernel function is defined mathematically as the scalar (dot) product of two transformed data points:

Also known as Kernel Substitution or Kernel Trick: allows an algorithm to implicitly compute the relationship between data points in a massive, high-dimensional space without ever actually having to calculate the expensive  transformations explicitly.

  • Because if an algorithm is structured so that the input vector  only ever appears inside scalar products, you can simply replace that standard product with a different kernel function.

Expectation

The expectation of a variable (or function of that variable) is the value that the long-term average of the function converges to, as the variable is distributed according to .

The objective is to minimize the probability of making a mistake. As shown in the Figure below, the total probability of a mistake is the sum of two scenarios: classifying a point as when it actually belongs to and vice-versa. Mathematically, this is expressed as integrals over the chosen decision regions:

A decision boundary at an arbitrary point  divides the space into region ​ (everything to the left) and region ​(everything to the right).

If we move the boundary  to the optimal intersection point , the total shaded area (representing total errors) shrinks significantly. The red area disappears, leaving only a green region and a smaller blue region representing the unavoidable minimum overlap.

To minimize the total area of these mistakes, we must ensure that every single data point  is assigned to whichever class has the highest joint probability  at that specific location. Because the marginal probability  is constant across all classes at that location, this is mathematically identical to assigning the point to the class with the largest posterior probability . Therefore, the optimal decision boundary  always occurs exactly where the posterior probability curves cross.

Before going further, read Fundamentals of parameter estimation - Part I.

Maximum Likelihood with Simplifying Assumptions

We often lack data to train a model well by MLE. A standard Gaussian classification model with  classes in  dimensions requires calculating  parameters just for the covariance matrices, which naturally produces a complex, curved decision boundary.

To reduce the number of parameters without losing too much discriminating power, we can apply three levels of simplifying assumptions:

  1. Shared Covariance: Assuming all classes share the identical covariance matrix (​) reduces the parameter count to . Because the distributions now have the exact same shape and orientation, the complex curve straightens into a linear decision boundary.
  1. Diagonal Covariance: Assuming the covariance matrices are diagonal ()) means treating all input dimensions as statistically independent. This reduces the required parameters down to . Visually, the contour ellipses are forced to align strictly with the coordinate axes
  1. Spherical Covariance: The most extreme simplification assumes the covariance is a simple scalar multiple of the identity matrix (). This reduces the parameter count to just . The distributions become perfect circles, meaning the classifier effectively just measures the straight-line distance from a new data point to each class center to make a decision.

Naive Bayes: Because it only computes 1D probabilities and multiplies them, it scales linearly with the number of features, making it computationally fast. It performs surprisingly well in real-world practice, but if the features are actually highly correlated, the model will output overly confident probability scores.

  • conditional independence does not equal marginal independence!

Maximum A Posteriori (MAP) Learning

Earlier, MLE found the parameters that maximized the likelihood of the data. MAP learning flips this: it uses Bayes’ rule to find the most likely parameters (), given the observed data ().

The denominator in Bayes’ rule requires integrating over all possible parameter values, which is often mathematically impossible (intractable) to compute. However, because the denominator is just a normalizing constant, we can completely ignore it when trying to find the maximum value. The optimal parameters are found simply by maximizing the product of the likelihood and the prior .

  • In the left image, with only a handful of data points, the glowing distribution is massive and diffuse, indicating that the model is highly uncertain about the true parameters.
  • In the right image, as the sequence progresses and more data is collected, this posterior distribution rapidly shrinks and concentrates into a tiny, precise point exactly around the true parameter values.
flow 1
flow 2

The primary takeaway is the behavior in the small-data regime. When data is extremely scarce, the standard point estimate (red dashed line) drastically overfits to those few points, outputting a peaked, overly confident distribution that misses the true green curve entirely. The Bayesian prediction (blue line) avoids this false confidence; it remains wide, flat, and cautious because it factors in the massive parameter uncertainty shown on the left. However, once you have abundant data, the parameter uncertainty vanishes, and the Bayesian curve, the point estimate, and the true distribution all safely converge into one.

page 89