Interactive demo · Foundations of Deep Learning · Chapter 3

Periodic variables: the circular mean and the von Mises distribution

Angles live on a circle, so the ordinary average of their numerical values depends on where you put the zero. Treat each angle as a unit vector instead, average the vectors, and read off the direction θ̄ and length r̄ of the result: these do not depend on the origin, and they are exactly the maximum likelihood estimates of the von Mises distribution p(θ) ∝ exp{m cos(θ − θ₀)}, with m found from A(m) = r̄.

Mode

Try these

Samples use a seeded generator and the Best and Fisher (1979) rejection sampler, the same numbers as the Python code; the Bessel functions are computed by the trapezoidal rule, which is exact to rounding for periodic integrands like (3.130).

In the lecture notes