ó
    ¨ñ:i  ã                   ó„   • S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  \
" S/S/\\S	/S
/S/S.SS9S	S	SS.S j5       rg	)z/Transform a dataset into an imbalanced dataset.é    )ÚCounter)ÚMappingé   )ÚRandomUnderSampler)Úcheck_sampling_strategy)Úvalidate_paramsz
array-likeNÚrandom_stateÚboolean)ÚXÚyÚsampling_strategyr	   ÚverboseT)Úprefer_skip_nested_validationF)r   r	   r   c                ó$  • [        U5      n[        U[        5      (       d  [        U5      (       a  [	        X!S40 UD6nU(       a  [        SU 35        [        WSUS9nUR                  X5      u  pšU(       a  [        S[        U
5       35        Xš4$ )a|	  Turn a dataset into an imbalanced dataset with a specific sampling strategy.

A simple toy dataset to visualize clustering and classification
algorithms.

Read more in the :ref:`User Guide <make_imbalanced>`.

Parameters
----------
X : {array-like, dataframe} of shape (n_samples, n_features)
    Matrix containing the data to be imbalanced.

y : array-like of shape (n_samples,)
    Corresponding label for each sample in X.

sampling_strategy : dict or callable,
    Ratio to use for resampling the data set.

    - When ``dict``, the keys correspond to the targeted classes. The
      values correspond to the desired number of samples for each targeted
      class.

    - When callable, function taking ``y`` and returns a ``dict``. The keys
      correspond to the targeted classes. The values correspond to the
      desired number of samples for each class.

random_state : int, RandomState instance or None, 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.

verbose : bool, default=False
    Show information regarding the sampling.

**kwargs : dict
    Dictionary of additional keyword arguments to pass to
    ``sampling_strategy``.

Returns
-------
X_resampled : {ndarray, dataframe} of shape (n_samples_new, n_features)
    The array containing the imbalanced data.

y_resampled : ndarray of shape (n_samples_new)
    The corresponding label of `X_resampled`.

Notes
-----
See
:ref:`sphx_glr_auto_examples_applications_plot_multi_class_under_sampling.py`,
:ref:`sphx_glr_auto_examples_datasets_plot_make_imbalance.py`, and
:ref:`sphx_glr_auto_examples_api_plot_sampling_strategy_usage.py`.

Examples
--------
>>> from collections import Counter
>>> from sklearn.datasets import load_iris
>>> from imblearn.datasets import make_imbalance

>>> data = load_iris()
>>> X, y = data.data, data.target
>>> print(f'Distribution before imbalancing: {Counter(y)}')
Distribution before imbalancing: Counter({0: 50, 1: 50, 2: 50})
>>> X_res, y_res = make_imbalance(X, y,
...                               sampling_strategy={0: 10, 1: 20, 2: 30},
...                               random_state=42)
>>> print(f'Distribution after imbalancing: {Counter(y_res)}')
Distribution after imbalancing: Counter({2: 30, 1: 20, 0: 10})
zunder-samplingz4The original target distribution in the dataset is: F)r   Úreplacementr	   zMake the dataset imbalanced: )r   Ú
isinstancer   Úcallabler   Úprintr   Úfit_resample)r   r   r   r	   r   ÚkwargsÚtarget_statsÚsampling_strategy_ÚrusÚX_resampledÚy_resampleds              Ú_/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/imblearn/datasets/_imbalance.pyÚmake_imbalancer      sŸ   € ôf ˜1“:€LäÐ#¤W×-Ñ-´Ð:K×1LÑ1LÜ4ØÐ"2ñ
Ø6<ñ
Ðö ÜÐDÀ\ÀNÐSÔTÜ
Ø,ØØ!ñ€Cð
  #×/Ñ/°Ó5Ñ€KÞÜÐ-¬g°kÓ.BÐ-CÐDÔEàÐ#Ð#ó    )Ú__doc__Úcollectionsr   Úcollections.abcr   Úunder_samplingr   Úutilsr   Úutils._param_validationr   r   r   © r   r   Ú<module>r&      sf   ðÙ 5õ  Ý #å /Ý +Ý 5ñ àˆ^Øˆ^Ø% x°Ð6Ø'Ð(Ø�;ñð #'ñ	ð  $°$Àô[$ó	ñ[$r   