class_docstr: Online k-means clustering.
  
  Online k-means clustering seeks to divide a set of data points into
  a specified number of classes, while minimizing intra-class variance.
  It is closely linked to discrete quantization, which computes the closest
  approximation of the empirical distribution of the dataset by a discrete
  distribution supported by a smaller number of points with respect to the
  Wasserstein distance. The algorithm used can either be seen as an online
  version of the k-means algorithm or as Competitive Learning Riemannian
  Quantization (see [LBP2019]_).
  
  Parameters
  ----------
  space : Manifold
      Equipped manifold. At each iteration,
      one of the cluster centers is moved in the direction of the new
      datum, according the exponential map of the underlying space, which
      is a method of metric.
  n_clusters : int
      Number of clusters of the k-means clustering, or number of desired
      atoms of the quantized distribution.
  n_repetitions : int, default=20
      The cluster centers are updated using decreasing step sizes, each
      of which stays constant for n_repetitions iterations to allow a better
      exploration of the data points.
  max_iter : int, default=5e4
      Maximum number of iterations. If it is reached, the
      quantization may be inacurate.
  
  Attributes
  ----------
  cluster_centers_ : array, [n_clusters, n_features]
      Coordinates of cluster centers.
  labels_ :
      Labels of each point.
  
  Notes
  -----
  * Required metric methods: `exp`, `log`, `dist`, `closest_neighbor_index`.
  
  Example
  -------
  >>> from geomstats.geometry.hypersphere import Hypersphere
  >>> from geomstats.learning.onlinekmeans import OnlineKmeans
  >>> sphere = Hypersphere(dim=2)
  >>> metric = sphere.metric
  >>> X = sphere.random_von_mises_fisher(kappa=10, n_samples=50)
  >>> clustering = OnlineKmeans(metric=metric,n_clusters=4).fit(X)
  >>> clustering.cluster_centers_
  >>> clustering.labels_
  
  
  References
  ----------
  .. [LBP2019] A. Le Brigant and S. Puechmorel, Optimal Riemannian
     quantization with an application to air traffic analysis. J. Multivar.
     Anal. 173 (2019), 685 - 703.
docstr: Predict the closest cluster each sample in X belongs to.
  
  Parameters
  ----------
  X : array-like, shape=[n_samples, n_features]
      New data to predict.
  
  Returns
  -------
  labels : int
      Index of the cluster each sample belongs to.
code: def predict(self, X):
      """Predict the closest cluster each sample in X belongs to.
  
      Parameters
      ----------
      X : array-like, shape=[n_samples, n_features]
          New data to predict.
  
      Returns
      -------
      labels : int
          Index of the cluster each sample belongs to.
      """
      if self.cluster_centers_ is None:
          raise Exception("Not fitted")
  
      return self.space.metric.closest_neighbor_index(
          X, self.cluster_centers_
      )
  
file_path: geomstats/geomstats/learning/online_kmeans.py
imports: import logging
  from sklearn.base import BaseEstimator, ClusterMixin
  import geomstats.backend
label_desc: Use image node_id 3 for calling the OnlineKMeans obj's underlying member method code with example usage: obj.predict(X) and returns: self