internal RecursiveRegressionTree(InternalRegressionTree t, DocumentPartitioning p, int n)
     : base(t, p, n)
 {
     _weightedOutput = double.NaN;
     _nodeCount      = int.MaxValue;
     if (!IsLeaf)
     {
         LteNode = new RecursiveRegressionTree(Tree, Partitioning, Tree.GetLteChildForNode(NodeIndex));
         GtNode  = new RecursiveRegressionTree(Tree, Partitioning, Tree.GetGtChildForNode(NodeIndex));
     }
 }
示例#2
0
        /// <summary>
        /// Regularize a regression tree with smoothing paramter alpha.
        /// </summary>
        protected virtual void SmoothTree(InternalRegressionTree tree, double smoothing)
        {
            if (smoothing == 0.0)
            {
                return;
            }

            //Create recursive structure of the tree starting from root node
            var regularizer = new RecursiveRegressionTree(tree, TreeLearner.Partitioning, 0);

            //Perform bottom-up computation of weighted interior node output
            double rootNodeOutput = regularizer.GetWeightedOutput();

            //followed by top-down propagation of parent's output value
            regularizer.SmoothLeafOutputs(rootNodeOutput, smoothing);
        }