示例#1
0
        public static Output ProcessInstance(Tree tree, Instance i)
        {
            if (tree.Leaf != null)
            {
                return tree.Leaf;
            }

            return ProcessInstance(tree.TreeForInstance(i), i);
        }
示例#2
0
        private Tree LeafForEachFeature()
        {
            // each feature is the last item
            var branches = new Dictionary<Feature, Tree>();
                        
            foreach (var instance in Instances)
            {
                foreach (var feature in instance.Features)
                {
                    if (branches.Any(k => k.Key.Value == feature.Value))
                    {
                        continue;
                    }

                    branches[feature] = new Tree
                    {
                        Leaf = instance.Output
                    };
                }
            }
            
            return new Tree
            {
                Branches = branches
            };
        }