Machine Learning Regression of extinction in the second $Gaia$ Data Release