EcoManure: A Machine Learning Framework for Nitrogen Level Prediction and Classification of Sustainable Manure Waste Management

Purpose

Agricultural waste, including animal manures, can be a source of environmental pollution if not handled properly (Maji et al., 2020) due to nitrogen leaching into water systems and methane emissions. While electronic sensors and spectroscopic devices can give measurements for nitrogen content, the costs can be prohibitive, with regular calibration and deviations from defined composition levels in manures. To address these challenges, we developed EcoManure, as a machine learning framework to predict nitrogen content and classify the type of manure. By incorporating historical and real-time data, EcoManure affords a competitive edge for enhanced accuracy and lowered dependency on expensive sensors in aiding more sustainable decision-making on waste management.

What Did We Do?

To handle the complex tasks of predicting nitrogen levels and classifying manure, we started by putting together a complete set of data that included key agricultural factors. We used ManureDB – National Database of Manure Nutrient Content and Other Characteristics (1998–2023), a publicly available dataset from the USDA Ag Data Commons. The dataset comprehensively listed the different types of animals, geographical locations, moisture content, total solids percentage, and the treatment methods for the manure, as well as its chemistry and physical characteristics like pH, level of organic matter, concentration of nutrients (Nitrogen, Phosphorus, Potassium), and trace constituents like Calcium, Magnesium, and Zinc. After this dataset was constructed, the cleaning procedures were carried out, which included dealing with missing values, encoding categorical variables, and applying feature engineering for better accuracy of the model with its predictions. The set was divided into 80% for training and the rest 20% for testing.

Table 1: Performance Metrics for Nutrient Prediction Model
Metric Value
Number of Training Samples 360,000
Number of Testing Samples 90,000
Classification Accuracy 0.50
Precision 0.86
Recall 0.14
F1-Score 0.71

We estimate the total nitrogen content from manure characteristics using a Random Forest Regressor during the predictive modeling phase. As shown in Table 1, this regression model was fine-tuned and validated using standard metrics such as mean squared error (MSE) and R² to address the accuracy issue in nitrogen prediction. Additionally, we evaluated the model’s performance using MSE (Mean Squared Error) and MAE (Mean Absolute Error), where lower values of both MSE and MAE indicate better prediction accuracy. Simultaneously, a Random Forest Classifier was constructed to predict different types of manure, allowing the differentiation between based on their fundamental compositional attributes. The performance of the classifier was evaluated on accuracy metrics to test its reliability in practical application as shown in table 2 and the visual representation in Figure 1 verifies the dependence of actual values and predicted values. The performance matrix includes Classification Accuracy, which measures the overall percentage of correct predictions, Precision, which shows how many predicted positive results are correct, Recall, which indicates how many actual positives were identified, and the F1 Score, which balances precision and recall into a single metric. We also created a friendly machine learning framework (Chlingaryan, Sukkarieh, & Whelan, 2018; Jordan & Mitchell, 2015) interface for easy predictions and classifications. This would allow farmers, scientists and other stakeholders like policymakers to input their relevant details of the manure and provide swift responses about its nitrogen content and type, thus leading to better sustainable decisions in farming.

Table 2: Performance Metrics for Manure Type Classification
Metric Value
Number of Training Samples 360,000
Number of Testing Samples 90,000
Classification Accuracy 92%
Precision 90%
Recall 91%
F1-Score 90.5%

Figure 1: Comparison of Actual and Predicted Nitrogen Levels

Figure 1: Comparison of Actual and Predicted Nitrogen LevelsWhat Have We Learned?According to our experimental findings, EcoManure accounts for 86% of the variability for the nitrogen content predictions in manure samples. Also, the system has an exceptionally high classification accuracy for manure types with close to 92%. These results demonstrate that machine learning can serve as a powerful alternative to expensive sensors and spectroscopic devices. AS a result, it provides accurate and cost-effective predictions.

Future Plans

Our future plan involves upgrading it to incorporate additional factors affecting the environment and manure treatment. As additional predictive variables, we will analyze temperature, humidity, and probable microorganisms’ composition. This will improve the accuracy of our model. Furthermore, sensor technology will enable continuous monitoring and real-time data collection, greatly enhancing our understanding of the manure’s state. This approach allows for timely modifications as needed. In conclusion, we aim to advance the field of precision agriculture and contribute towards environmental sustainability with a focus on intelligent waste management built on machine learning algorithms.

Authors

Presenting & corresponding author

Kallol Naha, PhD Candidate, Computer Science, University of Idaho, naha7197@vandals.uidaho.edu

Additional author

Hasan Jamil, Associate Professor, Computer Science, University of Idaho

Additional Information

Chlingaryan, A., Sukkarieh, S., & Whelan, B. (2018). Machine learning approaches for crop yield prediction and nitrogen status estimation in precision agriculture: A review. Computers and Electronics in Agriculture, 151, 61–69.

Maji, S., Dwivedi, D. H., Singh, N., Kishor, S., & Gond, M. (2020). Agricultural waste: Its impact on environment and management approaches. Emerging Eco-Friendly Green Technologies for Wastewater Treatment, 329–351.

Jordan, M. I., & Mitchell, T. M. (2015). Machine learning: Trends, perspectives, and prospects. Science, 349(6245), 255–260.

USDA. (2023). ManureDB – National Database of Manure Nutrient Content and Other Characteristics (1998–2023). USDA Ag Data Commons. Available at: https://agdatacommons.nal.usda.gov/articles/dataset/ManureDB_-National_database_of_manure_nutrient_content_and_other_characteristics_1998-_2023/26031256?file=47165362

Acknowledgements

This research was funded by the USDA Sustainable Agricultural Systems Initiative through the Idaho Sustainable Agriculture Initiative for Dairy (ISAID) grant (Award No. 2020-69012-31871).

 

The authors are solely responsible for the content of these proceedings. The technical information does not necessarily reflect the official position of the sponsoring agencies or institutions represented by planning committee members, and inclusion and distribution herein does not constitute an endorsement of views expressed by the same. Printed materials included herein are not refereed publications. Citations should appear as follows. EXAMPLE: Authors. 2025. Title of presentation. Waste to Worth. Boise, ID. April 7-11, 2025. URL of this page. Accessed on: today’s date.