code: def _smacof_single(
      dissimilarities,
      metric=True,
      n_components=2,
      init=None,
      max_iter=300,
      verbose=0,
      eps=1e-3,
      random_state=None,
      normalized_stress=False,
  ):
      """Computes multidimensional scaling using SMACOF algorithm.
  
      Parameters
      ----------
      dissimilarities : ndarray of shape (n_samples, n_samples)
          Pairwise dissimilarities between the points. Must be symmetric.
  
      metric : bool, default=True
          Compute metric or nonmetric SMACOF algorithm.
          When ``False`` (i.e. non-metric MDS), dissimilarities with 0 are considered as
          missing values.
  
      n_components : int, default=2
          Number of dimensions in which to immerse the dissimilarities. If an
          ``init`` array is provided, this option is overridden and the shape of
          ``init`` is used to determine the dimensionality of the embedding
          space.
  
      init : ndarray of shape (n_samples, n_components), default=None
          Starting configuration of the embedding to initialize the algorithm. By
          default, the algorithm is initialized with a randomly chosen array.
  
      max_iter : int, default=300
          Maximum number of iterations of the SMACOF algorithm for a single run.
  
      verbose : int, default=0
          Level of verbosity.
  
      eps : float, default=1e-3
          Relative tolerance with respect to stress at which to declare
          convergence. The value of `eps` should be tuned separately depending
          on whether or not `normalized_stress` is being used.
  
      random_state : int, RandomState instance or None, default=None
          Determines the random number generator used to initialize the centers.
          Pass an int for reproducible results across multiple function calls.
          See :term:`Glossary <random_state>`.
  
      normalized_stress : bool, default=False
          Whether use and return normed stress value (Stress-1) instead of raw
          stress calculated by default. Only supported in non-metric MDS. The
          caller must ensure that if `normalized_stress=True` then `metric=False`
  
          .. versionadded:: 1.2
  
      Returns
      -------
      X : ndarray of shape (n_samples, n_components)
          Coordinates of the points in a ``n_components``-space.
  
      stress : float
          The final value of the stress (sum of squared distance of the
          disparities and the distances for all constrained points).
          If `normalized_stress=True`, and `metric=False` returns Stress-1.
          A value of 0 indicates "perfect" fit, 0.025 excellent, 0.05 good,
          0.1 fair, and 0.2 poor [1]_.
  
      n_iter : int
          The number of iterations corresponding to the best stress.
  
      References
      ----------
      .. [1] "Nonmetric multidimensional scaling: a numerical method" Kruskal, J.
             Psychometrika, 29 (1964)
  
      .. [2] "Multidimensional scaling by optimizing goodness of fit to a nonmetric
             hypothesis" Kruskal, J. Psychometrika, 29, (1964)
  
      .. [3] "Modern Multidimensional Scaling - Theory and Applications" Borg, I.;
             Groenen P. Springer Series in Statistics (1997)
      """
      dissimilarities = check_symmetric(
          dissimilarities, raise_exception=True
      )
  
      n_samples = dissimilarities.shape[0]
      random_state = check_random_state(random_state)
  
      sim_flat = ((1 - np.tri(n_samples)) * dissimilarities).ravel()
      sim_flat_w = sim_flat[sim_flat != 0]
      if init is None:
          # Randomly choose initial configuration
          X = random_state.uniform(size=n_samples * n_components)
          X = X.reshape((n_samples, n_components))
      else:
          # overrides the parameter p
          n_components = init.shape[1]
          if n_samples != init.shape[0]:
              raise ValueError(
                  "init matrix should be of shape (%d, %d)"
                  % (n_samples, n_components)
              )
          X = init
  
      old_stress = None
      ir = IsotonicRegression()
      for it in range(max_iter):
          # Compute distance and monotonic regression
          dis = euclidean_distances(X)
  
          if metric:
              disparities = dissimilarities
          else:
              dis_flat = dis.ravel()
              # dissimilarities with 0 are considered as missing values
              dis_flat_w = dis_flat[sim_flat != 0]
  
              # Compute the disparities using a monotonic regression
              disparities_flat = ir.fit_transform(
                  sim_flat_w, dis_flat_w
              )
              disparities = dis_flat.copy()
              disparities[sim_flat != 0] = disparities_flat
              disparities = disparities.reshape((n_samples, n_samples))
              disparities *= np.sqrt(
                  (n_samples * (n_samples - 1) / 2)
                  / (disparities**2).sum()
              )
  
          # Compute stress
          stress = ((dis.ravel() - disparities.ravel()) ** 2).sum() / 2
          if normalized_stress:
              stress = np.sqrt(
                  stress / ((disparities.ravel() ** 2).sum() / 2)
              )
          # Update X using the Guttman transform
          dis[dis == 0] = 1e-5
          ratio = disparities / dis
          B = -ratio
          B[np.arange(len(B)), np.arange(len(B))] += ratio.sum(axis=1)
          X = 1.0 / n_samples * np.dot(B, X)
  
          dis = np.sqrt((X**2).sum(axis=1)).sum()
          if verbose >= 2:
              print("it: %d, stress %s" % (it, stress))
          if old_stress is not None:
              if (old_stress - stress / dis) < eps:
                  if verbose:
                      print(
                          "breaking at iteration %d with stress %s"
                          % (it, stress)
                      )
                  break
          old_stress = stress / dis
  
      return X, stress, it + 1
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/manifold/_mds.py
imports: import warnings
  from numbers import Integral, Real
  import numpy
  from joblib import effective_n_jobs
  from ..base import BaseEstimator, _fit_context
  from ..isotonic import IsotonicRegression
  from ..metrics import euclidean_distances
  from ..utils import check_array, check_random_state, check_symmetric
  from ..utils._param_validation import Hidden, Interval, StrOptions
  from ..utils.parallel import Parallel, delayed
label_desc: Use image node_id 1 for calling a global function with example usage: _smacof_single(dissimilarities, metric, n_components, init, max_iter, verbose, eps, random_state, normalized_stress) and returns: X,  stress,  unknown