Ejemplo n.º 1
0
        public Tree BuildTree()
        {
            if (InstancesAreSameClass || Instances.All(f => f.Features.Count() == 1))
            {
                return(LeafTreeForRemainingFeatures());
            }

            var best = Decider.SelectBestAxis(this);

            return(SplitByAxis(best));
        }
Ejemplo n.º 2
0
        private Tree LeafTreeForRemainingFeatures()
        {
            if (InstancesAreSameClass)
            {
                return(GroupByClass());
            }

            if (Instances.All(f => f.Features.Count() == 1))
            {
                return(LeafForEachFeature());
            }

            return(null);
        }