Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

DecisionTrees\Pruning\ErrorBasedPruning: The getMaxChild method returns the max grandchild #235

Closed
YaronK opened this issue May 25, 2016 · 1 comment

Comments

@YaronK
Copy link

YaronK commented May 25, 2016

There's possibly an issue is with the ErrorBasedPruning class - the getMaxChild method returns the max grandchild.

The algorithm referenced in the comments indeed considers replacing the node with its 'max child'.

This is the implementation of getMaxChild:

private DecisionNode getMaxChild(DecisionNode tree)
{
    DecisionNode max = null;
    int maxCount = 0;

    foreach (var child in tree.Branches)
    {
        if (child.Branches != null)
        {
            foreach (var node in child.Branches)
            {
                var list = subsets[node];
                if (list.Count > maxCount)
                {
                    max = node;
                    maxCount = list.Count;
                }
            }
        }
    }

    return max;
}

If I'm not mistaken, this implementation doesn't achieve the required result; Instead of returning the max child, it returns the max grandchild.
(Also, if I understood the implementation, getMaxChild is never executed on leaves, so the current node always has branches).

@YaronK YaronK changed the title DecisionTrees\Pruning\ErrorBasedPruning: the getMaxChild method returns the max grandchild DecisionTrees\Pruning\ErrorBasedPruning: The getMaxChild method returns the max grandchil May 25, 2016
@YaronK YaronK changed the title DecisionTrees\Pruning\ErrorBasedPruning: The getMaxChild method returns the max grandchil DecisionTrees\Pruning\ErrorBasedPruning: The getMaxChild method returns the max grandchild May 25, 2016
cesarsouza added a commit that referenced this issue Jun 1, 2016
Merging pull request for ErrorBasedPruning issues: 

Fixes GH-234, GH-235, GH-236. GH-237
@cesarsouza
Copy link
Member

Fixed on release 3.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants