<div dir="ltr">Hi Hanna<div><br></div><div>Thanks for the questions!</div><div><br></div><div>1) Best first tends to product unbalanced but sparser trees, and frequently produces more generalizable models by only capturing the most important interactions. Unbalanced isn't necessarily bad either. You can imagine that in some parts of the tree where there are complex split rules that are important to learn, but in other parts of the tree the additional splits only improve purity a tiny bit and risk overfitting (and thus being less generalizable).</div><div><br></div><div>2) If you let best first and depth first run until purity is reached, they will produce identical trees. The only difference is the ordering of the nodes as they get added to the tree. Best first will add nodes to the tree ordered by their increase in purity, and depth first adds nodes essentially in the order one would do a depth-first search. If one were to stop best first building early, they would get a tree where the important interactions are captured first, whereas if one were to stop a depth-first build early, they would get a really good split of one or maybe a few areas of the dataset (generally speaking). The reason max_leaf_nodes decides if BestFirstSplitter will be used or not is because it doesn't make sense to limit a depth first build by the number of nodes, and it doesn't make sense to run BestFirstSplitter without limiting the number of nodes in the tree.</div><div><br></div><div>Let me know if you have any further questions!</div><div><br></div><div>Jacob</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 21, 2017 at 1:38 PM, hanzi mao <span dir="ltr"><<a href="mailto:hzmao@hotmail.com" target="_blank">hzmao@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-5194870742540513295divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I am reading the source code of the Decision Tree Regressor in sklearn. To build a tree, there are two fashions: depth first and best first.  Best first fashion is adopted only when user set <span>max_leaf_nodes. Otherwise, the tree will be built using the
 DepthFirstTreeBuilder. My questions are:</span></p>
<p><span><br>
</span></p>
<p></p>
<ol style="margin-bottom:0px;margin-top:0px">
<li><span style="font-size:12pt"></span><span style="font-size:12pt">Are there any practical considerations when to use depth-first or best-first? Dose the depth-first fashion has a overwhelming advantage / popularity compared with the best-first one which
 makes it a default choice? </span></li><li>I am kind of confused why using a optional parameter max_leaf_nodes  to decide whether to use BestFirstTreeBuilder or not. I am wondering if there are some considerations when you decide to develop like this.</li></ol>
<div><br>
</div>
<div>Thanks!</div>
<div><br>
</div>
<div>Best,</div>
<div>Hanna</div>
<p></p>
</div>
</div>

<br>______________________________<wbr>_________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
<br></blockquote></div><br></div>