Skip to content

Commit

Permalink
limited the depth of decision tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Areeb-Aatif committed Nov 27, 2019
1 parent e67544f commit 7efc5b5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions project3/Code/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def decision_tree(self, kCrossValidation = 10):
testData = data.loc[foldSize*i:foldSize*(i+1)-1]
trainData = data.loc[:foldSize*i-1].append(data.loc[foldSize*(i+1):])
# root = dt.decision(trainData, depth=10, minLeafRows=5)
root = dt.decision(trainData)
root = dt.decision(trainData, depth=15, minLeafRows=5)
target = testData.iloc[:,-1].values.tolist()
predicted = dt.predictData(testData.iloc[:, :-1], root)
models.append(root)
Expand Down Expand Up @@ -135,7 +135,6 @@ def random_forest(self, kCrossValidation = 10):
predicted = rf.predictForest(testData.iloc[:, :-1], forest)
models.append(forest)
truePositives, trueNegatives, falsePositives, falseNegatives = h.findParameters(predicted, target)
print(truePositives, trueNegatives, falsePositives, falseNegatives)
accuracy.append(h.findAccuracy(truePositives, trueNegatives, falsePositives, falseNegatives))
tmpPrecision = h.findPrecision(truePositives, trueNegatives, falsePositives, falseNegatives)
tmpRecall = h.findRecall(truePositives, trueNegatives, falsePositives, falseNegatives)
Expand Down

0 comments on commit 7efc5b5

Please sign in to comment.