code: def smacof_mds(C, dim, max_iter=3000, eps=1e-9):
      
  
      rng = np.random.RandomState(seed=3)
  
      mds = manifold.MDS(
          dim,
          max_iter=max_iter,
          eps=1e-9,
          dissimilarity='precomputed',
          n_init=1)
      pos = mds.fit(C).embedding_
  
      nmds = manifold.MDS(
          2,
          max_iter=max_iter,
          eps=1e-9,
          dissimilarity="precomputed",
          random_state=rng,
          n_init=1)
      npos = nmds.fit_transform(C, init=pos)
  
      return npos
docs: Returns an interpolated point cloud following the dissimilarity matrix C
      using SMACOF multidimensional scaling (MDS) in specific dimensionned
      target space
  
      Parameters
      ----------
      C : ndarray, shape (ns, ns)
          dissimilarity matrix
      dim : int
            dimension of the targeted space
      max_iter :  int
          Maximum number of iterations of the SMACOF algorithm for a single run
      eps : float
          relative tolerance w.r.t stress to declare converge
  
      Returns
      -------
      npos : ndarray, shape (R, dim)
             Embedded coordinates of the interpolated point cloud (defined with
             one isometry)