add if __name__ == "__main__" to prevent script from running on import
This commit is contained in:
parent
d8b165844c
commit
ddb75e3d2d
@ -69,7 +69,7 @@ def get_decision(data: dict, root: Node) -> str:
|
||||
return root.name
|
||||
|
||||
|
||||
tree_root = tree_learn(training_set, attribs, 'detonation')
|
||||
def main():
|
||||
print(RenderTree(tree_root))
|
||||
print('-' * 150)
|
||||
|
||||
@ -82,3 +82,10 @@ for test in test_set:
|
||||
score += 1
|
||||
|
||||
print(f'Accuracy: {score/len(test_set)}')
|
||||
|
||||
|
||||
tree_root = tree_learn(training_set, attribs, 'detonation')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user