check_ratio(ratio, y, sampling_type, **kwargs)¶
DEPRECATED: imblearn.utils.check_ratio was deprecated in favor of imblearn.utils.check_sampling_strategy in 0.4. It will be removed in 0.6.
Sampling target validation for samplers.
Checks ratio for consistent type and return a dictionary containing each targeted class with its corresponding number of sample.
Deprecated since version 0.4: This function is deprecated in favor of
imblearn.utils.check_sampling_strategy. It will be removed in 0.6.
- ratiostr, dict or callable,
Ratio to use for resampling the data set.
str, has to be one of: (i)
'minority': resample the minority class; (ii)
'majority': resample the majority class, (iii)
'not minority': resample all classes apart of the minority class, (iv)
'all': resample all classes, and (v)
'auto': correspond to
'all'with for over-sampling methods and
'not minority'for under-sampling methods. The classes targeted will be over-sampled or under-sampled to achieve an equal number of sample with the majority or minority class.
dict, the keys correspond to the targeted classes. The values correspond to the desired number of samples.
If callable, function taking
yand returns a
dict. The keys correspond to the targeted classes. The values correspond to the desired number of samples.
- yndarray, shape (n_samples,)
The target array.
The type of sampling. Can be either
- kwargsdict, optional
Dictionary of additional keyword arguments to pass to
The converted and validated ratio. Returns a dictionary with the key being the class target and the value being the desired number of samples.