sklearn adasyn

Solutions on MaxInterview for sklearn adasyn by the best coders in the world

showing results for - "sklearn adasyn"
Salma
13 May 2018
1>>> from collections import Counter
2>>> from sklearn.datasets import make_classification
3>>> from imblearn.over_sampling import ADASYN 
4>>> X, y = make_classification(n_classes=2, class_sep=2,
5... weights=[0.1, 0.9], n_informative=3, n_redundant=1, flip_y=0,
6... n_features=20, n_clusters_per_class=1, n_samples=1000,
7... random_state=10)
8>>> print('Original dataset shape %s' % Counter(y))
9Original dataset shape Counter({1: 900, 0: 100})
10>>> ada = ADASYN(random_state=42)
11>>> X_res, y_res = ada.fit_resample(X, y)
12>>> print('Resampled dataset shape %s' % Counter(y_res))
13Resampled dataset shape Counter({0: 904, 1: 900})
14