GenerativeTopographicMapping.jl

A Julia package for Generative Topographic Mapping
Author john-waczak
Popularity
3 Stars
Updated Last
4 Months Ago
Started In
November 2022

Generative Topographic Mapping

Stable Dev Build Status DOI

A Julia package for Generative Topographic Mapping originally introduced by Bishop and Svensen with inspiration from the UGTM python package. This implementation provides wrappers for use withing the MLJ framework.

Using the package

To train a GTM model first load MLJ and this package.

using MLJ, GenerativeTopographicMapping

The GTM can then be instantiated in the usual way for an unsupervised method:

gtm = GTM()
mach = machine(gtm, df)
fit!(mach)

Calling fitted_params on the trained machine will return a tuple holding the underlying gtm struct if further inspection is desired.

The GTM model learns a transformation from a latent space of $k\times k$ nodes. The result is a set of responsibilities for each latent node. By computing the mean of this distribution for each record, we can use the GTM as a nonlinear dimensionality reduction scheme

means = MLJ.transform(mach, X)

Alternatively, the GTM can be viewed as performing an unsupervised classification into $k\times k$ classes. The class label for each record can be obtained as the index of the node corresponding to the node of the responsibility distribution via

class_label = MLJ.predict(mach, X)

If the full responsibility distribution is desired, you can predict_responsability on the trained machine

R = predict_responsibility(mach, X)

GSM

The GSM (Generative Simplex Mapping) is a riff on the GTM structure designed for unmixing problems. The latent space is chosen to be the $n$-simplex corresponding to $n$ unique sources. Additionally, model weights can optionally be constrained to positive values for source apportionment or spectral unmixing applications. The following MLJ-style syntax can be used to initialize and fit a GSM.

gsm = GSM()
mach = machine(gsm, df)
fit!(mach)