animate_with_great_circle_of_unitsphere

probnumeval.visual.animate_with_great_circle_of_unitsphere(d, num_frames, initial_sample=None, initial_direction=None, endpoint=False)[source]

Animate samples from a standard Normal distribution by drawing a great circle on a unitsphere uniformly at random.

Based on the MATLAB implementation in 1.

This can be used to “make a sample from a GP move around in the sample space”. In this case, d is the number of time-grid points (which amounts to the dimension of the underlying multivariate Normal distribution), and num_steps is the number of frames that shall be shown in the animation.

Parameters
  • d – Dimension of the sphere. This can be thought of as the dimension of the underlying multivariate Normal distribution of which samples shall be animated.

  • num_frames – Number of steps to be taken. This can be thought of the number of frames in the final animation.

  • initial_sampleShape (d,). Initial sample on the sphere. Will be normalized to length 1 internally. Optional. If not provided, sampled from a standard Normal distribution.

  • initial_directionShape (d,). Initial direction on the tangent space of the initial sample. Will be orthonormalized internally. Optional. If not provided, sampled from a standard Normal distribution.

  • endpoint – Whether the final state should be equal to the first state. Optional. Default is False.

Returns

Shape (num_steps, d). N steps that traverse the sphere along a (d-1)-dimensional subspace.

Return type

np.ndarray

References

1

Philipp Hennig. Animating Samples from Gaussian Distributions. Technical Report No. 8 of the Max Planck Institute for Intelligent Systems. September 2013

Examples

>>> import numpy as np
>>> np.random.seed(42)
>>> dim, num_frames = 2, 10
>>> states = animate_with_random_great_circle_of_unitsphere(dim, num_frames)
>>> print(np.round(states, 1))
[[ 0.5 -0.1]
 [ 0.5  0.2]
 [ 0.3  0.4]
 [-0.   0.5]
 [-0.3  0.4]
 [-0.5  0.1]
 [-0.5 -0.2]
 [-0.3 -0.4]
 [ 0.  -0.5]
 [ 0.3 -0.4]]