code: def test_increasing_variance_random():
      """Tests that for random X and Y, the R^2s are increasing"""
      X = tl.tensor(np.random.rand(20, 8, 6, 4))
      Y = tl.tensor(np.random.rand(20, 7))
      R2s = []
      for r in range(1, 12):
          tpls = CP_PLSR(r)
          tpls.fit(X, Y)
          R2s.append(tpls.score(X, Y))
  
      assert np.all(np.array(R2s) >= 0.0)
      assert np.all(np.diff(R2s) >= 0.0)
  
imports: import numpy
  import pytest
  import tensorly
  from ...testing import assert_allclose
  from ...cp_tensor import CPTensor, cp_normalize, cp_to_tensor
  from ...metrics.factors import congruence_coefficient
  from ...random import random_cp
  from ..cp_plsr import CP_PLSR
label_desc: Use image node_id 13 for calling a global function with example usage: test_increasing_variance_random() without return types