featuremapper/distribution.py
def _relative_selectivity(self, d):
        """
        Return max_value_bin()) as a proportion of the sum_value().

        This quantity is a measure of how strongly the distribution is
        biased towards the max_value_bin().  For a smooth,
        single-lobed distribution with an inclusive, non-cyclic range,
        this quantity is an analog to vector_selectivity.  To be a
        precise analog for arbitrary distributions, it would need to
        compute some measure of the selectivity that works like the
        weighted_average() instead of the max_value_bin().  The result
        is scaled such that if all bins are identical, the selectivity
        is 0.0, and if all bins but one are zero, the selectivity is
        1.0.
        """
        # A single feature_bin is considered fully selective (but could also
        # arguably be considered fully unselective)
        if len(d.data()) <= 1:
            return 1.0

        proportion = d._safe_divide(max(d.values()), sum(d.values()))
        offset = 1.0/len(d.values())
        scaled = (proportion-offset) / (1.0-offset)

        # negative scaled is possible
        # e.g. 2 bins, with values that sum to less than 0.5
        # this probably isn't what should be done in those cases
        if scaled >= 0.0:
            return scaled
        else:
            return 0.0

        Return max_value_bin()) as a proportion of the sum_value().

        This quantity is a measure of how strongly the distribution is
        biased towards the max_value_bin().  For a smooth,
        single-lobed distribution with an inclusive, non-cyclic range,
        this quantity is an analog to vector_selectivity.  To be a
        precise analog for arbitrary distributions, it would need to
        compute some measure of the selectivity that works like the
        weighted_average() instead of the max_value_bin().  The result
        is scaled such that if all bins are identical, the selectivity
        is 0.0, and if all bins but one are zero, the selectivity is
        1.0.
        
Return max_value_bin()) as a proportion of the sum_value().
This quantity is a measure of how strongly the distribution is
biased towards the max_value_bin().  For a smooth,
single-lobed distribution with an inclusive, non-cyclic range,
this quantity is an analog to vector_selectivity.  To be a
precise analog for arbitrary distributions, it would need to
compute some measure of the selectivity that works like the
weighted_average() instead of the max_value_bin().  The result
is scaled such that if all bins are identical, the selectivity
is 0.0, and if all bins but one are zero, the selectivity is
1.0.
Return max_value_bin () ) as a proportion of the sum_value () . This quantity is a measure of how strongly the distribution is biased towards the max_value_bin () . For a smooth single - lobed distribution with an inclusive non - cyclic range this quantity is an analog to vector_selectivity . To be a precise analog for arbitrary distributions it would need to compute some measure of the selectivity that works like the weighted_average () instead of the max_value_bin () . The result is scaled such that if all bins are identical the selectivity is 0 . 0 and if all bins but one are zero the selectivity is 1 . 0 .
def _relative_selectivity(self, d):
        if len(d.data()) <= 1:
            return 1.0
        proportion = d._safe_divide(max(d.values()), sum(d.values()))
        offset = 1.0/len(d.values())
        scaled = (proportion-offset) / (1.0-offset)
        if scaled >= 0.0:
            return scaled
        else:
            return 0.0
def _relative_selectivity ( self , d ) : if len ( d . data ( ) ) <= 1 : return 1.0 proportion = d . _safe_divide ( max ( d . values ( ) ) , sum ( d . values ( ) ) ) offset = 1.0 / len ( d . values ( ) ) scaled = ( proportion - offset ) / ( 1.0 - offset ) if scaled >= 0.0 : return scaled else : return 0.0
Return max_value_bin()) as a proportion of the sum_value().
Return max_value_bin () ) as a proportion of the sum_value () .
"""
        Return max_value_bin()) as a proportion of the sum_value().

        This quantity is a measure of how strongly the distribution is
        biased towards the max_value_bin().  For a smooth,
        single-lobed distribution with an inclusive, non-cyclic range,
        this quantity is an analog to vector_selectivity.  To be a
        precise analog for arbitrary distributions, it would need to
        compute some measure of the selectivity that works like the
        weighted_average() instead of the max_value_bin().  The result
        is scaled such that if all bins are identical, the selectivity
        is 0.0, and if all bins but one are zero, the selectivity is
        1.0.
        """ # A single feature_bin is considered fully selective (but could also # arguably be considered fully unselective) # negative scaled is possible # e.g. 2 bins, with values that sum to less than 0.5 # this probably isn't what should be done in those cases
self
d