DOI: 10.3390/agriculture16131454 ISSN: 2077-0472

Physics-Guided Machine Learning for Predicting the Internal Temperature of Mushroom Bags

Mingwen Shi, Xianpeng Sun, Xiaoying Ma, Xuelong Li, Jun Cao, Wei Qi, Hong Wang

Accurate prediction of the internal temperature of mushroom bags is essential but remains challenging owing to the complex nonlinear coupling between ambient conditions and the bag’s thermal state. This study proposes a physics-guided machine learning framework that translates thermodynamic prior knowledge into a set of interpretable engineered features. Specifically, we construct features that capture temporal thermal lags via cross-correlation optimal lag analysis, represent integrative thermal memory through cumulative moving averages and exponentially weighted moving averages (EWMAs) with a physically calibrated half-life, and quantify the interaction between evaporative cooling and ventilation using a vapor pressure deficit-gated temperature gradient. The engineered features are combined with standard environmental variables and supplied to several machine learning algorithms. Four paradigms—a physics model, a one-step physics model, a purely data-driven model, and the proposed physics-guided model—are systematically compared across four representative cultivation scenarios. The physics-guided XGBoost achieves the highest predictive accuracy, with R2 values of 0.996, 0.993, 0.997, and 0.973 for the four datasets, significantly outperforming all baselines. SHAP and Accumulated Local Effects analyses reveal that EWMA dominates predictions and that the learned feature–response relationships align with established thermodynamic principles, confirming physical consistency. The framework provides a practical, interpretable solution for feedforward environmental control in edible mushroom cultivation.

More from our Archive