Prediction of Ammonia Concentration in a Pig House Based on Machine Learning Models and Environmental Parameters

Animals (Basel). 2022 Dec 31;13(1):165. doi: 10.3390/ani13010165.

Abstract

Accurately predicting the air quality in a piggery and taking control measures in advance are important issues for pig farm production and local environmental management. In this experiment, the NH3 concentration in a semi-automatic piggery was studied. First, the random forest algorithm (RF) and Pearson correlation analysis were combined to analyze the environmental parameters, and nine input schemes for the model feature parameters were identified. Three kinds of deep learning and three kinds of conventional machine learning algorithms were applied to the prediction of NH3 in the piggery. Through comparative experiments, appropriate environmental parameters (CO2, H2O, P, and outdoor temperature) and superior algorithms (LSTM and RNN) were selected. On this basis, the PSO algorithm was used to optimize the hyperparameters of the algorithms, and their prediction performance was also evaluated. The results showed that the R2 values of PSO-LSTM and PSO-RNN were 0.9487 and 0.9458, respectively. These models had good accuracy when predicting NH3 concentration in the piggery 0.5 h, 1 h, 1.5 h, and 2 h in advance. This study can provide a reference for the prediction of air concentrations in pig house environments.

Keywords: ammonia concentration; machine learning; pig house; prediction models.