#authors: Panchami Rudrakshi, Ranjani Suresh import sys import ReadFile import Algorithm import BinaryTreeFormat PruneValue = int(sys.argv[1]) training_filename = str(sys.argv[2]) test_filename = str(sys.argv[3]) fileResult = ReadFile.readfile(training_filename) #validationFile = ReadFile.readfile(validation_filename) targetAttribute = fileResult.attributes[-1] del (fileResult.attributes[-1]) root = Algorithm.ID3Algorithm(fileResult.trainingValues, fileResult.attributes, BinaryTreeFormat.BinTree(), targetAttribute) def maxDepth(root): if root == None: return 0 return max(maxDepth(root.left), maxDepth(root.right)) + 1 def totalDepth(root, level=0): if root == None: return 0 if root.left is None: if root.right is None: return level else: return totalDepth(root.left, level + 1) + totalDepth( root.right, level + 1)