Skip to content

Commit ca8729f

Browse files
arielrossanigoglemaitre
authored andcommitted
DOC: fix the documentation of over- and under-sampling ratio when it is a float (#525)
1 parent 5ba0dbb commit ca8729f

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

doc/whats_new/v0.5.rst

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Version 0.5 (under development)
66
Changelog
77
---------
88

9+
Documentation
10+
.............
11+
12+
- Correct the definition of the ratio when using a ``float`` in sampling
13+
strategy for the over-sampling and under-sampling.
14+
:issue:`525` by :user:`Ariel Rossanigo <arielrossanigo>`.
15+
916
Maintenance
1017
...........
1118

examples/plot_sampling_strategy_usage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def my_autopct(pct):
9696

9797
###############################################################################
9898
# For **over-sampling methods**, it correspond to the ratio
99-
# :math:`\\alpha_{os}` defined by :math:`N_{rm} = \\alpha_{os} \\times N_{m}`
99+
# :math:`\\alpha_{os}` defined by :math:`N_{rm} = \\alpha_{os} \\times N_{M}`
100100
# where :math:`N_{rm}` and :math:`N_{M}` are the number of samples in the
101101
# minority class after resampling and the number of samples in the majority
102102
# class, respectively.

imblearn/over_sampling/base.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ class BaseOverSampler(BaseSampler):
2222
Sampling information to resample the data set.
2323
2424
- When ``float``, it corresponds to the desired ratio of the number of
25-
samples in the majority class over the number of samples in the
26-
minority class after resampling. Therefore, the ratio is expressed as
27-
:math:`\\alpha_{os} = N_{M} / N_{rm}` where :math:`N_{rm}` and
28-
:math:`N_{M}` are the number of samples in the minority class after
29-
resampling and the number of samples in the majority class,
30-
respectively.
25+
samples in the minority class over the number of samples in the
26+
majority class after resampling. Therefore, the ratio is expressed as
27+
:math:`\\alpha_{os} = N_{rm} / N_{M}` where :math:`N_{rm}` is the
28+
number of samples in the minority class after resampling and
29+
:math:`N_{M}` is the number of samples in the majority class.
3130
3231
.. warning::
3332
``float`` is only available for **binary** classification. An

imblearn/under_sampling/base.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class BaseUnderSampler(BaseSampler):
2020
Sampling information to sample the data set.
2121
2222
- When ``float``, it corresponds to the desired ratio of the number of
23-
samples in the majority class over the number of samples in the
24-
minority class after resampling. Therefore, the ratio is expressed as
25-
:math:`\\alpha_{us} = N_{rM} / N_{m}` where :math:`N_{rM}` and
26-
:math:`N_{m}` are the number of samples in the majority class after
27-
resampling and the number of samples in the minority class,
28-
respectively.
23+
samples in the minority class over the number of samples in the
24+
majority class after resampling. Therefore, the ratio is expressed as
25+
:math:`\\alpha_{us} = N_{m} / N_{rM}` where :math:`N_{m}` is the
26+
number of samples in the minority class and
27+
:math:`N_{rM}` is the number of samples in the majority class
28+
after resampling.
2929
3030
.. warning::
3131
``float`` is only available for **binary** classification. An

0 commit comments

Comments
 (0)