code: def test_svd_compression_gets_correct_components(
      compression_threshold, normalize_factors
  ):
      """The compressed data can be used to find the components"""
      rng = tl.check_random_state(1234)
      rank = 3
      tol_norm_2 = 1e-2
  
      random_parafac2_tensor = random_parafac2(
          shapes=[(20 + rng.randint(5), 19) for _ in range(10)],
          rank=rank,
          random_state=rng,
          dtype=tl.float64,
      )
  
      slices = parafac2_to_slices(random_parafac2_tensor)
      compressed_slices, loadings = svd_compress_tensor_slices(
          slices, compression_threshold=compression_threshold
      )
      rec_pf2 = parafac2(
          compressed_slices,
          rank,
          random_state=rng,
          normalize_factors=normalize_factors,
          n_iter_max=100,
      )
  
      decompressed_pf2 = svd_decompress_parafac2_tensor(
          rec_pf2, loadings
      )
      rec_slices = parafac2_to_slices(decompressed_pf2)
      for slice, rec_slice in zip(slices, rec_slices):
          slice_error = tl.norm(slice - rec_slice) / tl.norm(slice)
          assert slice_error < tol_norm_2, slice_error
  
file_path: tensorly/tensorly/tests/test_preprocessing.py
imports: import pytest
  from pytest import approx
  import numpy
  import tensorly
  from ..parafac2_tensor import parafac2_to_slices
  from ..random import random_parafac2
  from ..testing import assert_allclose
  from ..decomposition._parafac2 import parafac2, _parafac2_reconstruction_error
  from ..preprocessing import svd_compress_tensor_slices, svd_decompress_parafac2_tensor
label_desc: Use image node_id 1 for calling a global function with example usage: test_svd_compression_gets_correct_components(compression_threshold, normalize_factors) without return types