You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building the second tree, we need the leaf node value for each example. As suggested in the ISSUE #11, 3 examples are split into left and right side respectively. Namely, three should be -1.666666, three should be 0.5.
However, This is the leaf node value for each example in the python version:
I have found where the specific problematic code is.
The problematic function is learnTree in tree.py
Here sorting would not be correct because of so many decimal numbers which would be counted to the length of str. Based on the above code, the first tree would be:
fromdecimalimportgetcontext, Decimal#added by Changbinifclause[-1]!='-':
leafValue=Decimal(Utils.getleafValue(self.examples)).quantize(Decimal('0.000000')) #added by Changbinnode.learnedDecisionTree.append(clause[:-1]+" "+str(leafValue))
else:
leafValue=Decimal(Utils.getleafValue(self.examples)).quantize(Decimal('0.000000')) #added by Changbinnode.learnedDecisionTree.append(clause+" "+str(leafValue))
which could be used to search each example in the tree correctly.
The text was updated successfully, but these errors were encountered:
hayesall
changed the title
6: traversing each example in the first generated regression tree is wrong
Traversing each example in the first generated regression tree is wrong
Jul 17, 2018
Take Dataset ToyCancer as an example. This is the first built regression tree (MaxDepth = 1):
When building the second tree, we need the leaf node value for each example. As suggested in the ISSUE #11, 3 examples are split into left and right side respectively. Namely, three should be -1.666666, three should be 0.5.
However, This is the leaf node value for each example in the python version:
I have found where the specific problematic code is.
The problematic function is learnTree in tree.py
Here sorting would not be correct because of so many decimal numbers which would be counted to the length of str. Based on the above code, the first tree would be:
Therefore, all leaf node values for each example would be -0.166666666667.
Solution: keep the value of each clause has the same number of decimals.
Do some modification in function expandOnBestTest in tree.py.
the original code:
new modified code:
new result is:
which could be used to search each example in the tree correctly.
The text was updated successfully, but these errors were encountered: