code: def test_silhouette_samples_precomputed_sparse(sparse_container):
      """Check that silhouette_samples works for sparse matrices correctly."""
      X = np.array(
          [[0.2, 0.1, 0.1, 0.2, 0.1, 1.6, 0.2, 0.1]], dtype=np.float32
      ).T
      y = [0, 0, 0, 0, 1, 1, 1, 1]
      pdist_dense = pairwise_distances(X)
      pdist_sparse = sparse_container(pdist_dense)
      assert issparse(pdist_sparse)
      output_with_sparse_input = silhouette_samples(
          pdist_sparse, y, metric="precomputed"
      )
      output_with_dense_input = silhouette_samples(
          pdist_dense, y, metric="precomputed"
      )
      assert_allclose(output_with_sparse_input, output_with_dense_input)
  
imports: import warnings
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.sparse import issparse
  from sklearn import datasets
  from sklearn.metrics import pairwise_distances
  from sklearn.metrics.cluster import calinski_harabasz_score, davies_bouldin_score, silhouette_samples, silhouette_score
  from sklearn.metrics.cluster._unsupervised import _silhouette_reduce
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS, DOK_CONTAINERS, LIL_CONTAINERS
label_desc: Use image node_id 8 for calling a global function with example usage: test_silhouette_samples_precomputed_sparse(sparse_container) without return types