Esempio n. 1
 def generate_candidates(k_freq_itemsets, constraint, items):
     Returns set of candidates with k + 1 nodes using set of candidates with k nodes and also returns support data which contains the parent child relationship.
     :param k_freq_itemsets: List of frequent itemsets of size k
     :param constraint: function which returns boolean value
     :param items: not used by definition of antimonotone but used by loosely antimonotone definition
     :return: List of candidates of size k+1, dictionary of support data with child -> parent mapping
     candidates = set()
     support_data = {}
     for a in k_freq_itemsets:
         for b in k_freq_itemsets:
             k = len(a)
             union = tuple(sorted(set(a).union(set(b))))
             if len(union) == k + 1 and constraint(list(union)):
                 if union not in candidates:
                     parents = LevelwiseApriori.find_subsets(list(union), k)
                     if isSubSet(parents, k_freq_itemsets):
                         if union not in support_data:
                             support_data[tuple(union)] = parents
     # returning set of candidates with k + 1 nodes
     return list(candidates), support_data
Esempio n. 2
 def maximal_lam_sigma_ssd_ucs(self, sigma):
     return LevelwiseApriori.maximal_freq_itemsets(lambda x: self.compute_scaled_subgraph_divergence(x) <= sigma,
                                                   self.nodes(), LooselyAntiMonotone.generate_candidates)
Esempio n. 3
 def phi_sd_ucs(self, phi):
     return LevelwiseApriori.freq_itemsets((lambda x: self.compute_subgraph_divergence(x) <= phi), self.nodes(),