本文整理汇总了Python中trie.Trie.trie_for_rules方法的典型用法代码示例。如果您正苦于以下问题:Python Trie.trie_for_rules方法的具体用法?Python Trie.trie_for_rules怎么用?Python Trie.trie_for_rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trie.Trie
的用法示例。
在下文中一共展示了Trie.trie_for_rules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: classifier
# 需要导入模块: from trie import Trie [as 别名]
# 或者: from trie.Trie import trie_for_rules [as 别名]
def classifier(self, test_data0, test_data1):
test_set1 = test_data0
test_set2 = test_data1
rules_tree1 = Trie(test_set1)
rules_tree2 = Trie(test_set2)
rules_tree1.trie_for_rules()
rules_tree2.trie_for_rules()
imp_rules1 = rules_tree1.important_rules_selection(0.0001)
imp_rules2 = rules_tree2.important_rules_selection(0.0001)
inf1 = RulesImportance(imp_rules1, rules_tree1, rules_tree2, 1.2)
inf2 = RulesImportance(imp_rules2, rules_tree2, rules_tree1, 1.2)
classifier = Classification(inf1, inf2)
all_data = {}
temp_object = _from_list_to_dataset(all_data, test_data0, 0, 1)
n_0 = len(test_data0) + 1
all_data = _from_list_to_dataset(temp_object, test_data1, 1, n_0)
results = []
print("Length Length %f" % len(all_data))
for id in all_data.iterkeys():
data = all_data[id]["data"]
status = all_data[id]["status"]
results.append((self._classify_object(data), status))
return results