code: def test_lda_score_perplexity(csr_container):
      # Test the relationship between LDA score and perplexity
      n_components, X = _build_sparse_array(csr_container)
      lda = LatentDirichletAllocation(
          n_components=n_components, max_iter=10, random_state=0
      )
      lda.fit(X)
      perplexity_1 = lda.perplexity(X, sub_sampling=False)
  
      score = lda.score(X)
      perplexity_2 = np.exp(-1.0 * (score / np.sum(X.data)))
      assert_almost_equal(perplexity_1, perplexity_2)
  
imports: import sys
  from io import StringIO
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from scipy.linalg import block_diag
  from scipy.special import psi
  from sklearn.decomposition import LatentDirichletAllocation
  from sklearn.decomposition._online_lda_fast import _dirichlet_expectation_1d, _dirichlet_expectation_2d
  from sklearn.exceptions import NotFittedError
  from sklearn.utils._testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, if_safe_multiprocessing_with_blas
  from sklearn.utils.fixes import CSR_CONTAINERS
label_desc: Use image node_id 17 for calling a global function with example usage: test_lda_score_perplexity(csr_container) without return types