class_docstr: LIT model API implementation for PCA.
code: def fit_transform(self, inputs):
      x_input = [i["x"] for i in inputs]
      if not x_input:
          return []
      x_train = np.stack(x_input)
      logging.info("PCA input x_train: %s", str(x_train.shape))
  
      # Center columns around mean.
      self._mean = np.mean(x_train, 0)
      x_train = x_train - self._mean
  
      # Find PCA projection.
      cov = np.dot(x_train.T, x_train) / x_train.shape[0]
      evals, evecs = np.linalg.eig(cov)
  
      # Sort by strongest eigenvalues
      key = np.argsort(evals)[::-1][: self._num_components]
      self._evecs = evecs[:, key]
      self._fitted = True
  
      # Apply PCA projection
      zs = np.dot(x_train, self._evecs)
      return ({"z": utils.coerce_real(z)} for z in zs)
  
file_path: lit/lit_nlp/components/pca.py
imports: from absl import logging
  from lit_nlp.api import model
  from lit_nlp.lib import utils
  import numpy
label_desc: Use image node_id 2 for calling the PCAModel obj's underlying member method code with example usage: obj.fit_transform(inputs) and returns: unknown, list