code: def modulation_factor(n_samples, theta, dim, n_expectation=1000):
      """Modulation factor on the convergence of the empirical Fréchet mean.
  
      The modulation factor is the ratio of the variance of the empirical
      Fréchet mean on the manifold to the variance in a Euclidean space,
      for n_sampless drawn from an isotropic distributions on a Riemannian
      hyper sub-sphere of radius 0 < theta < Pi around the north pole of the
      sphere of dimension dim.
  
      Parameters
      ----------
      n_samples : int
          Number of samples to draw.
      theta : float
          Radius of the bubble distribution.
      dim : int
          Dimension of the sphere (embedded in R^{dim+1}).
      n_expectation: int, optional (defaults to 1000)
          Number of computations for approximating the expectation.
  
      Returns
      -------
      tuple (modulation factor, std-dev on the modulation factor)
      """
      (var, std_var) = empirical_frechet_var_bubble(
          n_samples, theta, dim, n_expectation=n_expectation
      )
      return (
          var * n_samples / theta**2,
          std_var * n_samples / theta**2,
      )
  
file_path: geomstats/examples/empirical_frechet_mean_uncertainty_sn.py
imports: import logging
  import matplotlib.pyplot
  import geomstats.backend
  from geomstats.geometry.hypersphere import Hypersphere
  from geomstats.learning.frechet_mean import FrechetMean
label_desc: Use image node_id 2 for calling a global function with example usage: modulation_factor(n_samples, theta, dim, n_expectation) and returns: unknown,  unknown