(self, n_samples)
Perform undersampling.

        Parameters
        ----------
        n_samples : int
            Number of samples to remove.

        Returns
        -------
        S : array, shape = [n_majority_samples - n_samples, n_features]
            Returns synthetic samples.
Perform undersampling.
Perform undersampling .
def sample(self, n_samples):
        """Perform undersampling.

        Parameters
        ----------
        n_samples : int
            Number of samples to remove.

        Returns
        -------
        S : array, shape = [n_majority_samples - n_samples, n_features]
            Returns synthetic samples.
        """
        np.random.seed(seed=self.random_state)

        if self.n_majority_samples <= n_samples:
            n_samples = self.n_majority_samples

        idx = np.random.choice(self.n_majority_samples,
                               size=self.n_majority_samples - n_samples,
                               replace=self.with_replacement)

        if self.return_indices:
            return (self.X[idx], idx)
        else:
            return self.X[idx]
def sample ( self , n_samples ) : np . random . seed ( seed = self . random_state ) if self . n_majority_samples <= n_samples : n_samples = self . n_majority_samples idx = np . random . choice ( self . n_majority_samples , size = self . n_majority_samples - n_samples , replace = self . with_replacement ) if self . return_indices : return ( self . X [ idx ] , idx ) else : return self . X [ idx ]