add if __name__ == "__main__" to prevent script from running on import

This commit is contained in:
matixezor 2021-05-18 00:24:58 +02:00
parent d8b165844c
commit ddb75e3d2d

View File

@ -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()