liveBook · Manning

Mixture density network

As explained in Machine Learning Algorithms in Depth

A mixture density network is a neural network that predicts the parameters of a conditional mixture probability distribution.

A mixture density network (MDN) uses a neural network to predict the parameters of a conditional mixture probability distribution. In a Gaussian MDN, an MLP maps observations x to component means μk, variances σk, and mixture proportions πk, defining a Gaussian mixture model conditioned on x. section 11.2.1

Construct the model by enforcing valid distribution parameters and optimizing likelihood:

  • Represent the conditional density with K Gaussian components whose parameters are produced by the neural network. section 11.2.1
  • Use exponential activations for strictly positive variances and softmax activations for mixture weights that sum to one. section 11.2.1
  • Train the multi-output network by maximizing log likelihood, equivalently minimizing negative log likelihood. section 11.2.1
  • For isotropic covariance, express each multivariate Gaussian as a product across dimensions, simplifying the density calculation. section 11.2.1

Gaussian MDN implementation

Generate synthetic samples from a multivariate distribution with known means and covariances. Define the constrained multi-output architecture, compute negative log likelihood, train with Keras/TensorFlow, and inspect cluster centroids alongside training and validation loss. section 11.2.1

Figure 11.7 A multioutput neural network used to learn Gaussian parameters
figure

Use the architecture diagram to trace how one neural network produces the Gaussian mixture parameters. section 11.2.1

How Machine Learning Algorithms in Depth covers it

How deep it goes
Derives Gaussian density constraints and likelihood training, then implements an isotropic-covariance model without extending beyond that covariance assumption.
Examples
Uses synthetic multivariate data, constrained multi-output predictions, cluster centroids, and training-validation loss plots.
What you can do after
Build a Gaussian MDN with Keras/TensorFlow, train it using negative log likelihood, and inspect its mixture predictions.
How it connects
Connects amortized variational inference, multilayer perceptrons, Gaussian mixture models, and negative log likelihood.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Algorithms in Depth. The section links point to the parts of the book it draws on.