A Method to Predict CO2 Mass Concentration in Sheep Barns Based on the RF-PSO-LSTM Model
Abstract
:Simple Summary
Abstract
1. Introduction
2. Materials and Methods
2.1. Data Source
2.1.1. Test Area
2.1.2. Data Acquisition
2.1.3. Data Preprocessing
2.2. Predictive Model Construction
2.2.1. Random Forest Feature Importance Ranking
2.2.2. LSTM Model
2.2.3. Particle Swarm Optimization
2.2.4. RF-PSO-LSTM Prediction Model
2.3. Model Performance Evaluation Metrics
2.4. Model Test Platform
3. Results and Discussion
3.1. PSO Algorithm Parameter Setting
3.2. Determination of LSTM Model Structure
3.3. Optimal Time Step
3.4. Feature Importance Ranking and Filtering
3.5. PSO Results for Hyperparameter Search
3.6. Comparative Analysis of Hyperparameter Predictions
3.7. Comparative Analysis of Model Predictions
4. Conclusions
- (1)
- The RF algorithm was able to filter out the important features affecting the prediction of CO2 mass concentration in sheep barns and remove features of lower importance, reducing the input to the model and the complexity of the data. The experimental results show that training the model using the filtered important features can improve the prediction performance.
- (2)
- We used the PSO algorithm to find the optimal number of neurons, dropout value, and batch size hyperparameters of the LSTM model and obtain the optimal combination of hyperparameters, avoiding the disadvantages of manual selection of hyperparameters.
- (3)
- The experimental results show that our proposed RF-PSO-LSTM model could effectively predict the trend of CO2 mass concentration in sheep sheds with a higher accuracy than typical prediction models such as RFR, SVR, GBRT, and LightGBM. The prediction results of our model can provide important support for improving the growing environment of meat sheep, which is conducive to improving the welfare of the sheep.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Ma, T.; Deng, K.-D.; Tu, Y.; Zhang, N.-F.; Zhao, Q.-N.; Li, C.-Q.; Jin, H.; Diao, Q.-Y. Recent advances in nutrient requirements of meat-type sheep in China: A review. J. Integr. Agric. 2022, 21, 1–14. [Google Scholar] [CrossRef]
- Mao, L.; Li, W.; Hao, F.; Yang, L.; Li, J.; Sun, M.; Zhang, W.; Liu, M.; Luo, X.; Cheng, Z. Research Progress on Emerging Viral Pathogens of Small Ruminants in China during the Last Decade. Viruses 2022, 14, 1288. [Google Scholar] [CrossRef]
- Alday, J.G.; O’Reilly, J.; Rose, R.J.; Marrs, R.H. Long-term effects of sheep-grazing and its removal on vegetation dynamics of British upland grasslands and moorlands; local management cannot overcome large-scale trends. Ecol. Indic. 2022, 139, 108878. [Google Scholar] [CrossRef]
- Jørgensen, N.; Steinheim, G.; Holand, Ø. Does Scale Matter? Variation in Area Use Across Spatiotemporal Scales of Two Sheep Breeds in Two Contrasting Alpine Environments. Rangel. Ecol. Manag. 2018, 71, 189–195. [Google Scholar] [CrossRef]
- Wang, L.; Zhang, M.; Li, Y.; Xia, J.; Ma, R. Wearable multi-sensor enabled decision support system for environmental comfort evaluation of mutton sheep farming. Comput. Electron. Agric. 2021, 187, 106302. [Google Scholar] [CrossRef]
- Zhang, M.; Wang, X.; Feng, H.; Huang, Q.; Xiao, X.; Zhang, X. Wearable Internet of Things enabled precision livestock farming in smart farms: A review of technical solutions for precise perception, biocompatibility, and sustainability monitoring. J. Clean. Prod. 2021, 312, 127712. [Google Scholar] [CrossRef]
- Stubsjøen, S.; Moe, R.; Mejdell, C.; Tømmerberg, V.; Knappe-Poindecker, M.; Kampen, A.; Granquist, E.; Muri, K. Sheep welfare in different housing systems in South Norway. Small Rumin. Res. 2022, 214, 106740. [Google Scholar] [CrossRef]
- Zhao, X.; Shi, L.; Lou, S.; Ning, J.; Guo, Y.; Jia, Q.; Hou, F. Sheep Excrement Increases Mass of Greenhouse Gases Emissions from Soil Growing Two Forage Crop and Multi-Cutting Reduces Intensity. Agriculture 2021, 11, 238. [Google Scholar] [CrossRef]
- Elghandour, M.M.; Antolin-Cera, X.; Salem, A.Z.; Barbabosa-Pliego, A.; Valladares-Carranza, B.; Ugbogu, E.A. Influence of Escherichia coli inclusion and soybean hulls based diets on ruminal biomethane and carbon dioxide productions in sheep. J. Clean. Prod. 2018, 192, 766–774. [Google Scholar] [CrossRef]
- Pedersen, S.; Blanes-Vidal, V.; Joergensen, H.; Chwalibog, A.; Haeussermann, A.; Heetkamp, M.J.W.; Aarnink, A.J.A. Carbon Dioxide Production in Animal Houses: A Literature Review. Agric. Eng. Int. 2008, 10. [Google Scholar]
- Moehn, S.; Bertolo, R.F.P.; Pencharz, P.B.; Ball, R.O. Pattern of carbon dioxide production and retention is similar in adult pigs when fed hourly, but not when fed a single meal. BMC Physiol. 2004, 4, 11. [Google Scholar] [CrossRef] [Green Version]
- Steiner, A.R.; Flammer, S.A.; Beausoleil, N.J.; Berg, C.; Bettschart-Wolfensberger, R.; Pinillos, R.G.; Golledge, H.D.; Marahrens, M.; Meyer, R.; Schnitzer, T.; et al. Humanely Ending the Life of Animals: Research Priorities to Identify Alternatives to Carbon Dioxide. Animals 2019, 9, 911. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Sindhøj, E.; Lindahl, C.; Bark, L. Review: Potential alternatives to high-concentration carbon dioxide stunning of pigs at slaughter. Animal 2021, 15, 100164. [Google Scholar] [CrossRef] [PubMed]
- Yeo, U.-H.; Jo, S.-K.; Kim, S.-H.; Park, D.-H.; Jeong, D.-Y.; Park, S.-J.; Shin, H.; Kim, R.-W. Applicability of Machine-Learned Regression Models to Estimate Internal Air Temperature and CO2 Concentration of a Pig House. Agronomy 2023, 13, 328. [Google Scholar] [CrossRef]
- Li, Y.; Li, S.; Sun, X.; Hao, D. Prediction of carbon dioxide production from green waste composting and identification of critical factors using machine learning algorithms. Bioresour. Technol. 2022, 360, 127587. [Google Scholar] [CrossRef]
- Zhao, J.; Kou, L.; Jiang, Z.; Lu, N.; Wang, B.; Li, Q. A novel evaluation model for carbon dioxide emission in the slurry shield tunnelling. Tunn. Undergr. Space Technol. 2022, 130, 104757. [Google Scholar] [CrossRef]
- Javanmard, M.E.; Ghaderi, S.; Hoseinzadeh, M. Data mining with 12 machine learning algorithms for predict costs and carbon dioxide emission in integrated energy-water optimization model in buildings. Energy Convers. Manag. 2021, 238, 114153. [Google Scholar] [CrossRef]
- Qin, J.; Gong, N. The estimation of the carbon dioxide emission and driving factors in China based on machine learning methods. Sustain. Prod. Consum. 2022, 33, 218–229. [Google Scholar] [CrossRef]
- Bhatt, H.; Davawala, M.; Joshi, T.; Shah, M.; Unnarkat, A. Forecasting and mitigation of global environmental carbon dioxide emission using machine learning techniques. Clean. Chem. Eng. 2023, 5, 100095. [Google Scholar] [CrossRef]
- Abbasi, N.A.; Hamrani, A.; Madramootoo, C.A.; Zhang, T.; Tan, C.S.; Goyal, M.K. Modelling carbon dioxide emissions under a maize-soy rotation using machine learning. Biosyst. Eng. 2021, 212, 1–18. [Google Scholar] [CrossRef]
- Kshirsagar, P.R.; Manoharan, H.; Selvarajan, S.; Althubiti, S.A.; Alenezi, F.; Srivastava, G.; Lin, J.C.-W. A Radical Safety Measure for Identifying Environmental Changes Using Machine Learning Algorithms. Electronics 2022, 11, 1950. [Google Scholar] [CrossRef]
- Hien, N.L.H.; Kor, A.-L. Analysis and Prediction Model of Fuel Consumption and Carbon Dioxide Emissions of Light-Duty Vehicles. Appl. Sci. 2022, 12, 803. [Google Scholar] [CrossRef]
- Tena-Gago, D.; Golcarenarenji, G.; Martinez-Alpiste, I.; Wang, Q.; Alcaraz-Calero, J.M. Machine-Learning-Based Carbon Dioxide Concentration Prediction for Hybrid Vehicles. Sensors 2023, 23, 1350. [Google Scholar] [CrossRef]
- Liu, X.; Guo, H. Air quality indicators and AQI prediction coupling long-short term memory (LSTM) and sparrow search algorithm (SSA): A case study of Shanghai. Atmos. Pollut. Res. 2022, 13, 101551. [Google Scholar] [CrossRef]
- Wang, X.; Yan, C.; Liu, W.; Liu, X. Research on Carbon Emissions Prediction Model of Thermal Power Plant Based on SSA-LSTM Algorithm with Boiler Feed Water Influencing Factors. Sustainability 2022, 14, 15988. [Google Scholar] [CrossRef]
- Nie, J.; Wang, Y.; Li, Y.; Chao, X. Artificial intelligence and digital twins in sustainable agriculture and forestry: A survey. Turk. J. Agric. For. 2022, 46, 642–661. [Google Scholar] [CrossRef]
- Nie, J.; Wang, Y.; Li, Y.; Chao, X. Sustainable computing in smart agriculture: Survey and challenges. Turk. J. Agric. For. 2022, 46, 550–566. [Google Scholar] [CrossRef]
- Li, Y.; Chao, X. ANN-Based Continual Classification in Agriculture. Agriculture 2020, 10, 178. [Google Scholar] [CrossRef]
- Zhao, H.; Li, J.; Nie, J.; Ge, J.; Yang, S.; Yu, L.; Pu, Y.; Wang, K. Identification Method for Cone Yarn Based on the Improved Faster R-CNN Model. Processes 2022, 10, 634. [Google Scholar] [CrossRef]
- Wang, N.; Nie, J.; Li, J.; Wang, K.; Ling, S. A compression strategy to accelerate LSTM meta-learning on FPGA. ICT Express 2022, 8, 322–327. [Google Scholar] [CrossRef]
- Nie, J.; Wang, N.; Li, J.; Wang, K.; Wang, H. Meta-learning prediction of physical and chemical properties of magnetized water and fertilizer based on LSTM. Plant Methods 2021, 17, 119. [Google Scholar] [CrossRef] [PubMed]
- Nie, J.; Wang, N.; Li, J.; Wang, Y.; Wang, K. Prediction of Liquid Magnetization Series Data in Agriculture Based on Enhanced CGAN. Front. Plant Sci. 2022, 13, 1883. [Google Scholar] [CrossRef] [PubMed]
- Li, Y.; Nie, J.; Chao, X. Do we really need deep CNN for plant diseases identification? Comput. Electron. Agric. 2020, 178, 105803. [Google Scholar] [CrossRef]
- Li, Y.; Yang, J. Few-shot cotton pest recognition and terminal realization. Comput. Electron. Agric. 2020, 169, 105240. [Google Scholar] [CrossRef]
- Yu, L.; Pu, Y.; Cen, H.; Li, J.; Liu, S.; Nie, J.; Ge, J.; Lv, L.; Li, Y.; Xu, Y.; et al. A Lightweight Neural Network-Based Method for Detecting Estrus Behavior in Ewes. Agriculture 2022, 12, 1207. [Google Scholar] [CrossRef]
- Yin, X.; Wu, D.; Shang, Y.; Jiang, B.; Song, H. Using an EfficientNet-LSTM for the recognition of single Cow’s motion behaviours in a complicated environment. Comput. Electron. Agric. 2020, 177, 105707. [Google Scholar] [CrossRef]
- Yu, L.; Guo, J.; Pu, Y.; Cen, H.; Li, J.; Liu, S.; Nie, J.; Ge, J.; Yang, S.; Zhao, H.; et al. A Recognition Method of Ewe Estrus Crawling Behavior Based on Multi-Target Detection Layer Neural Network. Animals 2023, 13, 413. [Google Scholar] [CrossRef]
- Wang, Z.; Liu, N.; Chen, C.; Guo, Y. Adaptive self-attention LSTM for RUL prediction of lithium-ion batteries. Inf. Sci. 2023, 635, 398–413. [Google Scholar] [CrossRef]
- Lin, H.; Zhang, S.; Li, Q.; Li, Y.; Li, J.; Yang, Y. A new method for heart rate prediction based on LSTM-BiLSTM-Att. Measurement 2023, 207, 112384. [Google Scholar] [CrossRef]
- Wu, Z.; Yin, H.; He, H.; Li, Y. Dynamic-LSTM hybrid models to improve seasonal drought predictions over China. J. Hydrol. 2022, 615, 128706. [Google Scholar] [CrossRef]
- Zhang, W.; Zhou, H.; Bao, X.; Cui, H. Outlet water temperature prediction of energy pile based on spatial-temporal feature extraction through CNN–LSTM hybrid model. Energy 2023, 264, 126190. [Google Scholar] [CrossRef]
- Wang, J.; Si, H.; Gao, Z.; Shi, L. Winter Wheat Yield Prediction Using an LSTM Model from MODIS LAI Products. Agriculture 2022, 12, 1707. [Google Scholar] [CrossRef]
- Di Già, S.; Papurello, D. Hybrid Models for Indoor Temperature Prediction Using Long Short Term Memory Networks—Case Study Energy Center. Buildings 2022, 12, 933. [Google Scholar] [CrossRef]
- Wang, Y.; Watanabe, D.; Hirata, E.; Toriumi, S. Real-Time Management of Vessel Carbon Dioxide Emissions Based on Automatic Identification System Database Using Deep Learning. J. Mar. Sci. Eng. 2021, 9, 871. [Google Scholar] [CrossRef]
- Rezaei, R.; Naderalvojoud, B.; Güllü, G. A Comparative Study of Deep Learning Models on Tropospheric Ozone Forecasting Using Feature Engineering Approach. Atmosphere 2023, 14, 239. [Google Scholar] [CrossRef]
- Genuer, R.; Poggi, J.; Tuleau-Malot, C. Variable selection using random forests. Pattern Recognit. Lett. 2010, 31, 2225–2236. [Google Scholar] [CrossRef] [Green Version]
- Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
- Eberhart, R.; Kennedy, J. A New Optimizer Using Particle Swarm Theory. In MHS’95, Proceedings of the Sixth International Symposium on Micro Machine and Human Science, Nagoya, Japan, 4–6 October 1995; IEEE: New York, NY, USA, 1995; pp. 39–43. [Google Scholar] [CrossRef]
- Li, Y.; Zhu, Z.; Kong, D.; Han, H.; Zhao, Y. EA-LSTM: Evolutionary attention-based LSTM for time series prediction. Knowl.-Based Syst. 2019, 181, 104785. [Google Scholar] [CrossRef] [Green Version]
- Liu, Y.; Wang, Y.; Yang, X.; Zhang, L. Short-term travel time prediction by deep learning: A comparison of different LSTM-DNN models. In Proceedings of the 2017 IEEE 20th International Conference on Intelligent Transportation Systems (ITSC), Yokohama, Japan, 16–19 October 2017; pp. 1–8. [Google Scholar]
- Yin, H.; Jin, D.; Gu, Y.; Park, C.-J.; Han, S.; Yoo, S. STL-ATTLSTM: Vegetable Price Forecasting Using STL and Attention Mechanism-Based LSTM. Agriculture 2020, 10, 612. [Google Scholar] [CrossRef]
Testing Index | Measurement Range | Accuracy | Agreement |
---|---|---|---|
Light intensity (lx) | 0~65,535 | ±5 | IIC |
Air temperature (°C) | −40~105 | ±0.4 | IIC |
Air relative humidity (%) | 0~100 | ±5 | IIC |
Noise (dB) | 30~120 | ±5 | IIC |
PM2.5 mass concentration (μg·m−3) | 0~999.9 | ±7% | Modbus |
PM10 mass concentration (μg·m−3) | 0~999.9 | ±7% | Modbus |
CO2 mass concentration (μg·m−3) | 0~50,000 | ±50 | PWM |
TSP mass concentration (μg·m−3) | 0~999.9 | ±7% | PWM |
H2S mass concentration (μg·m−3) | 0~10 | ±3% | PWM |
Testing Index | 11 February 2021 | 11 February 2021 | 11 February 2021 | 11 February 2021 | 11 February 2021 | 11 February 2021 |
---|---|---|---|---|---|---|
10:12:18 | 10:22:10 | 10:32:09 | 10:42:10 | 10:52:23 | 11:02:16 | |
Light intensity (lx) | 24 | 30 | 39 | 42 | 97 | 122 |
Air temperature (°C) | 1.5 | 1.5 | 1.5 | 1.6 | 1.6 | 1.7 |
Air relative humidity (%) | 85.7 | 86.1 | 86.4 | 86.6 | 86.8 | 87.1 |
Noise (dB) | 32 | 80.8 | 59.4 | 69.8 | 32 | 45.3 |
PM2.5 mass concentration (μg·m−3) | 13.4 | 14.2 | 12.4 | 12.9 | 12.3 | 11.9 |
PM10 mass concentration (μg·m−3) | 48.2 | 38.2 | 42.1 | 36.4 | 24.9 | 34.1 |
CO2 mass concentration (μg·m−3) | 1300 | 1285 | 1315 | 1330 | 1420 | 1425 |
TSP mass concentration (μg·m−3) | 76.3 | 65 | 67.5 | 61.1 | 46.2 | 57 |
H2S mass concentration (μg·m−3) | 8.4 | 8.4 | 8.2 | 8.4 | 8.4 | 8.4 |
Parameter | Value |
---|---|
Inertia weighting factor w | 0.5 |
Learning factor c1 | 1.3 |
Learning factor c2 | 1.4 |
Search for spatial dimension D | 3 |
r1 | 0.6 |
r2 | 0.8 |
Number of particles N | 50 |
Number of iterations | 100 |
Number of Hidden Layers | RMSE (μg·m−3) | MAE (μg·m−3) | R2 | Model Parameters |
---|---|---|---|---|
1 | 123.959 | 95.315 | 0.978 | 32,251 |
2 | 108.177 | 83.187 | 0.984 | 52,451 |
3 | 127.123 | 97.337 | 0.975 | 72,651 |
4 | 143.066 | 109.88 | 0.972 | 92,851 |
5 | 165.080 | 125.849 | 0.959 | 113,051 |
Time Step | RMSE (μg·m−3) | MAE (μg·m−3) | R2 |
---|---|---|---|
1 | 108.217 | 85.161 | 0.981 |
20 | 108.177 | 83.187 | 0.984 |
40 | 111.135 | 82.41 | 0.983 |
60 | 109.586 | 81.8 | 0.982 |
80 | 119.726 | 87.69 | 0.979 |
100 | 123.212 | 90.919 | 0.978 |
Order of Importance | Parameter | Importance Score |
---|---|---|
1 | Light intensity (lx) | 0.750228 |
2 | Air relative humidity (%) | 0.114946 |
3 | Air temperature (°C) | 0.056363 |
4 | PM2.5 mass concentration (μg·m−3) | 0.027768 |
5 | PM10 mass concentration (μg·m−3) | 0.018287 |
6 | Noise (dB) | 0.013143 |
7 | TSP mass concentration (μg·m−3) | 0.011485 |
8 | H2S mass concentration (μg·m−3) | 0.007780 |
Model Name | Number of Neurons in Input Layer | Number of Neurons in Hidden Layer 1 | Number of Neurons in Hidden Layer 2 | Dropout | Batch Size | RMSE (μg·m−3) | MAE (μg·m−3) | R2 |
---|---|---|---|---|---|---|---|---|
RF-PSO-LSTM | 64 | 128 | 32 | 0.1 | 32 | 75.422 | 51.839 | 0.992 |
RF-LSTM_1 | 64 | 128 | 32 | 0.1 | 64 | 79.321 | 54.592 | 0.991 |
RF-LSTM_2 | 64 | 128 | 32 | 0.1 | 128 | 79.065 | 57.540 | 0.991 |
RF-LSTM_3 | 64 | 128 | 32 | 0.2 | 32 | 78.503 | 54.267 | 0.991 |
RF-LSTM_4 | 64 | 128 | 32 | 0.3 | 32 | 78.864 | 55.039 | 0.991 |
RF-LSTM_5 | 64 | 128 | 64 | 0.1 | 32 | 78.230 | 54.361 | 0.991 |
RF-LSTM_6 | 64 | 128 | 128 | 0.1 | 32 | 77.077 | 52.956 | 0.991 |
RF-LSTM_7 | 64 | 64 | 32 | 0.1 | 32 | 78.250 | 54.089 | 0.991 |
RF-LSTM_8 | 64 | 256 | 32 | 0.1 | 32 | 77.180 | 53.072 | 0.991 |
RF-LSTM_9 | 32 | 128 | 32 | 0.1 | 32 | 78.714 | 53.785 | 0.991 |
RF-LSTM_10 | 128 | 128 | 32 | 0.1 | 32 | 79.167 | 54.053 | 0.991 |
RF-LSTM_11 | 256 | 128 | 32 | 0.1 | 32 | 77.710 | 52.995 | 0.991 |
Model | RMSE (μg·m−3) | MAE (μg·m−3) | R2 |
---|---|---|---|
RFR | 216.373 | 145.855 | 0.939 |
SVR | 589.336 | 484.475 | 0.545 |
GBRT | 285.102 | 213.499 | 0.895 |
LightGBM | 288.001 | 209.788 | 0.891 |
RF-RFR | 220.844 | 138.994 | 0.937 |
RF-SVR | 545.848 | 441.301 | 0.610 |
RF-GBRT | 280.627 | 211.323 | 0.899 |
RF-LightGBM | 279.669 | 202.661 | 0.897 |
RF-PSO-LSTM | 75.422 | 51.839 | 0.992 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Cen, H.; Yu, L.; Pu, Y.; Li, J.; Liu, Z.; Cai, Q.; Liu, S.; Nie, J.; Ge, J.; Guo, J.; et al. A Method to Predict CO2 Mass Concentration in Sheep Barns Based on the RF-PSO-LSTM Model. Animals 2023, 13, 1322. https://doi.org/10.3390/ani13081322
Cen H, Yu L, Pu Y, Li J, Liu Z, Cai Q, Liu S, Nie J, Ge J, Guo J, et al. A Method to Predict CO2 Mass Concentration in Sheep Barns Based on the RF-PSO-LSTM Model. Animals. 2023; 13(8):1322. https://doi.org/10.3390/ani13081322
Chicago/Turabian StyleCen, Honglei, Longhui Yu, Yuhai Pu, Jingbin Li, Zichen Liu, Qiang Cai, Shuangyin Liu, Jing Nie, Jianbing Ge, Jianjun Guo, and et al. 2023. "A Method to Predict CO2 Mass Concentration in Sheep Barns Based on the RF-PSO-LSTM Model" Animals 13, no. 8: 1322. https://doi.org/10.3390/ani13081322
APA StyleCen, H., Yu, L., Pu, Y., Li, J., Liu, Z., Cai, Q., Liu, S., Nie, J., Ge, J., Guo, J., Yang, S., Zhao, H., & Wang, K. (2023). A Method to Predict CO2 Mass Concentration in Sheep Barns Based on the RF-PSO-LSTM Model. Animals, 13(8), 1322. https://doi.org/10.3390/ani13081322