code: def fit(self, X, y=None):
          
          X = array2d(X)
          self.n_features = X.shape[1]
          self.n_bins = self.n_bins_per_feature ** self.n_features
  
          if self.min is None:
              min = np.min(X, axis=0)
          elif isinstance(self.min, numbers.Number):
              min = self.min * np.ones(self.n_features)
          else:
              min = np.asarray(self.min)
              if not min.shape == (self.n_features,):
                  raise ValueError('min shape error')
  
          if self.max is None:
              max = np.max(X, axis=0)
          elif isinstance(self.max, numbers.Number):
              max = self.max * np.ones(self.n_features)
          else:
              max = np.asarray(self.max)
              if not max.shape == (self.n_features,):
                  raise ValueError('max shape error')
  
          self.grid = np.array(
              [np.linspace(min[i] - EPS, max[i] + EPS, self.n_bins_per_feature + 1)
               for i in range(self.n_features)])
  
          return self
docs: Fit the grid
  
          Parameters
          ----------
          X : array-like, shape = [n_samples, n_features]
              Data points
  
          Returns
          -------
          self