(y, sampling_type)
return sampling_strategy
Returns sampling target by targeting all classes.
Returns sampling target by targeting all classes.
Returns sampling target by targeting all classes .
def _sampling_strategy_all(y, sampling_type):
    """Returns sampling target by targeting all classes."""
    target_stats = _count_class_sample(y)
    if sampling_type == "over-sampling":
        n_sample_majority = max(target_stats.values())
        sampling_strategy = {
            key: n_sample_majority - value for (key, value) in target_stats.items()
        }
    elif sampling_type == "under-sampling" or sampling_type == "clean-sampling":
        n_sample_minority = min(target_stats.values())
        sampling_strategy = {key: n_sample_minority for key in target_stats.keys()}
    else:
        raise NotImplementedError

    return sampling_strategy
def _sampling_strategy_all ( y , sampling_type ) : target_stats = _count_class_sample ( y ) if sampling_type == "over-sampling" : n_sample_majority = max ( target_stats . values ( ) ) sampling_strategy = { key : n_sample_majority - value for ( key , value ) in target_stats . items ( ) } elif sampling_type == "under-sampling" or sampling_type == "clean-sampling" : n_sample_minority = min ( target_stats . values ( ) ) sampling_strategy = { key : n_sample_minority for key in target_stats . keys ( ) } else : raise NotImplementedError return sampling_strategy