.. _book_fig_chapter9_fig_photoz_forest: Photometric Redshifts by Random Forests --------------------------------------- Figure 9.15 Photometric redshift estimation using random forest regression, with ten random trees. Comparison to figure 9.14 shows that random forests correct for the overfitting evident in very deep decision trees. Here the optimal depth is 20 or above, and a much better cross-validation error is achieved. .. image:: ../images/chapter9/fig_photoz_forest_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: fig_photoz_forest.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: fig_photoz_forest.py :lines: 11- .. raw:: html
:download:`[download source: fig_photoz_forest.py] ` .. raw:: html