Clustering, density estimation, and anomaly detection · Mixture and density models · UCL045 · Model
von Mises–Fisher mixture
Model clusters of unit-length directional observations, such as normalized embeddings or orientation measurements, with a probabilistic counterpart to spherical clustering.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- Count and direction mixtures Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through discover.mixture. The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Model clusters of unit-length directional observations, such as normalized embeddings or orientation measurements, with a probabilistic counterpart to spherical clustering.
Question / hypotheses
Which probability model adequately explains the reference distribution and its latent heterogeneity? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
A mixture of rotationally symmetric sphere densities.
Assumptions
Unit normalization must be justified; vector magnitudes are discarded. The distribution is rotationally symmetric around each mean direction, so anisotropic directional clusters may fit poorly. Zero vectors cannot be normalized.
Formula / computational definition
On the unit sphere in dimensions, , where , concentration , and is the normalizing constant involving a modified Bessel function. Responsibilities combine directional alignment, concentration, and mixture weight.
Parameters and notation
Learned or fitted quantities: Mixture weights, unit mean directions, and concentration parameters. User-set hyperparameters/design choices: Choose component count, shared or unequal concentrations, and stable numerical methods for Bessel ratios. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Refit likelihood or posterior parameters on the new reference population; neural fine-tuning does not apply to this classical model. Warm starts can reduce computation but should be compared with fresh initialization. Recheck predictive fit and regularization after a domain shift.
How to use and calibrate
Inspect angular residuals, posterior assignments, concentration estimates, held-out log density, and sensitivity to normalization. Compare with spherical K-means when probabilistic uncertainty is unnecessary.
Example application
Cluster directional movement or unit-normalized feature vectors probabilistically. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.
Interpretation / pitfalls
Watch out
The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.
Python and R code examples
R movMF provides mixture fitting. Python can bridge to it or implement EM with careful directional-statistics numerics. The paired component evaluates unnormalized directional log weights; it deliberately omits the Bessel normalizer and is not a complete likelihood calculation.
Component: vMF directional log weights without normalization constants. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — vMF directional log weights without normalization constants. · needs numpy
import numpy as np
x=np.array([.8,.6]); mu=np.eye(2); kappa=np.array([2.,4.]); pi=np.array([.5,.5])
result=np.log(pi)+kappa*(mu@x)
print(result)
Component demo, not a trained model — vMF directional log weights without normalization constants.
x=c(.8,.6); mu=diag(2); kappa=c(2,4); pi=c(.5,.5)
result=log(pi)+kappa*as.vector(mu%*%x)
print(result)
Sources
- Source 1cran.r-project.org
From the CodeSplash reference, entry UCL045.