Recent observations of galaxies at $z gtrsim 7$, along with the low value of the electron scattering optical depth measured by the Planck mission, make galaxies plausible as dominant sources of ionizing photons during the epoch of reionization. However, scenarios of galaxy-driven reionization hinge on the assumption that the average escape fraction of ionizing photons is significantly higher for galaxies in the reionization epoch than in the local Universe. The NIRSpec instrument on the James Webb Space Telescope (JWST) will enable spectroscopic observations of large samples of reionization-epoch galaxies. While the leakage of ionizing photons will not be directly measurable from these spectra, the leakage is predicted to have an indirect effect on the spectral slope and the strength of nebular emission lines in the rest-frame ultraviolet and optical. Here, we apply a machine learning technique known as lasso regression on mock JWST/NIRSpec observations of simulated $z=7$ galaxies in order to obtain a model that can predict the escape fraction from JWST/NIRSpec data. Barring systematic biases in the simulated spectra, our method is able to retrieve the escape fraction with a mean absolute error of $Delta f_{mathrm{esc}} approx 0.12$ for spectra with $S/Napprox 5$ at a rest-frame wavelength of 1500 {AA} for our fiducial simulation. This prediction accuracy represents a significant improvement over previous similar approaches.