integration with imbalanced-learn
{'login': 'tansaku', 'id': 30216, 'node_id': 'MDQ6VXNlcjMwMjE2', 'avatar_url': 'https://avatars.githubusercontent.com/u/30216?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/tansaku', 'html_url': 'https://github.com/tansaku', 'followers_url': 'https://api.github.com/users/tansaku/followers', 'following_url': 'https://api.github.com/users/tansaku/following{/other_user}', 'gists_url': 'https://api.github.com/users/tansaku/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/tansaku/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/tansaku/subscriptions', 'organizations_url': 'https://api.github.com/users/tansaku/orgs', 'repos_url': 'https://api.github.com/users/tansaku/repos', 'events_url': 'https://api.github.com/users/tansaku/events{/privacy}', 'received_events_url': 'https://api.github.com/users/tansaku/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892871, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODcx', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/enhancement', 'name': 'enhancement', 'color': 'a2eeef', 'default': True, 'description': 'New feature or request'}]
[]
You can convert any dataset to pandas to be used with imbalanced-learn using `.to_pandas()`

Otherwise if you want to keep a `Dataset` object and still use e.g. [make_imbalance](https://imbalanced-learn.org/stable/references/generated/imblearn.datasets.make_imbalance.html#imblearn.datasets.make_imbalance), you just need to pass the list of rows ids and labels:

```python
row_indices = list(range(len(dataset)))
resampled_row_indices, _ = make_imbalance(
    row_indices,
    dataset["label"],
    sampling_strategy={0: 25, 1: 50, 2: 50},
    random_state=RANDOM_STATE,
)

resampled_dataset = dataset.select(resampled_row_indices)
```
### Feature request

Wouldn't it be great if the various class balancing operations from imbalanced-learn were available as part of datasets?

### Motivation

I'm trying to use imbalanced-learn to balance a dataset, but it's not clear how to get the two to interoperate - what would be great would be some examples.  I've looked online, asked gpt-4, but so far not making much progress.

### Your contribution

If I can get this working myself I can submit a PR with example code to go in the docs
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/5660/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}