class_docstr: Base module for Random Projection using Paddle operations.
  
  Args:
      eps (float, optional): Minimum distortion rate parameter for calculating
          Johnson-Lindenstrauss minimum dimensions. Defaults to 0.1.
      random_state (Optional[int], optional): Uses the seed to set the random
          state for sample_without_replacement function. Defaults to None.
class_docstr_tok: ["Base","module","for","Random","Projection","using","Paddle","operations",".","Args",":","eps","(","float",",","optional",")",":","Minimum","distortion","rate","parameter","for","calculating","Johnson-Lindenstrauss","minimum","dimensions",".","Defaults","to","0.1.","random_state","(","Optional","[","int","]",",","optional",")",":","Uses","the","seed","to","set","the","random","state","for","sample_without_replacement","function",".","Defaults","to","None","."]
docstr: Generates projection matrix from the embedding tensor.
  
  Args:
      embedding (Tensor): embedding tensor for generating embedding
  
  Returns:
      (RandomProjection): Return self to be used as
      > generator = RandomProjection()
      > generator = generator.fit()
docstr_tok: ["Generates","projection","matrix","from","the","embedding","tensor",".","Args",":","embedding","(","Tensor",")",":","embedding","tensor","for","generating","embedding","Returns",":","(","RandomProjection",")",":","Return","self","to","be","used","as",">","generator","=","RandomProjection","(",")",">","generator","=","generator.fit","(",")"]
code: def fit(self, embedding: Tensor) -> "BaseRandomProjection":
      """Generates projection matrix from the embedding tensor.
  
      Args:
          embedding (Tensor): embedding tensor for generating embedding
  
      Returns:
          (RandomProjection): Return self to be used as
          > generator = RandomProjection()
          > generator = generator.fit()
      """
      n_samples, n_features = embedding.shape
      # device = embedding.device
      # ported from sklearn
      if self.n_components == "auto":
          self.n_components_ = johnson_lindenstrauss_min_dim(
              n_samples=n_samples, eps=self.eps
          )
  
          if self.n_components_ <= 0:
              raise ValueError(
                  "eps=%f and n_samples=%d lead to a target dimension of "
                  "%d which is invalid"
                  % (self.eps, n_samples, self.n_components_)
              )
  
          elif self.n_components_ > n_features:
              raise ValueError(
                  "eps=%f and n_samples=%d lead to a target dimension of "
                  "%d which is larger than the original space with "
                  "n_features=%d"
                  % (
                      self.eps,
                      n_samples,
                      self.n_components_,
                      n_features,
                  )
              )
      else:
          if self.n_components <= 0:
              raise ValueError(
                  "n_components must be greater than 0, got %s"
                  % self.n_components
              )
  
          elif self.n_components > n_features:
              warnings.warn(
                  "The number of components is higher than the number of"
                  " features: n_features < n_components (%s < %s)."
                  "The dimensionality of the problem will not be reduced."
                  % (n_features, self.n_components)
              )
  
          self.n_components_ = self.n_components
  
      # Generate projection matrix
      self.random_matrix = self._make_random_matrix(
          self.n_components_, n_features=n_features
      )  # .to(device)
  
      return self
  
imports: import warnings
  from typing import Optional
  import paddle
  from paddle import Tensor
  import numpy
  from sklearn.utils.random import sample_without_replacement
label_desc: Use image node_id 3 for calling the BaseRandomProjection obj's underlying member method code with example usage: obj.fit(embedding) and returns: self