in src/smote_variants.py [0:0]
def det_n_to_sample(self, strategy, n_maj, n_min):
"""
Determines the number of samples to generate
Args:
strategy (str/float): if float, the fraction of the difference
of the minority and majority numbers to
generate, like 0.1 means that 10% of the
difference will be generated if str,
like 'min2maj', the minority class will
be upsampled to match the cardinality
of the majority class
"""
if isinstance(strategy, float) or isinstance(strategy, int):
return max([0, int((n_maj - n_min) * strategy)])
else:
m = "Value %s for parameter strategy is not supported" % strategy
raise ValueError(self.__class__.__name__ + ": " + m)