code: def test_CCA_PLSCannonical(self, algo):
      n = 500
  
      with tm.RNGContext(1):
          # 2 latents vars:
          l1 = np.random.normal(size=n)
          l2 = np.random.normal(size=n)
  
          latents = np.array([l1, l1, l2, l2]).T
          X = latents + np.random.normal(size=4 * n).reshape((n, 4))
          Y = latents + np.random.normal(size=4 * n).reshape((n, 4))
  
      X_train = X[: n // 2]
      Y_train = Y[: n // 2]
      X_test = X[n // 2 :]
      Y_test = Y[n // 2 :]
  
      train = pdml.ModelFrame(X_train, target=Y_train)
      test = pdml.ModelFrame(X_test, target=Y_test)
  
      # check multi target columns
      self.assertTrue(train.has_target())
      tm.assert_numpy_array_equal(train.data.values, X_train)
      tm.assert_numpy_array_equal(train.target.values, Y_train)
      tm.assert_numpy_array_equal(test.data.values, X_test)
      tm.assert_numpy_array_equal(test.target.values, Y_test)
      expected = pd.MultiIndex.from_tuples(
          [
              (".target", 0),
              (".target", 1),
              (".target", 2),
              (".target", 3),
          ]
      )
      tm.assert_index_equal(train.target_name, expected)
      self.assertEqual(train.data.shape, X_train.shape)
      self.assertEqual(train.target.shape, Y_train.shape)
  
      mod1 = getattr(train.cross_decomposition, algo)(n_components=2)
      mod2 = getattr(cd, algo)(n_components=2)
  
      train.fit(mod1)
      mod2.fit(X_train, Y_train)
  
      # 2nd cols are different on travis-CI
      self.assert_numpy_array_almost_equal(
          mod1.x_weights_[:, 0], mod2.x_weights_[:, 0]
      )
      self.assert_numpy_array_almost_equal(
          mod1.y_weights_[:, 0], mod2.y_weights_[:, 0]
      )
  
      result_tr = train.transform(mod1)
      result_test = test.transform(mod1)
  
      expected_tr = mod2.transform(X_train, Y_train)
      expected_test = mod2.transform(X_test, Y_test)
  
      self.assertIsInstance(result_tr, pdml.ModelFrame)
      self.assertIsInstance(result_test, pdml.ModelFrame)
      self.assert_numpy_array_almost_equal(
          result_tr.data.values[:, 0], expected_tr[0][:, 0]
      )
      self.assert_numpy_array_almost_equal(
          result_tr.target.values[:, 0], expected_tr[1][:, 0]
      )
      self.assert_numpy_array_almost_equal(
          result_test.data.values[:, 0], expected_test[0][:, 0]
      )
      self.assert_numpy_array_almost_equal(
          result_test.target.values[:, 0], expected_test[1][:, 0]
      )
  
file_path: pandas-ml/pandas_ml/skaccessors/test/test_cross_decomposition.py
imports: import pytest
  import numpy
  import pandas
  import sklearn.cross_decomposition
  import pandas_ml
  import pandas_ml.util.testing
label_desc: Use image node_id 3 for calling the TestCrossDecomposition obj's underlying member method code with example usage: obj.test_CCA_PLSCannonical(algo) without return types