def __iter__(self):
        scores = defaultdict(dict)

        base_entropy = {}
        total = {}
        for ss in self._num_true:
            base_entropy[ss] = entropy(self._num_true[ss] /
                                   float(self._num_false[ss]
                                         + self._num_true[ss]))
            total[ss] = self._num_true[ss] + self._num_false[ss]

        keys = self._observations.keys()
        # print("---------------------------")
        for label, sent in keys:
            for feat in self._observations[(label, sent)]:
                feature_total = self._observations[(True, sent)][feat] + \
                    self._observations[(False, sent)][feat]

                if feature_total == 0 or sent > self._max_sent:
                    continue

                present_prob = self._observations[(True, sent)][feat] \
                    / float(feature_total)
                present_entropy = entropy(present_prob)

                absent_prob = (self._num_true[sent] -
                               self._observations[(True, sent)][feat]) \
                               / float(total[sent] - feature_total)
                absent_entropy = entropy(absent_prob)

                # if present_prob > 0:
                #    print(label, sent, feat, present_prob, absent_prob,
                #          present_entropy, absent_entropy)

                if present_entropy < 0.0 and absent_entropy < 0.0:
                    continue

                ig = base_entropy[sent] \
                    - feature_total / float(total[sent]) * present_entropy \
                    - (total[sent] - feature_total) / float(total[sent])  * \
                    absent_entropy

                if feat in scores[sent]:
                    continue
                else:
                    scores[sent][feat] = min(kMAX_VAL, ig)

        # print("---------------------------")

        # high values
        for sent in scores:
            count = 0
            for feat, val in sorted(scores[sent].items(),
                                    key=operator.itemgetter(1)):
                freq = self._observations[(True, sent)][feat] + \
                    self._observations[(False, sent)][feat]

                if freq < self._min_freq:
                    continue

                d = {}
                d["frequency"] = freq
                d["feature"] = self._name
                d["name"] = feat
                d["ig"] = val
                d["sent"] = sent

                count += 1
                yield d

                if count > self._num_vals:
                    break


        # low value
dataset/ETHPy150Open Pinafore/qb/util/inspect_features.py/VwDiscreteReader.__iter__/original