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

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