Using spectroscopic chemical abundances and neural networks to determine the distances, masses, and ages for stars in SDSS APOGEE