Skip to content

Commit 1702d4d

Browse files
authored
DOC: Fix the documentation of sampling_strategy as a float (#480)
1 parent 176ce44 commit 1702d4d

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

doc/whats_new/v0.0.4.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ Documentation
117117
- Remove some docstring which are not necessary.
118118
:issue:`454` by :user:`Guillaume Lemaitre <glemaitre>`.
119119

120+
- Fix the documentation of the ``sampling_strategy`` parameters when used as a
121+
float.
122+
:issue:`480` by :user:`Guillaume Lemaitre <glemaitre>`.
123+
120124
Deprecation
121125
...........
122126

imblearn/over_sampling/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ class BaseOverSampler(BaseSampler):
2121
"""sampling_strategy : float, str, dict or callable, (default='auto')
2222
Sampling information to resample the data set.
2323
24-
- When ``float``, it corresponds to the ratio :math:`\\alpha_{os}`
25-
defined by :math:`N_{rm} = \\alpha_{os} \\times N_{m}` where
26-
:math:`N_{rm}` and :math:`N_{M}` are the number of samples in the
27-
minority class after resampling and the number of samples in the
28-
majority class, respectively.
24+
- 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.
2931
3032
.. warning::
3133
``float`` is only available for **binary** classification. An

imblearn/under_sampling/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ class BaseUnderSampler(BaseSampler):
1919
"""sampling_strategy : float, str, dict, callable, (default='auto')
2020
Sampling information to sample the data set.
2121
22-
- When ``float``, it corresponds to the ratio :math:`\\alpha_{us}`
23-
defined by :math:`N_{rM} = \\alpha_{us} \\times N_{m}` where
24-
:math:`N_{rM}` and :math:`N_{m}` are the number of samples in the
25-
majority class after resampling and the number of samples in the
26-
minority class, respectively.
22+
- 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.
2729
2830
.. warning::
2931
``float`` is only available for **binary** classification. An

0 commit comments

Comments
 (0)