imblearn.datasets.make_imbalance¶
-
imblearn.datasets.
make_imbalance
(X, y, ratio, min_c_=None, random_state=None)[source][source]¶ Turns a dataset into an imbalanced dataset at specific ratio. A simple toy dataset to visualize clustering and classification algorithms.
Parameters: X : ndarray, shape (n_samples, n_features)
Matrix containing the data to be imbalanced.
y : ndarray, shape (n_samples, )
Corresponding label for each sample in X.
ratio : float,
The desired ratio given by the number of samples in the minority class over the the number of samples in the majority class. Thus the ratio should be in the interval [0., 1.]
min_c_ : str or int, optional (default=None)
The identifier of the class to be the minority class. If None, min_c_ is set to be the current minority class.
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
Returns: X_resampled : ndarray, shape (n_samples_new, n_features)
The array containing the imbalanced data.
y_resampled : ndarray, shape (n_samples_new)
The corresponding label of X_resampled