code: def test_deterministic_initialization(estimator, build_dataset):
      """Test that estimators that have a prior or an init are deterministic
      when it is set to to random and when the random_state is fixed."""
      input_data, labels, _, X = build_dataset()
      model = clone(estimator)
      if hasattr(estimator, "init"):
          model.set_params(init="random")
      if hasattr(estimator, "prior"):
          model.set_params(prior="random")
      model1 = clone(model)
      set_random_state(model1, 42)
      model1 = model1.fit(*remove_y(model, input_data, labels))
      model2 = clone(model)
      set_random_state(model2, 42)
      model2 = model2.fit(*remove_y(model, input_data, labels))
      np.testing.assert_allclose(
          model1.get_mahalanobis_matrix(),
          model2.get_mahalanobis_matrix(),
      )
  
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 23 for calling a global function with example usage: test_deterministic_initialization(estimator, build_dataset) without return types