parameters: (self, X)
return_statement: return self._encoder.transform(Xt)
docstring: Discretize the data.
  
          Parameters
          ----------
          X : numeric array-like, shape (n_samples, n_features)
              Data to be discretized.
  
          Returns
          -------
          Xt : numeric array-like or sparse matrix
              Data in the binned space.
docstring_summary: Discretize the data.
docstring_tokens: Discretize the data .
function: def transform(self, X):
          """
          Discretize the data.
  
          Parameters
          ----------
          X : numeric array-like, shape (n_samples, n_features)
              Data to be discretized.
  
          Returns
          -------
          Xt : numeric array-like or sparse matrix
              Data in the binned space.
          """
          check_is_fitted(self)
  
          Xt = check_array(X, copy=True, dtype=FLOAT_DTYPES)
          n_features = self.n_bins_.shape[0]
          if Xt.shape[1] != n_features:
              raise ValueError("Incorrect number of features. Expecting {}, "
                               "received {}.".format(n_features, Xt.shape[1]))
  
          bin_edges = self.bin_edges_
          for jj in range(Xt.shape[1]):
              # Values which are close to a bin edge are susceptible to numeric
              # instability. Add eps to X so these values are binned correctly
              # with respect to their decimal truncation. See documentation of
              # numpy.isclose for an explanation of ``rtol`` and ``atol``.
              rtol = 1.e-5
              atol = 1.e-8
              eps = atol + rtol * np.abs(Xt[:, jj])
              Xt[:, jj] = np.digitize(Xt[:, jj] + eps, bin_edges[jj][1:])
          np.clip(Xt, 0, self.n_bins_ - 1, out=Xt)
  
          if self.encode == 'ordinal':
              return Xt
  
          return self._encoder.transform(Xt)
function_tokens: def transform ( self , X ) : check_is_fitted ( self ) Xt = check_array ( X , copy = True , dtype = FLOAT_DTYPES ) n_features = self . n_bins_ . shape [ 0 ] if Xt . shape [ 1 ] != n_features : raise ValueError ( "Incorrect number of features. Expecting {}, " "received {}." . format ( n_features , Xt . shape [ 1 ] ) ) bin_edges = self . bin_edges_ for jj in range ( Xt . shape [ 1 ] ) : # Values which are close to a bin edge are susceptible to numeric # instability. Add eps to X so these values are binned correctly # with respect to their decimal truncation. See documentation of # numpy.isclose for an explanation of ``rtol`` and ``atol``. rtol = 1.e-5 atol = 1.e-8 eps = atol + rtol * np . abs ( Xt [ : , jj ] ) Xt [ : , jj ] = np . digitize ( Xt [ : , jj ] + eps , bin_edges [ jj ] [ 1 : ] ) np . clip ( Xt , 0 , self . n_bins_ - 1 , out = Xt ) if self . encode == 'ordinal' : return Xt return self . _encoder . transform ( Xt )