def generate()

in rules/predicate.py [0:0]


def generate(df: pd.DataFrame, relevant_attributes: Dict[str, str], num_bins: int, binning_method: BinningMethod) -> Set[Predicate]:
    """
        Generates a set of predicates based on the dataset and search hyper-parameters

        Parameters
        ----------

        predicates : Set[Predicate]
            The feature we care about (e.g., misprediction)

        df : pd.DataFrame
            Tabular data as Pandas data frame

        num_bins : int
            Number of bins

        binning_method : BinningMethod
            Either equal frequency or width binning

        Returns
        -------
        filtered: Set[Predicate]
            A subset of predicates
    """
    features: Set[Predicate] = set()
    for (attribute_name, attribute_type) in relevant_attributes.items():
        values = get_values_for_attributes(df, attribute_name)
        if attribute_type == 'D':
            features |= generate_discrete_predicates(attribute_name, values)
        elif attribute_type == 'C' or attribute_type == 'I':
            features |= generate_continous_predicates(attribute_name, values, num_bins, binning_method)
        else:
            raise Exception("attribute type not supported")
    return features