code: def _loss(Q, X, Y, weights, metric="euclid"):
      """Loss function for estimating the rotation matrix in RPA."""
  
      return weights @ distance(X, Q @ Y @ Q.T, metric=metric)
  
file_path: pyRiemann/pyriemann/transfer/_rotate.py
imports: import warnings
  import numpy
  from ..utils.distance import distance
  from ..utils.utils import check_weights
label_desc: Use image node_id 3 for calling a global function with example usage: _loss(Q, X, Y, weights, metric) and returns: unknown