<jupyter_start><jupyter_text>Unzip datasets and prepare data:<jupyter_code>import os

import seaborn as sns
from imblearn.metrics import geometric_mean_score
from sklearn.model_selection import cross_val_score, ShuffleSplit
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

from multi_imbalance.datasets import load_datasets
from multi_imbalance.ensemble.soup_bagging import SOUPBagging
from multi_imbalance.utils.data import load_arff_dataset
from multi_imbalance.utils.min_int_maj import maj_int_min

%matplotlib inline
sns.set_style('darkgrid')
dataset = load_datasets()['new_ecoli']

X, y = dataset.data, dataset.target
print(X[:5])
print(y[:5])
X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.25)
clf = KNeighborsClassifier()
vote_classifier = SOUPBagging(clf, n_classifiers=50, maj_int_min=maj_int_min['new_ecoli'])
vote_classifier.fit(X_train, y_train)
y_pred = vote_classifier.predict(X_test)
geometric_mean_score(y_test, y_pred, correction=0.001)
X, y = load_arff_dataset(f'{os.getcwd()}/../../data/arff/new_ecoli.arff')
clf = make_pipeline(StandardScaler(), SOUPBagging())
cv = ShuffleSplit(n_splits=5, test_size=0.3, random_state=0)
print(cross_val_score(clf, X, y, cv=cv))<jupyter_output>/home/plutasnyy/anaconda3/envs/multi-imbalance/lib/python3.7/site-packages/sklearn/base.py:197: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
  FutureWarning)
/home/plutasnyy/anaconda3/envs/multi-imbalance/lib/python3.7/site-packages/sklearn/base.py:197: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
  FutureWarning)
/home/plutasnyy/anaconda3/envs/multi-imbalance/lib/python3.7/site-packages/sklearn/base.py:197: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
  FutureWarning)
/home/plutasnyy/anaconda3/envs/multi-imbalance/lib/python3.7/site-packages/sklearn/base.py:197: FutureWarning: From version 0.24, get_params will raise an At[...]
{'fraction_non_alphanumeric': 0.09481668773704172, 'fraction_numerical': 0.021491782553729456, 'mean_word_length': 6.860927152317881, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '425808', 'license': 'MIT', 'n_tokens_mistral': 839, 'n_tokens_neox': 818, 'n_words': 185, 'path': 'examples/ensemble/SOUPBagging.ipynb', 'repo_name': 'NaIwo/multi-imbalance', 'size': '2373'}