Mixture Guide#
A Mixture object is a linear combination of Component objects that describes a complex distribution. The Mixture object state describes the distribution in terms of the Component
objects (which have their own paramters) and a list of weights that describe the relative
importance of each Component. Using the Expectation-Maximization algorithm, a Mixture object can fit itself to an input data array of shape (n_samples, n_features) where a “sample” is a single star (or can be treated as such, e.g. a combined binary) and a feature is any data we’re trying to fit to (position, velocity, magnitude, apparent-magnitude, abundances, inferred-age, etc.). The Mixture object will remain completely agnostic of the features being fit. The implementation of how features are fit to is left to the BaseComponent class.
See Fitting a Mixture for an example script and
Fitting a mixture for instructions on how to use the command line
tool fit-mixture.
Implemented Mixtures#
ComponentMixture#
Chronostar’s sole implemented Mixture Model matches the interface of scikit-learn’s mixture models as closely as possible, inheriting from sklearn.mixture.BaseMixture. For reference of a class that inherits from BaseMixture, see sklearn.mixture.GaussianMixture.
The key method of the ComponentMixture is its fit() method.
In this instance, it calls fit() which is a scikit-learn
method.
This performs the Expectation-Maximization algorithm which we explain briefly here.
The Expectation-Maximization (EM) algorithm consists of two steps which are
executed iteratively until convergence is reached. Underlying this algorithm is
the assumption that each data point as a true membership to one of the components,
or equivalently, for each data point, there is one component that is responsible
for it. The E-step’s purpose is to estimate these membership probabilities as a value between 0 and 1. This is done by, for each data point, calculating the
probability that it was generated by each component’s distribution (i.e. evaluate
each Component’s PDF at the position of the data point) and then normalizing these
probabilities such that they sum to 1. The E-step is implemented by
scikit-learn’s base Class
which calls the abstract method _estimate_log_prob which is defined
in SKLComponentMixture.
Eqiupped with membership probabilites, the M-step can maximize the parameters
of each Component in isolation. Since each Component has its own defined
maximize() method, the M-step implementation
loops over the mixture’s components, maximizing them one by one.