The improved fast Gauss transform with applications to machine learning