.. _example_learning_plot_neighbors_photoz: K-Neighbors for Photometric Redshifts ------------------------------------- Estimate redshifts from the colors of sdss galaxies and quasars. This uses colors from a sample of 50,000 objects with SDSS photometry and ugriz magnitudes. The example shows how far one can get with an extremely simple machine learning approach to the photometric redshift problem. The function :func:`fetch_sdss_galaxy_colors` used below actually queries the SDSS CASjobs server for the colors of the 50,000 galaxies. .. image:: ../images/learning/plot_neighbors_photoz_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: plot_neighbors_photoz.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: plot_neighbors_photoz.py :lines: 14- .. raw:: html
:download:`[download source: plot_neighbors_photoz.py] ` .. raw:: html