code: def fit(self, X, y, sample_weight=None):
          
          assert self.extra_rej_const >= 0
          if sample_weight is None:
              sample_weight = np.ones(y.shape[0])
          else:
              if isinstance(sample_weight, list):
                  sample_weight = np.array(sample_weight)
              if len(sample_weight.shape):
                  sample_weight = sample_weight.reshape(-1)
          assert sample_weight.shape[0] == X.shape[0]
          assert sample_weight.min() > 0
          
          Z = sample_weight.max() + self.extra_rej_const
          sample_weight = sample_weight / Z # sample weight is now acceptance prob
          self.classifiers = [deepcopy(self.base_classifier) for c in range(self.n_samples)]
          ### Note: don't parallelize random number generation, as it's not always thread-safe
          take_all = np.random.random(size = (self.n_samples, X.shape[0]))
          Parallel(n_jobs=self.njobs, verbose=0, require="sharedmem")(delayed(self._fit)(c, take_all, X, y, sample_weight) for c in range(self.n_samples))
          return self
docs: Fit a binary classifier with sample weights to data.
          
          Note
          ----
          Examples at each sample are accepted with probability = weight/Z,
          where Z = max(weight) + extra_rej_const.
          Larger values for extra_rej_const ensure that no example gets selected in
          every single sample, but results in smaller sample sizes as more examples are rejected.
          
          Parameters
          ----------
          X : array (n_samples, n_features)
              Data on which to fit the model.
          y : array (n_samples,) or (n_samples, 1)
              Class of each observation.
          sample_weight : array (n_samples,) or (n_samples, 1)
              Weights indicating how important is each observation in the loss function.