docstr: Compute the outlier score.
  
  Centers the data and projects it onto the principal components. The score is then the sum of the
  squared projections.
  
  Parameters
  ----------
  x
      The test data.
  
  Returns
  -------
  The outlier score.
docstr_tok: ["Compute","the","outlier","score",".","Centers","the","data","and","projects","it","onto","the","principal","components",".","The","score","is","then","the","sum","of","the","squared","projections",".","Parameters","--","--","--","--","--","x","The","test","data",".","Returns","--","--","--","-","The","outlier","score","."]
code: def _score(self, x: torch.Tensor) -> torch.Tensor:
      """Compute the outlier score.
  
      Centers the data and projects it onto the principal components. The score is then the sum of the
      squared projections.
  
      Parameters
      ----------
      x
          The test data.
  
      Returns
      -------
      The outlier score.
      """
      k_xr = self.kernel(x, self.x_ref)
      k_xr_row_sums = k_xr.sum(1)
      n, m = k_xr.shape
      k_xr_cen = (
          k_xr
          - self.k_col_sums[None, :] / m
          - k_xr_row_sums[:, None] / n
          + self.k_sum / (m * n)
      )
      x_pcs = k_xr_cen @ self.pcs
      scores = -2 * k_xr.mean(-1) - (x_pcs**2).sum(1)
      return scores
  
imports: from typing import Optional, Callable
  import torch
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 3 for calling the KernelPCATorch obj's underlying member method code with example usage: obj._score(x) and returns: scores