# On PyTorch Implementation of Density Estimators for von Mises-Fisher and Its Mixture

arXiv: https://arxiv.org/abs/2102.05340 · HTML: https://mlsanity.com/paper/2102.05340/

## Key facts

- Cited by 6 papers in the map (data through 14 Oct 2026).
- Builds on 3 of its 13 references that are in the map.
- First posted on arXiv 10 Feb 2021.

## Builds on (most cited first, 3 of 3)

- [Adam: A Method for Stochastic Optimization](https://mlsanity.com/paper/1412.6980/) (2014)
- [Hyperspherical Variational Auto-Encoders](https://mlsanity.com/paper/1804.00891/) (2018)
- [Optimized Cartesian K-Means](https://mlsanity.com/paper/1405.4054/) (2014)

## Built on by (most cited first, 6 of 6)

- [A Non-isotropic Probabilistic Take on Proxy-based Deep Metric Learning](https://mlsanity.com/paper/2207.03784/) (2022)
- [Mitigating Gender Bias in Face Recognition Using the von Mises-Fisher Mixture Model](https://mlsanity.com/paper/2210.13664/) (2022)
- [Assessing Uncertainty in Similarity Scoring: Performance & Fairness in Face Recognition](https://mlsanity.com/paper/2211.07245/) (2022)
- [A General Framework for Visualizing Embedding Spaces of Neural Survival Analysis Models Based on Angular Information](https://mlsanity.com/paper/2305.06862/) (2023)
- [A solution for the mean parametrization of the von Mises-Fisher distribution](https://mlsanity.com/paper/2404.07358/) (2024)
- [Learning Holographic Reduced Representations with Clifford Variational Autoencoders](https://mlsanity.com/paper/2609.28409/) (2026)

## Abstract (arXiv)

The von Mises-Fisher (vMF) is a well-known density model for directional random variables. The recent surge of the deep embedding methodologies for high-dimensional structured data such as images or texts, aimed at extracting salient directional information, can make the vMF model even more popular. In this article, we will review the vMF model and its mixture, provide detailed recipes of how to train the models, focusing on the maximum likelihood estimators, in Python/PyTorch. In particular, implementation of vMF typically suffers from the notorious numerical issue of the Bessel function evaluation in the density normalizer, especially when the dimensionality is high, and we address the issue using the MPMath library that supports arbitrary precision. For the mixture learning, we provide both minibatch-based large-scale SGD learning, as well as the EM algorithm which is a full batch estimator. For each estimator/methodology, we test our implementation on some synthetic data, while we also demonstrate the use case in a more realistic scenario of image clustering. Our code is publicly available in https://github.com/minyoungkim21/vmf-lib.
