code: def _mini_batch_step(
      X,
      x_squared_norms,
      centers,
      counts,
      old_center_buffer,
      compute_squared_diff,
      distances,
      random_reassign=False,
      random_state=None,
      reassignment_ratio=0.01,
      verbose=False,
  ):
      """Incremental update of the centers for the Minibatch K-Means algorithm.
  
      Parameters
      ----------
  
      X : array, shape (n_samples, n_features)
          The original data array.
  
      x_squared_norms : array, shape (n_samples,)
          Squared euclidean norm of each data point.
  
      centers : array, shape (k, n_features)
          The cluster centers. This array is MODIFIED IN PLACE
  
      counts : array, shape (k,)
           The vector in which we keep track of the numbers of elements in a
           cluster. This array is MODIFIED IN PLACE
  
      distances : array, dtype float, shape (n_samples), optional
          If not None, should be a pre-allocated array that will be used to store
          the distances of each sample to its closest center.
          May not be None when random_reassign is True.
  
      random_state : integer or numpy.RandomState, optional
          The generator used to initialize the centers. If an integer is
          given, it fixes the seed. Defaults to the global numpy random
          number generator.
  
      random_reassign : boolean, optional
          If True, centers with very low counts are randomly reassigned
          to observations.
  
      reassignment_ratio : float, optional
          Control the fraction of the maximum number of counts for a
          center to be reassigned. A higher value means that low count
          centers are more likely to be reassigned, which means that the
          model will take longer to converge, but should converge in a
          better clustering.
  
      verbose : bool, optional, default False
          Controls the verbosity.
  
      compute_squared_diff : bool
          If set to False, the squared diff computation is skipped.
  
      old_center_buffer : int
          Copy of old centers for monitoring convergence.
  
      Returns
      -------
      inertia : float
          Sum of distances of samples to their closest cluster center.
  
      squared_diff : numpy array, shape (n_clusters,)
          Squared distances between previous and updated cluster centers.
  
      """
      # Perform label assignment to nearest centers
      nearest_center, inertia = _labels_inertia(
          X, x_squared_norms, centers, distances=distances
      )
  
      if random_reassign and reassignment_ratio > 0:
          random_state = check_random_state(random_state)
          # Reassign clusters that have very low counts
          to_reassign = counts < reassignment_ratio * counts.max()
          # pick at most .5 * batch_size samples as new centers
          if to_reassign.sum() > 0.5 * X.shape[0]:
              indices_dont_reassign = np.argsort(counts)[
                  int(0.5 * X.shape[0]) :
              ]
              to_reassign[indices_dont_reassign] = False
          n_reassigns = to_reassign.sum()
          if n_reassigns:
              # Pick new clusters amongst observations with uniform probability
              new_centers = choice(
                  X.shape[0],
                  replace=False,
                  size=n_reassigns,
                  random_state=random_state,
              )
              if verbose:
                  print(
                      "[MiniBatchKMeans] Reassigning %i cluster centers."
                      % n_reassigns
                  )
  
              if sp.issparse(X) and not sp.issparse(centers):
                  assign_rows_csr(
                      X,
                      astype(new_centers, np.intp),
                      astype(np.where(to_reassign)[0], np.intp),
                      centers,
                  )
              else:
                  centers[to_reassign] = X[new_centers]
          # reset counts of reassigned centers, but don't reset them too small
          # to avoid instant reassignment. This is a pretty dirty hack as it
          # also modifies the learning rates.
          counts[to_reassign] = np.min(counts[~to_reassign])
  
      # implementation for the sparse CSR representation completely written in
      # cython
      if sp.issparse(X):
          return inertia, _k_means._mini_batch_update_csr(
              X,
              x_squared_norms,
              centers,
              counts,
              nearest_center,
              old_center_buffer,
              compute_squared_diff,
          )
  
      # dense variant in mostly numpy (not as memory efficient though)
      k = centers.shape[0]
      squared_diff = 0.0
      for center_idx in range(k):
          # find points from minibatch that are assigned to this center
          center_mask = nearest_center == center_idx
          count = center_mask.sum()
  
          if count > 0:
              if compute_squared_diff:
                  old_center_buffer[:] = centers[center_idx]
  
              # inplace remove previous count scaling
              centers[center_idx] *= counts[center_idx]
  
              # inplace sum with new points members of this cluster
              centers[center_idx] += np.sum(X[center_mask], axis=0)
  
              # update the count statistics for this center
              counts[center_idx] += count
  
              # inplace rescale to compute mean of all points (old and new)
              # Note: numpy >= 1.10 does not support '/=' for the following
              # expression for a mixture of int and float (see numpy issue #6464)
              centers[center_idx] = (
                  centers[center_idx] / counts[center_idx]
              )
  
              # update the squared diff if necessary
              if compute_squared_diff:
                  diff = (
                      centers[center_idx].ravel()
                      - old_center_buffer.ravel()
                  )
                  squared_diff += np.dot(diff, diff)
  
      return inertia, squared_diff
  
imports: import warnings
  import numpy
  import scipy.sparse
  from ..base import BaseEstimator, ClusterMixin, TransformerMixin
  from ..metrics.pairwise import euclidean_distances
  from ..metrics.pairwise import pairwise_distances_argmin_min
  from ..utils.extmath import row_norms, squared_norm
  from ..utils.sparsefuncs_fast import assign_rows_csr
  from ..utils.sparsefuncs import mean_variance_axis
  from ..utils.fixes import astype
  from ..utils import check_array
  from ..utils import check_random_state
  from ..utils import as_float_array
  from ..utils import gen_batches
  from ..utils.validation import check_is_fitted
  from ..utils.validation import FLOAT_DTYPES
  from ..utils.random import choice
  from ..externals.joblib import Parallel
  from ..externals.joblib import delayed
  from ..externals.six import string_types
  from .None import _k_means
  from ._k_means_elkan import k_means_elkan
label_desc: Use image node_id 10 for calling a global function with example usage: _mini_batch_step(X, x_squared_norms, centers, counts, old_center_buffer, compute_squared_diff, distances, random_reassign, random_state, reassignment_ratio, verbose) and returns: inertia,  squared_diff, inertia,  _k_means