code: def test_singular_array_init_of_non_strict_pd(w0):
      """Tests that when using a custom array init, it returns the
      appropriate warning if it is singular. Also checks if the returned
      inverse matrix is finite. This isn't checked for model fitting as no
      model curently uses this setting.
      """
      rng = np.random.RandomState(42)
      X, y = shuffle(*make_blobs(random_state=rng), random_state=rng)
      P = ortho_group.rvs(X.shape[1], random_state=rng)
      w = np.abs(rng.randn(X.shape[1]))
      w[0] = w0
      M = P.dot(np.diag(w)).dot(P.T)
      msg = (
          "The initialization matrix is not invertible: "
          "using the pseudo-inverse instead."
      )
      with pytest.warns(UserWarning) as raised_warning:
          _, M_inv = _initialize_metric_mahalanobis(
              X,
              init=M,
              random_state=rng,
              return_inverse=True,
              strict_pd=False,
          )
      assert str(raised_warning[0].message) == msg
      assert np.isfinite(M_inv).all()
  
imports: from itertools import product
  import pytest
  import numpy
  from numpy.linalg import LinAlgError
  from numpy.testing import assert_array_almost_equal, assert_allclose, assert_array_equal
  from scipy.spatial.distance import pdist, squareform, mahalanobis
  from scipy.stats import ortho_group
  from sklearn import clone
  from sklearn.cluster import DBSCAN
  from sklearn.datasets import make_spd_matrix, make_blobs
  from sklearn.utils import check_random_state, shuffle
  from sklearn.utils.multiclass import type_of_target
  from metric_learn.sklearn_shims import set_random_state
  from metric_learn._util import make_context, _initialize_metric_mahalanobis
  from metric_learn.sdml import _BaseSDML
  from metric_learn.base_metric import _QuadrupletsClassifierMixin, _TripletsClassifierMixin, _PairsClassifierMixin
  from metric_learn.exceptions import NonPSDError
  from test.test_utils import ids_metric_learners, metric_learners, remove_y, ids_classifiers
label_desc: Use image node_id 22 for calling a global function with example usage: test_singular_array_init_of_non_strict_pd(w0) without return types