mostafacs / DecisionTree

Java Implementation for Multi-Class Decision Tree Machine Learning Algorithm training with large files
21 stars 10 forks source link

Children nodes are lost #1

Open KenKJ opened 7 years ago

KenKJ commented 7 years ago

Hi friend, I use below simple usecase to test the codes, found the tree had lost some children nodes, Like"EmIncome" , can you help check what the issue is?

I found the function: calculateSubTreeEntropy only runs normal when caculate the root node, and then it always returns 0.0, keeping investigating..

BigName|EmAgeLevel|EmIncome|IsStudent|EmCreditRate|Class Haha|YOUTH|HIGH|false|FAIR|false Haha|YOUTH|HIGH|false|EXCELLENT|false Haha|MIDDLE_AGED|HIGH|false|FAIR|true Haha|SENIOR|MEDIUM|false|FAIR|true Haha|SENIOR|LOW|true|FAIR|true Haha|SENIOR|LOW|true|EXCELLENT|false Haha|MIDDLE_AGED|LOW|true|EXCELLENT|true Haha|YOUTH|MEDIUM|false|FAIR|false Haha|YOUTH|LOW|true|FAIR|true Haha|SENIOR|MEDIUM|true|FAIR|true Haha|YOUTH|MEDIUM|true|EXCELLENT|true Haha|MIDDLE_AGED|MEDIUM|false|EXCELLENT|true Haha|MIDDLE_AGED|HIGH|true|FAIR|true

mostafacs commented 7 years ago

Checking it and I will be back to you. Thanks.

KenKJ commented 7 years ago

Hi Friend, I found the issue here: in DecisionTree.java, rownumber 284: if (!rows.get(counter)) continue;

the loop was continued but counter++ not run, I changed it to: if (!rows.get(counter)) { counter++; continue;} Then OK. for your information.