code: def test_mpca_against_baseline(gait, baseline_model):
      x = gait["fea3D"].transpose((3, 0, 1, 2))
      baseline_proj_mats = [
          baseline_model["tUs"][i][0]
          for i in range(baseline_model["tUs"].size)
      ]
      baseline_mean = baseline_model["TXmean"]
      mpca = MPCA(var_ratio=0.97)
      x_proj = mpca.fit(x).transform(x)
      testing.assert_allclose(baseline_mean, mpca.mean_)
      baseline_proj_x = multi_mode_dot(
          x - baseline_mean, baseline_proj_mats, modes=[1, 2, 3]
      )
      # check whether the output embeddings is close to the baseline output by keeping the same variance ratio 97%
      testing.assert_allclose(
          x_proj**2, baseline_proj_x**2, rtol=relative_tol
      )
      # testing.assert_equal(x_proj.shape, baseline_proj_x.shape)
  
      for i in range(x.ndim - 1):
          # check whether each eigen-vector column is equal to/opposite of corresponding baseline eigen-vector column
          # testing.assert_allclose(abs(mpca.proj_mats[i]), abs(baseline_proj_mats[i]))
          testing.assert_allclose(
              mpca.proj_mats[i] ** 2,
              baseline_proj_mats[i] ** 2,
              rtol=relative_tol,
          )
  
file_path: pykale/tests/embed/test_factorization.py
imports: import os
  import numpy
  import pytest
  from numpy import testing
  from scipy.io import loadmat
  from sklearn.datasets import make_blobs
  from sklearn.preprocessing import OneHotEncoder
  from tensorly.tenalg import multi_mode_dot
  from kale.embed.factorization import MIDA, MPCA
label_desc: Use image node_id 3 for calling a global function with example usage: test_mpca_against_baseline(gait, baseline_model) without return types