The neutral hydrogen~(HI) gas is an important barometer of recent star formation and metal enrichment activities in galaxies. I develop a novel statistical method for predicting the HI-to-stellar mass ratio $f_{gas}$ of galaxies from their stellar mass and optical colour, and apply it to a volume-limited galaxy sample jointly observed by the Sloan Digital Sky Survey and the Arecibo Legacy Fast ALFA survey. I eliminate the impact of the Malmquist bias against HI-deficient systems on the $f_{gas}$ predictor by properly accounting for the HI detection probability of each galaxy in the analysis. The best-fitting $f_{gas}$ predictor, with an estimated scatter of $0.272$ dex, provides excellent description to the observed HI mass function. After defining an HI excess parameter as the deviation of the observed $f_{gas}$ from the expected value, I confirm that there exists a strong secondary dependence of the mass-metallicity relation on HI excess. By further examining the 2D metallicity distribution on the specific star formation rate vs. HI excess plane, I show that the metallicity dependence on HI is likely more fundamental than that on specific star formation rate. In addition, I find that the environmental dependence of HI in the local Universe can be effectively described by the cross-correlation coefficient between HI excess and the red galaxy overdensity $rho_{cc}{=}-0.18$. This weak anti-correlation also successfully explains the observed dependence of HI clustering on $f_{gas}$. My method provides a useful framework for learning HI gas evolution from the synergy between future HI and optical galaxy surveys.