Describing APOGEE spectra as a function of coefficients of the stellar parameters