code: def get_test_err(
      htfa,
      test_weight_data,
      test_recon_data,
      test_weight_R,
      test_recon_R,
      centers,
      widths,
  ):
      """Calcuate test error
  
      Parameters
      ----------
  
      htfa : HTFA
          An instance of HTFA, factor anaysis class in BrainIAK.
  
      test_weigth_data : 2D array
          Data used for testing weights.
  
      test_recon_data : 2D array
          Data used for testing reconstruction error.
  
      test_weigth_R : 2D array
          Coordinate matrix used for testing weights.
  
      test_recon_R : 2D array
          Coordinate matrix used for testing reconstruction error.
  
      centers : 2D array
          Center matrix of HTFA factors.
  
      widths : 1D array
          Width matrix of HTFA factors.
  
      Returns
      -------
      float
          Returns root mean squared error on test.
  
      """
  
      # calculate F on test_weight_R, based on trained centers/widths
      unique_R, inds = htfa.get_unique_R(test_weight_R)
      F = htfa.get_factors(unique_R, inds, centers, widths)
      # calculate weights on test_weight_data
      W = htfa.get_weights(test_weight_data, F)
  
      # calculate F on final test_recon_data
      unique_R, inds = htfa.get_unique_R(test_recon_R)
      F = htfa.get_factors(unique_R, inds, centers, widths)
      return recon_err(test_recon_data, F, W)
  
file_path: brainiak/examples/factoranalysis/htfa_cv_example.py
imports: import os
  import sys
  import math
  import requests
  import scipy.io
  import numpy
  from mpi4py import MPI
  from subprocess import call
  from scipy.stats import stats
  from sklearn import model_selection
  from sklearn.metrics import mean_squared_error
label_desc: Use image node_id 3 for calling a global function with example usage: get_test_err(htfa, test_weight_data, test_recon_data, test_weight_R, test_recon_R, centers, widths) and returns: recon_err