docstr: Fit the Nystroem approximation.
  
  Parameters
  ----------
  x
      `torch.Tensor` of shape ``(n, d)`` where ``n`` is the number of samples and ``d`` is the dimensionality of
      the data.
docstr_tok: ["Fit","the","Nystroem","approximation",".","Parameters","--","--","--","--","--","x","`","torch.Tensor","`","of","shape","``","(","n",",","d",")","``","where","``","n","``","is","the","number","of","samples","and","``","d","``","is","the","dimensionality","of","the","data","."]
code: def fit(self, x: torch.Tensor) -> Self:
      """Fit the Nystroem approximation.
  
      Parameters
      ----------
      x
          `torch.Tensor` of shape ``(n, d)`` where ``n`` is the number of samples and ``d`` is the dimensionality of
          the data.
      """
      n = len(x)
      n_components = (
          n if self.n_components is None else self.n_components
      )
      inds = torch.randperm(n)[:n_components]
      self.z = x[inds]
      K_zz = self.kernel(self.z, self.z)
      K_zz += 1e-16 + torch.eye(n_components, device=K_zz.device)
      U, S, V = torch.linalg.svd(K_zz)
      self.K_zz_root_inv = (U / S.sqrt()) @ V
      return self
  
imports: import warnings
  from typing import Callable, Dict, Optional, Tuple
  import numpy
  import torch
  from sklearn.linear_model import SGDOneClassSVM
  from sklearn.utils.extmath import safe_sparse_dot
  from tqdm import tqdm
  from typing_extensions import Self
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.utils.pytorch.losses import hinge_loss
  from alibi_detect.utils.pytorch.kernels import GaussianRBF
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 2 for calling the _Nystroem obj's underlying member method code with example usage: obj.fit(x) and returns: self