Gluon helicity distribution in the nucleon from lattice QCD and machine learning