def rank(self, x, y):
        cnts = y.value_counts()
        scores = []

        def e(x, y):
            if abs(y) < .000000001:
                yx = 0
                lyx = 0
            else:
                yx = y / (x + y)
                lyx = math.log(y / (x + y))
            if abs(x) < .000000001:
                xy = 0
                lxy = 0
            else:
                xy = x / (x + y)
                lxy = math.log(x / (x + y))
            return - xy * lxy - yx * lyx

        for c in x.columns:
            true_positives = float(np.count_nonzero(np.logical_and(x[c], y)))
            false_positives = float(np.count_nonzero(np.logical_and(x[c], np.logical_not(y))))
            pos = float(cnts[1])
            neg = float(cnts[0])
            n = pos + neg
            if self.type == 'bns':
                tpr = max(0.0005, true_positives / pos)
                fpr = max(0.0005, false_positives / neg)
                tpr = min(.9995, tpr)
                fpr = min(.9995, fpr)
                score = abs(norm.ppf(tpr) - norm.ppf(fpr))
            elif self.type == 'acc':
                score = abs(tpr - fpr)
            elif self.type == 'ig':
                score = e(pos, neg) - ( (true_positives + false_positives) / n * e(true_positives, false_positives)
                    + (1 - (true_positives + false_positives) / n) * e(pos - true_positives, neg - false_positives))
            scores.append((score, c))
        scores.sort(reverse=True)
        return scores
dataset/ETHPy150Open kvh/ramp/ramp/selectors.py/BinaryFeatureSelector.rank/original