How to use the composeml.label_search.ExampleSearch function in composeml

To help you get started, we’ve selected a few composeml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FeatureLabs / compose / composeml / label_search.py View on Github external
def reset_count(self):
        """Reset the internal count of actual labels."""
        self.actual_count = 0

    @property
    def total_count(self):
        multiplier = self.expected_count if self.is_finite else 1
        return self.n_groups * multiplier

    def update_count(self, labels):
        """Update the internal count of actual labels."""
        self.actual_count += 1


class LabelSearch(ExampleSearch):
    """A label search based on the number of examples for each label.

    Args:
        expected_label_counts (dict): The expected number of examples to be find for each label.
            The dictionary should map a label to the number of examples to find for the label.
    """

    def __init__(self, expected_label_counts, n_groups=1):
        items = expected_label_counts.items()
        self.expected_label_counts = Counter({label: self._check_number(count) for label, count in items})
        self.expected_count = sum(self.expected_label_counts.values())
        self.actual_label_counts = Counter()
        self.n_groups = n_groups

    @property
    def is_complete(self):