code: def reconstructed_variance(tFac, tIn=None):
      """This function calculates the amount of variance captured (R2X) by the tensor method."""
      tMask = np.isfinite(tIn)
      vTop = np.sum(
          np.square(tl.cp_to_tensor(tFac) * tMask - np.nan_to_num(tIn))
      )
      vBottom = np.sum(np.square(np.nan_to_num(tIn)))
      return 1.0 - vTop / vBottom
  
imports: import numpy
  import tensorly
  from tensorly.decomposition import parafac
  from tensorly.datasets.data_imports import load_covid19_serology
  from matplotlib import pyplot
  from matplotlib.cm import ScalarMappable
label_desc: Use image node_id 1 for calling a global function with example usage: reconstructed_variance(tFac, tIn) and returns: unknown